update-manager: rollback uaclient.api.u.pro usage
This commit is contained in:
parent
56bf7aedfd
commit
76393fb349
2 changed files with 111 additions and 1 deletions
|
|
@ -0,0 +1,107 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
VERSION=21
|
VERSION=22
|
||||||
|
|
||||||
. ./config
|
. ./config
|
||||||
|
|
||||||
|
|
@ -38,6 +38,9 @@ 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
|
||||||
|
patch --no-backup-if-mismatch -p1 -R < $DATA/rm-usage_uaclient.api.u.pro.packages.updates.v1.patch
|
||||||
|
|
||||||
replace internet Internet .
|
replace internet Internet .
|
||||||
replace Ubuntu Trisquel .
|
replace Ubuntu Trisquel .
|
||||||
replace TrisquelDistroInfo UbuntuDistroInfo .
|
replace TrisquelDistroInfo UbuntuDistroInfo .
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue