From b2ded520d2fd1c0102b423ec6bbd56ff5b24400b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Guzm=C3=A1n?= Date: Sat, 18 May 2024 10:32:13 +0000 Subject: [PATCH] update-manager: update patches and helper to meet new python test and style. --- .../extra/99_pycodestyle_pass.patch | 28 ++++ .../prevent-autoconnection.patch | 136 ++++++++--------- .../update-manager/remove-livepatch2.patch | 71 +++++---- ...client.api.u.pro.packages.updates.v1.patch | 107 ------------- .../rm_pro.packages.updates_from_u-m.patch | 143 ++++++++++++++++++ .../update-manager/trisquel-versions.patch | 28 ++-- helpers/make-update-manager | 25 ++- 7 files changed, 316 insertions(+), 222 deletions(-) create mode 100644 helpers/DATA/update-manager/extra/99_pycodestyle_pass.patch delete mode 100644 helpers/DATA/update-manager/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch create mode 100644 helpers/DATA/update-manager/rm_pro.packages.updates_from_u-m.patch diff --git a/helpers/DATA/update-manager/extra/99_pycodestyle_pass.patch b/helpers/DATA/update-manager/extra/99_pycodestyle_pass.patch new file mode 100644 index 0000000..e9e60a6 --- /dev/null +++ b/helpers/DATA/update-manager/extra/99_pycodestyle_pass.patch @@ -0,0 +1,28 @@ +diff --git a/UpdateManager/Core/UpdateList.py b/UpdateManager/Core/UpdateList.py +index 0f887633..5f919829 100644 +--- a/UpdateManager/Core/UpdateList.py ++++ b/UpdateManager/Core/UpdateList.py +@@ -184,7 +184,7 @@ class UpdatePackageGroup(UpdateGroup): + + class UpdateSystemGroup(UpdateGroup): + def __init__(self, cache, to_remove, sensitive=True): +- # Translators: the %s is a distro name, like 'Trisquel' and 'base' as in ++ # Translators: %s is a distro name, like 'Trisquel' and 'base' as in + # the core components and packages. + name = "Trisquel base" + icon = Gio.ThemedIcon.new("distributor-logo") +diff --git a/UpdateManager/UpdatesAvailable.py b/UpdateManager/UpdatesAvailable.py +index 7562bcc6..17de28cb 100644 +--- a/UpdateManager/UpdatesAvailable.py ++++ b/UpdateManager/UpdatesAvailable.py +@@ -851,8 +851,8 @@ class UpdatesAvailable(InternalDialog): + self.button_pro.destroy() + elif (self.list.ubuntu_pro_fake_groups + and not self.list.ubuntu_pro_groups): +- download_str = _("You need to enable Trisquel Pro to install" +- " these updates.") ++ download_str = _("You need to enable Trisquel Pro to" ++ " install these updates.") + self.button_install.destroy() + else: + download_str = _("There are no updates to install.") diff --git a/helpers/DATA/update-manager/prevent-autoconnection.patch b/helpers/DATA/update-manager/prevent-autoconnection.patch index 2712c3a..7e30660 100644 --- a/helpers/DATA/update-manager/prevent-autoconnection.patch +++ b/helpers/DATA/update-manager/prevent-autoconnection.patch @@ -1,44 +1,67 @@ -diff -ru source.orig/UpdateManager/Dialogs.py source/UpdateManager/Dialogs.py ---- source.orig/UpdateManager/Dialogs.py 2018-02-12 20:44:33.321329066 -0500 -+++ source/UpdateManager/Dialogs.py 2018-02-12 20:45:28.141249480 -0500 -@@ -161,7 +162,21 @@ - self.add_settings_button() - self.focus_button = self.add_button(Gtk.STOCK_OK, - self.window_main.close) +diff --git a/UpdateManager/Dialogs.py b/UpdateManager/Dialogs.py +index a5d13ad4..89603956 100644 +--- a/UpdateManager/Dialogs.py ++++ b/UpdateManager/Dialogs.py +@@ -175,6 +175,23 @@ class NoUpdatesDialog(InternalDialog): + Gtk.STOCK_OK, self.window_main.close + ) + ++ +class ShouldUpdateDialog(InternalDialog): + def __init__(self, window_main): - ++ + InternalDialog.__init__(self, window_main) + self.set_header(_("Include latest updates from the Internet?")) + self.set_desc(_('''To prevent unwanted connections to the Internet +Trisquel will not automatically check for updates +unless you say so in the Settings panel.''')) + self.add_settings_button() -+ self.add_button(_("Check for Updates"),self.check) ++ self.add_button(_("Check for Updates"), self.check) + self.add_button(_("Ask Me Later"), self.window_main.close) + + def check(self): + self.window_main.options.no_update = False + self.window_main.check_update() ++ class DistUpgradeDialog(InternalDialog): def __init__(self, window_main, meta_release): -diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateManager.py ---- source.orig/UpdateManager/UpdateManager.py 2018-02-12 20:44:33.317329071 -0500 -+++ source/UpdateManager/UpdateManager.py 2018-02-12 20:45:28.133249491 -0500 -@@ -52,6 +52,7 @@ - ErrorDialog, - HWEUpgradeDialog, - NeedRestartDialog, -+ ShouldUpdateDialog, - NoUpdatesDialog, - PartialUpgradeDialog, - StoppedUpdatesDialog, -@@ -205,6 +206,17 @@ +diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py +index b6cdc8ab..d82db9dd 100644 +--- a/UpdateManager/UpdateManager.py ++++ b/UpdateManager/UpdateManager.py +@@ -56,6 +56,7 @@ from .Dialogs import ( + ErrorDialog, + HWEUpgradeDialog, + NeedRestartDialog, ++ ShouldUpdateDialog, + NoUpdatesDialog, + NoUpgradeForYouDialog, + PartialUpgradeDialog, +@@ -125,11 +126,12 @@ class UpdateManager(Gtk.Window): + ) + + # Look for a new release in a thread +- self.meta_release = MetaRelease( +- self.options and self.options.devel_release, +- self.options and self.options.use_proposed, +- self.options and self.options.debug, +- ) ++ if self.options.check_dist_upgrades and ++ apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") != 0: ++ self.meta_release = MetaRelease( ++ self.options and self.options.devel_release, ++ self.options and self.options.use_proposed, ++ self.options and self.options.debug) + + def begin_user_resizable(self, stored_width=0, stored_height=0): + self.set_resizable(True) +@@ -205,6 +206,18 @@ self.start_available() def start_update(self): -+ if not self.options.no_check_screen and apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") == 0: ++ if not self.options.no_check_screen and ++ apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") == 0: + self._start_pane(ShouldUpdateDialog(self)) + return + if self.options.no_update: @@ -52,52 +75,7 @@ diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateM if self.options.no_update: self.start_available() return -diff -ru source.orig/update-manager source/update-manager ---- source.orig/update-manager 2023-05-04 19:26:47.710184166 -0400 -+++ source/update-manager 2023-05-04 19:29:09.884636731 -0400 -@@ -79,7 +79,7 @@ - default="/usr/share/update-manager/", - help=_("Directory that contains the data files")) - parser.add_option ("-c", "--check-dist-upgrades", action="store_true", -- dest="check_dist_upgrades", default=False, -+ dest="check_dist_upgrades", default=True, - help=_("Check if a new Ubuntu release is available")) - parser.add_option ("-d", "--devel-release", action="store_true", - dest="devel_release", default=False, - -diff -ru source.orig/update-manager source/update-manager ---- source.orig/update-manager 2023-04-30 19:59:16.611564826 -0400 -+++ source/update-manager 2023-04-30 20:10:25.515512178 -0400 -@@ -92,6 +92,9 @@ - parser.add_option ("--no-update", action="store_true", - dest="no_update", default=False, - help=_("Do not check for updates when starting")) -+ parser.add_option ("--no-check-screen", action="store_true", -+ dest="no_check_screen", default=False, -+ help=_("Don't show screen preventing unwanted connections to the Internet")) - parser.add_option ("", "--debug", action="store_true", default=False, - help=_("Show debug messages")) - -diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateManager.py ---- source.orig/UpdateManager/UpdateManager.py 2023-05-01 10:29:34.494164650 -0400 -+++ source/UpdateManager/UpdateManager.py 2023-05-01 12:04:53.000000000 -0400 -@@ -121,10 +121,11 @@ - "focus-in-event", self.on_initial_focus_in) - - # Look for a new release in a thread -- self.meta_release = MetaRelease( -- self.options and self.options.devel_release, -- self.options and self.options.use_proposed, -- self.options and self.options.debug) -+ if self.options.check_dist_upgrades and apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") != 0: -+ self.meta_release = MetaRelease( -+ self.options and self.options.devel_release, -+ self.options and self.options.use_proposed, -+ self.options and self.options.debug) - - def begin_user_resizable(self, stored_width=0, stored_height=0): - self.set_resizable(True) -@@ -234,6 +235,11 @@ +@@ -231,6 +232,11 @@ class UpdateManager(Gtk.Window): self.start_available() return @@ -109,3 +87,25 @@ diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateM update_backend = get_backend(self, InstallBackend.ACTION_UPDATE) self._start_pane(update_backend) +diff -ru a/update-manager b/update-manager +--- a/update-manager 2023-05-04 19:26:47.710184166 -0400 ++++ b/update-manager 2023-05-04 19:29:09.884636731 -0400 +@@ -79,7 +79,7 @@ + default="/usr/share/update-manager/", + help=_("Directory that contains the data files")) + parser.add_option ("-c", "--check-dist-upgrades", action="store_true", +- dest="check_dist_upgrades", default=False, ++ dest="check_dist_upgrades", default=True, + help=_("Check if a new Ubuntu release is available")) + parser.add_option ("-d", "--devel-release", action="store_true", + dest="devel_release", default=False, +@@ -92,6 +92,9 @@ + parser.add_option ("--no-update", action="store_true", + dest="no_update", default=False, + help=_("Do not check for updates when starting")) ++ parser.add_option ("--no-check-screen", action="store_true", ++ dest="no_check_screen", default=False, ++ help=_("Don't show screen preventing unwanted connections to the Internet")) + parser.add_option ("", "--debug", action="store_true", default=False, + help=_("Show debug messages")) + diff --git a/helpers/DATA/update-manager/remove-livepatch2.patch b/helpers/DATA/update-manager/remove-livepatch2.patch index 3eec2bb..16aa4af 100644 --- a/helpers/DATA/update-manager/remove-livepatch2.patch +++ b/helpers/DATA/update-manager/remove-livepatch2.patch @@ -1,16 +1,24 @@ diff --git a/UpdateManager/Dialogs.py b/UpdateManager/Dialogs.py -index a33f9c0..5a9e36c 100644 +index dd5d0b01..73e69b8e 100644 --- a/UpdateManager/Dialogs.py +++ b/UpdateManager/Dialogs.py -@@ -38,7 +38,6 @@ import distro_info +@@ -35,15 +35,10 @@ warnings.filterwarnings( + import logging + import datetime + import dbus +-import distro_info import os import HweSupportStatus.consts -from .Core.LivePatchSocket import LivePatchSocket - from .Core.utils import get_dist - +-from .Core.utils import get_dist +- from gettext import gettext as _ -@@ -148,62 +147,6 @@ class InternalDialog(BuilderDialog): +-from gettext import ngettext + + + class Dialog(object): +@@ -149,69 +149,6 @@ class InternalDialog(BuilderDialog): self.main_container.add(content_widget) self.main_container.set_visible(bool(content_widget)) @@ -23,12 +31,18 @@ index a33f9c0..5a9e36c 100644 - self.set_desc(None) - - if not active: -- if self._is_livepatch_supported() and \ -- self.settings_button and \ -- self.settings.get_int('launch-count') >= 4: -- self.set_desc(_("Tip: You can use Livepatch with " -- "Ubuntu Pro to keep your computer more " -- "secure between restarts.")) +- if ( +- self._is_livepatch_supported() +- and self.settings_button +- and self.settings.get_int("launch-count") >= 4 +- ): +- self.set_desc( +- _( +- "Tip: You can use Livepatch with " +- "Ubuntu Pro to keep your computer more " +- "secure between restarts." +- ) +- ) - self.settings_button.set_label(_("Settings & Pro…")) - return - @@ -43,19 +57,21 @@ index a33f9c0..5a9e36c 100644 - needs_reschedule = True - elif ps == "applied": - fixes = [fix for fix in fixes if fix.patched] -- d = ngettext("%d Livepatch update applied since the last " -- "restart.", -- "%d Livepatch updates applied since the last " -- "restart.", -- len(fixes)) % len(fixes) +- d = ngettext( +- "%d Livepatch update applied since the last restart.", +- "%d Livepatch updates applied since the last restart.", +- len(fixes), +- ) % len(fixes) - self.set_desc(d) - elif ps == "applied-with-bug" or ps == "apply-failed": - fixes = [fix for fix in fixes if fix.patched] -- d = ngettext("%d Livepatch update failed to apply since the " -- "last restart.", -- "%d Livepatch updates failed to apply since the " -- "last restart.", -- len(fixes)) % len(fixes) +- d = ngettext( +- "%d Livepatch update failed to apply since the " +- "last restart.", +- "%d Livepatch updates failed to apply since the " +- "last restart.", +- len(fixes), +- ) % len(fixes) - self.set_desc(d) - elif ps == "nothing-to-apply": - pass @@ -69,14 +85,13 @@ index a33f9c0..5a9e36c 100644 - self.lp_socket = LivePatchSocket() - self.lp_socket.get_status(self.on_livepatch_status_ready) - -- + class StoppedUpdatesDialog(InternalDialog): - def __init__(self, window_main): - InternalDialog.__init__(self, window_main) -@@ -227,7 +170,6 @@ class NoUpdatesDialog(InternalDialog): - self.settings_button = self.add_settings_button() - self.focus_button = self.add_button(Gtk.STOCK_OK, - self.window_main.close) + def __init__(self, window_main): +@@ -255,7 +192,6 @@ class NoUpdatesDialog(InternalDialog): + self.focus_button = self.add_button( + Gtk.STOCK_OK, self.window_main.close + ) - self.check_livepatch_status() diff --git a/helpers/DATA/update-manager/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch b/helpers/DATA/update-manager/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch deleted file mode 100644 index 2c7fc76..0000000 --- a/helpers/DATA/update-manager/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 79b3c51dac13c1b2689d139bb0667fa27e8a02a9 Mon Sep 17 00:00:00 2001 -From: Nathan Pratta Teodosio -Date: Fri, 22 Mar 2024 08:24:04 +0100 -Subject: 1:22.04.20 (patches unapplied) - -# Changelog portion removed to avoid version conflict --ark74 - -Imported using git-ubuntu import. ---- - UpdateManager/UpdateManager.py | 60 ++++++++++++++++++++++-------------------- - debian/changelog | 10 +++++++ - 2 files changed, 41 insertions(+), 29 deletions(-) - -diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py -index 5882e0a0..03b11aa3 100644 ---- a/UpdateManager/UpdateManager.py -+++ b/UpdateManager/UpdateManager.py -@@ -27,6 +27,7 @@ from gi.repository import Gdk, GdkX11 - from gi.repository import Gio - from gi.repository import GLib - from gi.repository import GObject -+import uaclient.api.u.pro.packages.updates.v1 as ua - - GdkX11 # pyflakes - -@@ -36,11 +37,11 @@ warnings.filterwarnings("ignore", "Accessed deprecated property", - - import distro_info - import fnmatch --import json - import os - import subprocess - import sys - import time -+import threading - from gettext import gettext as _ - - import dbus -@@ -270,36 +271,37 @@ class UpdateManager(Gtk.Window): - and pkg.installed: - self.oem_metapackages.add(pkg) - -+ def _fetch_ua_updates(self): -+ self.ua_updates = ua.updates().updates -+ - def _get_ua_security_status(self): - self.ua_security_packages = [] -- try: -- p = subprocess.Popen(['pro', 'security-status', '--format=json'], -- stdout=subprocess.PIPE) -- except OSError: -- pass -- else: -- while p.poll() is None: -- while Gtk.events_pending(): -- Gtk.main_iteration() -- time.sleep(0.05) -- s = json.load(p.stdout) -- for package in s.get('packages', []): -- if package.get('service_name', '') == 'standard-security': -- continue -- status = package.get('status', '') -- if ( -- status == 'pending_attach' -- or status == 'pending_enable' -- or status == 'upgrade_available' -- ): -- name = package.get('package', '') -- version = package.get('version', '') -- size = package.get('download_size', 0) -- downloadable = status == 'upgrade_available' -- self.ua_security_packages.append( -- (name, version, size, downloadable) -- ) -- self.cache.create_pro_cache(self.ua_security_packages) -+ t = threading.Thread(target=self._fetch_ua_updates, daemon=True) -+ t.start() -+ while t.is_alive(): -+ while Gtk.events_pending(): -+ Gtk.main_iteration() -+ time.sleep(0.05) -+ for package in self.ua_updates: -+ if ( -+ package.provided_by == 'standard-security' -+ or package.provided_by == 'standard-updates' -+ ): -+ continue -+ status = package.status -+ if ( -+ status == 'pending_attach' -+ or status == 'pending_enable' -+ or status == 'upgrade_available' -+ ): -+ name = package.package -+ version = package.version -+ size = package.download_size -+ downloadable = status == 'upgrade_available' -+ self.ua_security_packages.append( -+ (name, version, size, downloadable) -+ ) -+ self.cache.create_pro_cache(self.ua_security_packages) - - def _make_available_pane(self, install_count, need_reboot=False, - cancelled_update=False, error_occurred=False): --- -cgit v1.2.3 - diff --git a/helpers/DATA/update-manager/rm_pro.packages.updates_from_u-m.patch b/helpers/DATA/update-manager/rm_pro.packages.updates_from_u-m.patch new file mode 100644 index 0000000..0840eb3 --- /dev/null +++ b/helpers/DATA/update-manager/rm_pro.packages.updates_from_u-m.patch @@ -0,0 +1,143 @@ +diff --git a/UpdateManager/UpdateManager.py b/UpdateManager.py +index 3b9eaa58..d44040d5 100644 +--- a/UpdateManager/UpdateManager.py ++++ b/UpdateManager.py +@@ -25,7 +25,6 @@ from gi.repository import Gdk, GdkX11 + from gi.repository import Gio + from gi.repository import GLib + from gi.repository import GObject +-import uaclient.api.u.pro.packages.updates.v1 as ua + + GdkX11 # pyflakes + +@@ -40,7 +39,6 @@ import fnmatch + import os + import subprocess + import sys +-import threading + import time + from gettext import gettext as _ + +@@ -90,7 +88,6 @@ class UpdateManager(Gtk.Window): + self.unity = UnitySupport() + self.controller = None + self.cache = None +- self.ua_security_packages = [] + self.update_list = None + self.meta_release = None + self.hwe_replacement_packages = None +@@ -294,38 +291,6 @@ class UpdateManager(Gtk.Window): + if fnmatch.fnmatch(pkg.name, "oem-*-meta") and pkg.installed: + self.oem_metapackages.add(pkg) + +- def _fetch_ua_updates(self): +- self.ua_updates = ua.updates().updates +- +- def _get_ua_security_status(self): +- self.ua_security_packages = [] +- t = threading.Thread(target=self._fetch_ua_updates, daemon=True) +- t.start() +- while t.is_alive(): +- while Gtk.events_pending(): +- Gtk.main_iteration() +- time.sleep(0.05) +- for package in self.ua_updates: +- if ( +- package.provided_by == 'standard-security' +- or package.provided_by == 'standard-updates' +- ): +- continue +- status = package.status +- if ( +- status == 'pending_attach' +- or status == 'pending_enable' +- or status == 'upgrade_available' +- ): +- name = package.package +- version = package.version +- size = package.download_size +- downloadable = status == 'upgrade_available' +- self.ua_security_packages.append( +- (name, version, size, downloadable) +- ) +- self.cache.create_pro_cache(self.ua_security_packages) +- + def _make_available_pane( + self, + install_count, +@@ -495,8 +460,6 @@ class UpdateManager(Gtk.Window): + + self._check_oem_metapackages() + +- self._get_ua_security_status() +- + for pkgname in self.oem_metapackages: + try: + if not self.cache[pkgname].is_installed: +@@ -510,7 +473,6 @@ class UpdateManager(Gtk.Window): + self.cache, + eventloop_callback=iterate, + duplicate_packages=self.duplicate_packages, +- ua_security_packages=self.ua_security_packages, + ) + except SystemError as e: + header = _("Could not calculate the upgrade") +diff --git a/UpdateManager/Core/MyCache.py b/UpdateManager/Core/MyCache.py_ +index 3e61b840..dfbacbb1 100644 +--- a/UpdateManager/Core/MyCache.py ++++ b/UpdateManager/Core/MyCache.py +@@ -468,54 +468,3 @@ class MyCache(DistUpgrade.DistUpgradeCache.MyCache): + "Please check your Internet connection." + ) + self.all_changes[name] += error_message +- +- # If the machine is not attached to Ubuntu Pro, Update Manager advertises +- # the upgrades that would be available if it were attached. +- # As that is unbeknownst to Apt, we need this map to show the correct +- # version of each upgradable-if-pro-subscribed package. +- def create_pro_cache(self, pro_pkgs): +- for (name, version, _a, _a) in pro_pkgs: +- self.pro_versions[name] = version +- +- def get_changelog(self, name): +- "get the changelog file from the changelog location" +- origins = self[name].candidate.origins +- version = self.pro_versions.get(name, self[name].candidate.version) +- self.all_changes[name] = _( +- "Changes for %s versions:\n" +- "Installed version: %s\n" +- "Available version: %s\n\n" +- ) % ( +- name, +- getattr(self[name].installed, "version", None), +- version, +- ) +- if self.CHANGELOG_ORIGIN not in [o.origin for o in origins]: +- self._fetch_changelog_for_third_party_package(name, origins) +- return +- # fixup epoch handling version +- srcpkg = self[name].candidate.source_name +- srcver_epoch = self[name].candidate.source_version.replace(":", "%3A") +- try: +- changelog = self._get_changelog_or_news(name, "changelog") +- if len(changelog) == 0: +- changelog = _( +- "The changelog does not contain any relevant changes.\n\n" +- "Please use http://launchpad.net/ubuntu/+source/" +- "%s/%s/+changelog\n" +- "until the changes become available or try again later." +- ) % (srcpkg, srcver_epoch) +- except HTTPError: +- changelog = _( +- "The list of changes is not available yet.\n\n" +- "Please use http://launchpad.net/ubuntu/+source/" +- "%s/%s/+changelog\n" +- "until the changes become available or try again later." +- ) % (srcpkg, srcver_epoch) +- except (IOError, BadStatusLine, socket.error) as e: +- print("caught exception: ", e) +- changelog = _( +- "Failed to download the list of changes. \n" +- "Please check your Internet connection." +- ) +- self.all_changes[name] += changelog diff --git a/helpers/DATA/update-manager/trisquel-versions.patch b/helpers/DATA/update-manager/trisquel-versions.patch index 7f384f6..3a7c999 100644 --- a/helpers/DATA/update-manager/trisquel-versions.patch +++ b/helpers/DATA/update-manager/trisquel-versions.patch @@ -1,27 +1,31 @@ ---- UpdateManager/Core/utils.py 2015-10-21 04:05:26.461825091 +0200 -+++ UpdateManager/Core/utils.py.new 2015-10-21 04:03:30.461825105 +0200 -@@ -426,7 +426,7 @@ +diff --git a/UpdateManager/Core/utils.py b/UpdateManager/Core/utils.py +index fbabac1a..62171fe1 100644 +--- a/UpdateManager/Core/utils.py ++++ b/UpdateManager/Core/utils.py +@@ -432,7 +432,8 @@ def get_ubuntu_flavor_package(cache=None): # From spec, first if ubuntu-desktop is installed, use that. # Second, grab first installed one from DistUpgrade.cfg. # Lastly, fallback to ubuntu-desktop again. -- meta_pkgs = ['ubuntu-desktop'] -+ meta_pkgs = ['trisquel','trisquel-mini','trisquel-sugar', 'triskel', 'trisquel-gnome'] +- meta_pkgs = ["ubuntu-desktop"] ++ meta_pkgs = ["trisquel", "trisquel-mini", "trisquel-sugar", ++ "triskel", "trisquel-gnome"] try: meta_pkgs.extend(sorted(_load_meta_pkg_list())) -@@ -439,13 +439,13 @@ +@@ -445,13 +445,14 @@ def get_ubuntu_flavor_package(cache=None): cache_pkg = cache[meta_pkg] if meta_pkg in cache else None if cache_pkg and cache_pkg.is_installed: return meta_pkg -- return 'ubuntu-desktop' -+ return 'trisquel' +- return "ubuntu-desktop" ++ return "trisquel" def get_ubuntu_flavor_name(cache=None): - """ try to guess the flavor name based on the running desktop """ + """try to guess the flavor name based on the running desktop""" pkg = get_ubuntu_flavor_package(cache=cache) -- lookup = {'ubuntustudio-desktop': 'Ubuntu Studio'} -+ lookup = {'trisquel-mini': 'Trisquel Mini', 'trisquel-sugar': 'Trisquel Sugar' } +- lookup = {"ubuntustudio-desktop": "Ubuntu Studio"} ++ lookup = {"trisquel-mini": "Trisquel Mini", ++ "trisquel-sugar": "Trisquel Sugar"} if pkg in lookup: return lookup[pkg] - elif pkg.endswith('-desktop'): + elif pkg.endswith("-desktop"): diff --git a/helpers/make-update-manager b/helpers/make-update-manager index 74b3988..a0d2628 100644 --- a/helpers/make-update-manager +++ b/helpers/make-update-manager @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright (C) 2008-2023 Ruben Rodriguez -# Copyright (C) 2023 Luis Guzmán +# Copyright (C) 2024 Luis Guzmán # Copyright (C) 2019 Mason Hock # # This program is free software; you can redistribute it and/or modify @@ -23,14 +23,18 @@ VERSION=23 . ./config +PRE_REVISION=11.0 +PRE_UPSTREAMRELEASE=22.04 + rm UpdateManager/Core/LivePatchSocket.py rm tests/test_livepatch_socket.py + # Important patch make sure to update when necessary. patch --no-backup-if-mismatch -p1 < $DATA/remove-livepatch2.patch -sed -i "/ubuntu-advantage-tools/d" debian/control +sed -i "/ubuntu-pro-client/d" debian/control #Closes #12545 -patch --no-backup-if-mismatch -p0 < $DATA/trisquel-versions.patch +patch --no-backup-if-mismatch -p1 < $DATA/trisquel-versions.patch cp $DATA/index.docbook help/C/index.docbook @@ -38,24 +42,27 @@ cp $DATA/index.docbook help/C/index.docbook patch --no-backup-if-mismatch -p1 < $DATA/prevent-autoconnection.patch # NOTE: prevent-autoconnection.patch l10n is now part of the DATA/l10n/ patches. -# Roll back the usage of uaclient.api.u.pro.packages.updates.v1 -patch --no-backup-if-mismatch -p1 -R < $DATA/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch +# Remove Ubuntu Pro packages updates ; yet another important patch. +patch --no-backup-if-mismatch -p1 < $DATA/rm_pro.packages.updates_from_u-m.patch replace internet Internet . replace Ubuntu Trisquel . replace TrisquelDistroInfo UbuntuDistroInfo . replace "Trisquel-Gettext" "Ubuntu-Gettext" . -sed -i 's/Trisquel 20.04 LTS to Trisquel 22.04 LTS/Trisquel 10.0 LTS to Trisquel 11.0 LTS/' HweSupportStatus/consts.py +sed -i "s|Trisquel $PRE_UPSTREAMRELEASE LTS to Trisquel $UPSTREAMRELEASE LTS|Trisquel $PRE_REVISION LTS to Trisquel $REVISION LTS|" \ + HweSupportStatus/consts.py replace kubuntu-desktop triskel . replace xubuntu-desktop trisquel-mini . replace edubuntu-desktop toast . replace ubuntu-desktop trisquel . +# Remove upstream name flavor and python translation module sed '/%s base/ s/name.*/name = "Trisquel base"/' -i ./UpdateManager/Core/UpdateList.py +sed -i '/from gettext import gettext as _/d' ./UpdateManager/Core/UpdateList.py + sed 's_https://changelogs.ubuntu.com/changelogs/pool/_https://packages.trisquel.org/changelogs/pool/_' -i UpdateManager/Core/MyCache.py -sed '/len(changelog) == 0/,/"later."/d' -i UpdateManager/Core/MyCache.py #Make sure apt_pkg is enabled for prevent-autoconnection.patch to work. [ -z "$(grep 'import apt_pkg' UpdateManager/UpdateManager.py)" ] && \ @@ -80,6 +87,10 @@ do patch --no-backup-if-mismatch -Np1 < $patch done +# Add global pycodestyle patch +echo "> Apply 99_pycodestyle_pass.patch" +patch --no-backup-if-mismatch -p1 < $DATA/extra/99_pycodestyle_pass.patch + changelog "Compiled for Trisquel" package