update-manager: update patches and helper to meet new python test and style.

This commit is contained in:
Luis Guzmán 2024-05-18 10:32:13 +00:00
parent 98b18f0ac7
commit b2ded520d2
7 changed files with 316 additions and 222 deletions

View file

@ -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.")

View file

@ -1,44 +1,67 @@
diff -ru source.orig/UpdateManager/Dialogs.py source/UpdateManager/Dialogs.py diff --git a/UpdateManager/Dialogs.py b/UpdateManager/Dialogs.py
--- source.orig/UpdateManager/Dialogs.py 2018-02-12 20:44:33.321329066 -0500 index a5d13ad4..89603956 100644
+++ source/UpdateManager/Dialogs.py 2018-02-12 20:45:28.141249480 -0500 --- a/UpdateManager/Dialogs.py
@@ -161,7 +162,21 @@ +++ b/UpdateManager/Dialogs.py
self.add_settings_button() @@ -175,6 +175,23 @@ class NoUpdatesDialog(InternalDialog):
self.focus_button = self.add_button(Gtk.STOCK_OK, Gtk.STOCK_OK, self.window_main.close
self.window_main.close) )
+
+class ShouldUpdateDialog(InternalDialog): +class ShouldUpdateDialog(InternalDialog):
+ def __init__(self, window_main): + def __init__(self, window_main):
+
+ InternalDialog.__init__(self, window_main) + InternalDialog.__init__(self, window_main)
+ self.set_header(_("Include latest updates from the Internet?")) + self.set_header(_("Include latest updates from the Internet?"))
+ self.set_desc(_('''To prevent unwanted connections to the Internet + self.set_desc(_('''To prevent unwanted connections to the Internet
+Trisquel will not automatically check for updates +Trisquel will not automatically check for updates
+unless you say so in the Settings panel.''')) +unless you say so in the Settings panel.'''))
+ self.add_settings_button() + 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) + self.add_button(_("Ask Me Later"), self.window_main.close)
+ +
+ def check(self): + def check(self):
+ self.window_main.options.no_update = False + self.window_main.options.no_update = False
+ self.window_main.check_update() + self.window_main.check_update()
+
class DistUpgradeDialog(InternalDialog): class DistUpgradeDialog(InternalDialog):
def __init__(self, window_main, meta_release): def __init__(self, window_main, meta_release):
diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateManager.py diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
--- source.orig/UpdateManager/UpdateManager.py 2018-02-12 20:44:33.317329071 -0500 index b6cdc8ab..d82db9dd 100644
+++ source/UpdateManager/UpdateManager.py 2018-02-12 20:45:28.133249491 -0500 --- a/UpdateManager/UpdateManager.py
@@ -52,6 +52,7 @@ +++ b/UpdateManager/UpdateManager.py
@@ -56,6 +56,7 @@ from .Dialogs import (
ErrorDialog, ErrorDialog,
HWEUpgradeDialog, HWEUpgradeDialog,
NeedRestartDialog, NeedRestartDialog,
+ ShouldUpdateDialog, + ShouldUpdateDialog,
NoUpdatesDialog, NoUpdatesDialog,
NoUpgradeForYouDialog,
PartialUpgradeDialog, PartialUpgradeDialog,
StoppedUpdatesDialog, @@ -125,11 +126,12 @@ class UpdateManager(Gtk.Window):
@@ -205,6 +206,17 @@ )
# 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() self.start_available()
def start_update(self): 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)) + self._start_pane(ShouldUpdateDialog(self))
+ return + return
+ if self.options.no_update: + if self.options.no_update:
@ -52,52 +75,7 @@ diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateM
if self.options.no_update: if self.options.no_update:
self.start_available() self.start_available()
return return
diff -ru source.orig/update-manager source/update-manager @@ -231,6 +232,11 @@ class UpdateManager(Gtk.Window):
--- 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 @@
self.start_available() self.start_available()
return return
@ -109,3 +87,25 @@ diff -ru source.orig/UpdateManager/UpdateManager.py source/UpdateManager/UpdateM
update_backend = get_backend(self, InstallBackend.ACTION_UPDATE) update_backend = get_backend(self, InstallBackend.ACTION_UPDATE)
self._start_pane(update_backend) 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"))

View file

@ -1,16 +1,24 @@
diff --git a/UpdateManager/Dialogs.py b/UpdateManager/Dialogs.py diff --git a/UpdateManager/Dialogs.py b/UpdateManager/Dialogs.py
index a33f9c0..5a9e36c 100644 index dd5d0b01..73e69b8e 100644
--- a/UpdateManager/Dialogs.py --- a/UpdateManager/Dialogs.py
+++ b/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 os
import HweSupportStatus.consts import HweSupportStatus.consts
-from .Core.LivePatchSocket import LivePatchSocket -from .Core.LivePatchSocket import LivePatchSocket
from .Core.utils import get_dist -from .Core.utils import get_dist
-
from gettext import gettext as _ 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.add(content_widget)
self.main_container.set_visible(bool(content_widget)) self.main_container.set_visible(bool(content_widget))
@ -23,12 +31,18 @@ index a33f9c0..5a9e36c 100644
- self.set_desc(None) - self.set_desc(None)
- -
- if not active: - if not active:
- if self._is_livepatch_supported() and \ - if (
- self.settings_button and \ - self._is_livepatch_supported()
- self.settings.get_int('launch-count') >= 4: - and self.settings_button
- self.set_desc(_("<b>Tip:</b> You can use Livepatch with " - and self.settings.get_int("launch-count") >= 4
- ):
- self.set_desc(
- _(
- "<b>Tip:</b> You can use Livepatch with "
- "Ubuntu Pro to keep your computer more " - "Ubuntu Pro to keep your computer more "
- "secure between restarts.")) - "secure between restarts."
- )
- )
- self.settings_button.set_label(_("Settings & Pro…")) - self.settings_button.set_label(_("Settings & Pro…"))
- return - return
- -
@ -43,19 +57,21 @@ index a33f9c0..5a9e36c 100644
- needs_reschedule = True - needs_reschedule = True
- elif ps == "applied": - elif ps == "applied":
- fixes = [fix for fix in fixes if fix.patched] - fixes = [fix for fix in fixes if fix.patched]
- d = ngettext("%d Livepatch update applied since the last " - d = ngettext(
- "restart.", - "%d Livepatch update applied since the last restart.",
- "%d Livepatch updates applied since the last " - "%d Livepatch updates applied since the last restart.",
- "restart.", - len(fixes),
- len(fixes)) % len(fixes) - ) % len(fixes)
- self.set_desc(d) - self.set_desc(d)
- elif ps == "applied-with-bug" or ps == "apply-failed": - elif ps == "applied-with-bug" or ps == "apply-failed":
- fixes = [fix for fix in fixes if fix.patched] - fixes = [fix for fix in fixes if fix.patched]
- d = ngettext("%d Livepatch update failed to apply since the " - d = ngettext(
- "%d Livepatch update failed to apply since the "
- "last restart.", - "last restart.",
- "%d Livepatch updates failed to apply since the " - "%d Livepatch updates failed to apply since the "
- "last restart.", - "last restart.",
- len(fixes)) % len(fixes) - len(fixes),
- ) % len(fixes)
- self.set_desc(d) - self.set_desc(d)
- elif ps == "nothing-to-apply": - elif ps == "nothing-to-apply":
- pass - pass
@ -69,14 +85,13 @@ index a33f9c0..5a9e36c 100644
- self.lp_socket = LivePatchSocket() - self.lp_socket = LivePatchSocket()
- self.lp_socket.get_status(self.on_livepatch_status_ready) - self.lp_socket.get_status(self.on_livepatch_status_ready)
- -
-
class StoppedUpdatesDialog(InternalDialog): class StoppedUpdatesDialog(InternalDialog):
def __init__(self, window_main): def __init__(self, window_main):
InternalDialog.__init__(self, window_main) @@ -255,7 +192,6 @@ class NoUpdatesDialog(InternalDialog):
@@ -227,7 +170,6 @@ class NoUpdatesDialog(InternalDialog): self.focus_button = self.add_button(
self.settings_button = self.add_settings_button() Gtk.STOCK_OK, self.window_main.close
self.focus_button = self.add_button(Gtk.STOCK_OK, )
self.window_main.close)
- self.check_livepatch_status() - self.check_livepatch_status()

View file

@ -1,107 +0,0 @@
From 79b3c51dac13c1b2689d139bb0667fa27e8a02a9 Mon Sep 17 00:00:00 2001
From: Nathan Pratta Teodosio <nathan.teodosio@canonical.com>
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

View file

@ -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

View file

@ -1,27 +1,31 @@
--- UpdateManager/Core/utils.py 2015-10-21 04:05:26.461825091 +0200 diff --git a/UpdateManager/Core/utils.py b/UpdateManager/Core/utils.py
+++ UpdateManager/Core/utils.py.new 2015-10-21 04:03:30.461825105 +0200 index fbabac1a..62171fe1 100644
@@ -426,7 +426,7 @@ --- 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. # From spec, first if ubuntu-desktop is installed, use that.
# Second, grab first installed one from DistUpgrade.cfg. # Second, grab first installed one from DistUpgrade.cfg.
# Lastly, fallback to ubuntu-desktop again. # Lastly, fallback to ubuntu-desktop again.
- meta_pkgs = ['ubuntu-desktop'] - meta_pkgs = ["ubuntu-desktop"]
+ meta_pkgs = ['trisquel','trisquel-mini','trisquel-sugar', 'triskel', 'trisquel-gnome'] + meta_pkgs = ["trisquel", "trisquel-mini", "trisquel-sugar",
+ "triskel", "trisquel-gnome"]
try: try:
meta_pkgs.extend(sorted(_load_meta_pkg_list())) 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 cache_pkg = cache[meta_pkg] if meta_pkg in cache else None
if cache_pkg and cache_pkg.is_installed: if cache_pkg and cache_pkg.is_installed:
return meta_pkg return meta_pkg
- return 'ubuntu-desktop' - return "ubuntu-desktop"
+ return 'trisquel' + return "trisquel"
def get_ubuntu_flavor_name(cache=None): 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) pkg = get_ubuntu_flavor_package(cache=cache)
- lookup = {'ubuntustudio-desktop': 'Ubuntu Studio'} - lookup = {"ubuntustudio-desktop": "Ubuntu Studio"}
+ lookup = {'trisquel-mini': 'Trisquel Mini', 'trisquel-sugar': 'Trisquel Sugar' } + lookup = {"trisquel-mini": "Trisquel Mini",
+ "trisquel-sugar": "Trisquel Sugar"}
if pkg in lookup: if pkg in lookup:
return lookup[pkg] return lookup[pkg]
elif pkg.endswith('-desktop'): elif pkg.endswith("-desktop"):

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2008-2023 Ruben Rodriguez <ruben@trisquel.info> # Copyright (C) 2008-2023 Ruben Rodriguez <ruben@trisquel.info>
# Copyright (C) 2023 Luis Guzmán <ark@switnet.org> # Copyright (C) 2024 Luis Guzmán <ark@switnet.org>
# Copyright (C) 2019 Mason Hock <mason@masonhock.com> # Copyright (C) 2019 Mason Hock <mason@masonhock.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -23,14 +23,18 @@ VERSION=23
. ./config . ./config
PRE_REVISION=11.0
PRE_UPSTREAMRELEASE=22.04
rm UpdateManager/Core/LivePatchSocket.py rm UpdateManager/Core/LivePatchSocket.py
rm tests/test_livepatch_socket.py rm tests/test_livepatch_socket.py
# Important patch make sure to update when necessary. # Important patch make sure to update when necessary.
patch --no-backup-if-mismatch -p1 < $DATA/remove-livepatch2.patch 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 #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 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 patch --no-backup-if-mismatch -p1 < $DATA/prevent-autoconnection.patch
# NOTE: prevent-autoconnection.patch l10n is now part of the DATA/l10n/ patches. # 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 # Remove Ubuntu Pro packages updates ; yet another important patch.
patch --no-backup-if-mismatch -p1 -R < $DATA/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch patch --no-backup-if-mismatch -p1 < $DATA/rm_pro.packages.updates_from_u-m.patch
replace internet Internet . replace internet Internet .
replace Ubuntu Trisquel . replace Ubuntu Trisquel .
replace TrisquelDistroInfo UbuntuDistroInfo . replace TrisquelDistroInfo UbuntuDistroInfo .
replace "Trisquel-Gettext" "Ubuntu-Gettext" . 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 kubuntu-desktop triskel .
replace xubuntu-desktop trisquel-mini . replace xubuntu-desktop trisquel-mini .
replace edubuntu-desktop toast . replace edubuntu-desktop toast .
replace ubuntu-desktop trisquel . 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 '/%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 '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. #Make sure apt_pkg is enabled for prevent-autoconnection.patch to work.
[ -z "$(grep 'import apt_pkg' UpdateManager/UpdateManager.py)" ] && \ [ -z "$(grep 'import apt_pkg' UpdateManager/UpdateManager.py)" ] && \
@ -80,6 +87,10 @@ do
patch --no-backup-if-mismatch -Np1 < $patch patch --no-backup-if-mismatch -Np1 < $patch
done 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" changelog "Compiled for Trisquel"
package package