update-manager: update patches and helper to meet new python test and style.
This commit is contained in:
parent
98b18f0ac7
commit
b2ded520d2
7 changed files with 316 additions and 222 deletions
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue