From 0cf2c7a7c82f3dc8fa7dff75ba8b41bb5335a3d4 Mon Sep 17 00:00:00 2001
From: Ruben Rodriguez <ruben@trisquel.info>
Date: Fri, 9 Jun 2023 17:04:52 -0400
Subject: [PATCH] command-not-found: don't recommend extra repositories

---
 .../command-not-found/no_extra_repos.patch    | 24 +++++++++++++++++++
 helpers/make-command-not-found                |  7 ++++--
 2 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 helpers/DATA/command-not-found/no_extra_repos.patch

diff --git a/helpers/DATA/command-not-found/no_extra_repos.patch b/helpers/DATA/command-not-found/no_extra_repos.patch
new file mode 100644
index 00000000..1da535ed
--- /dev/null
+++ b/helpers/DATA/command-not-found/no_extra_repos.patch
@@ -0,0 +1,24 @@
+diff -ru source.orig/CommandNotFound/CommandNotFound.py source/CommandNotFound/CommandNotFound.py
+--- source.orig/CommandNotFound/CommandNotFound.py	2021-12-08 05:53:19.000000000 -0500
++++ source/CommandNotFound/CommandNotFound.py	2023-06-09 16:52:12.675354733 -0400
+@@ -227,8 +227,6 @@
+         else:
+             print("apt install %s" % packages[0][0], file=self.output_fd)
+             print(_("Please ask your administrator."))
+-            if not packages[0][2] in self.sources_list:
+-                print(_("You will have to enable the component called '%s'") % packages[0][2], file=self.output_fd)
+         self.output_fd.flush()
+ 
+     def sudo(self):
+@@ -246,10 +244,7 @@
+                     ver = "  # version %s, or" % (package[1])
+                 else:
+                     ver = "  # version %s" % (package[1])
+-            if package[2] in self.sources_list:
+-                print("%sapt install %-*s%s" % (self.sudo(), pad, package[0], ver), file=self.output_fd)
+-            else:
+-                print("%sapt install %-*s%s" % (self.sudo(), pad, package[0], ver) + " (" + _("You will have to enable component called '%s'") % package[2] + ")", file=self.output_fd)
++            print("%sapt install %-*s%s" % (self.sudo(), pad, package[0], ver), file=self.output_fd)
+         if self.euid != 0 and not self.user_can_sudo:
+             print(_("Ask your administrator to install one of them."), file=self.output_fd)
+         self.output_fd.flush()
diff --git a/helpers/make-command-not-found b/helpers/make-command-not-found
index befcefb0..b95e1e29 100644
--- a/helpers/make-command-not-found
+++ b/helpers/make-command-not-found
@@ -19,7 +19,7 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 #
 
-VERSION=2
+VERSION=3
 
 . ./config
 
@@ -45,9 +45,12 @@ sed -i '/snapd/d' debian/control
 #Remove update-from-web
 rm update-from-web.sh
 
-#Patch test
+#Patch the test suite
 patch -p1 < $DATA/fix_test.patch
 
+#Do not recommend extra repositories
+patch -p1 < $DATA/no_extra_repositories.patch
+
 changelog "Removed references to non-free software"
 
 compile
-- 
GitLab