Merge ~nteodosio/update-manager:jammy-ua into update-manager:ubuntu/jammy

Proposed by Nathan Teodosio
Status: Merged
Merged at revision: b57402403bac6714e8c0d341b7fb8b81ba3b9145
Proposed branch: ~nteodosio/update-manager:jammy-ua
Merge into: update-manager:ubuntu/jammy
Diff against target: 65 lines (+20/-2)
3 files modified
UpdateManager/Core/MyCache.py (+11/-2)
UpdateManager/UpdateManager.py (+1/-0)
debian/changelog (+8/-0)
Reviewer Review Type Date Requested Status
Sebastien Bacher Pending
Review via email: mp+455891@code.launchpad.net

Description of the change

Fix incorrect available version for Ubuntu Pro updates in unattached case.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

in fact there was an extra line in the changelog with a timestamp, I fixed that and force pushed now

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/UpdateManager/Core/MyCache.py b/UpdateManager/Core/MyCache.py
2index e86c9b3..7639429 100644
3--- a/UpdateManager/Core/MyCache.py
4+++ b/UpdateManager/Core/MyCache.py
5@@ -81,6 +81,7 @@ class MyCache(DistUpgrade.DistUpgradeCache.MyCache):
6 self._initDepCache()
7 self.all_changes = {}
8 self.all_news = {}
9+ self.pro_versions = {}
10 # on broken packages, try to fix via saveDistUpgrade()
11 if self._depcache.broken_count > 0:
12 self.saveDistUpgrade()
13@@ -424,14 +425,22 @@ class MyCache(DistUpgrade.DistUpgradeCache.MyCache):
14 "Please check your Internet connection.")
15 self.all_changes[name] += error_message
16
17+ # If the machine is not attached to Ubuntu Pro, Update Manager advertises
18+ # the upgrades that would be available if it were attached.
19+ # As that is unbeknownst to Apt, we need this map to show the correct
20+ # version of each upgradable-if-pro-subscribed package.
21+ def create_pro_cache(self, pro_pkgs):
22+ for (name, version, _, _) in pro_pkgs:
23+ self.pro_versions[name] = version
24+
25 def get_changelog(self, name):
26 " get the changelog file from the changelog location "
27 origins = self[name].candidate.origins
28+ version = self.pro_versions.get(name, self[name].candidate.version)
29 self.all_changes[name] = _("Changes for %s versions:\n"
30 "Installed version: %s\n"
31 "Available version: %s\n\n") % \
32- (name, getattr(self[name].installed, "version", None),
33- self[name].candidate.version)
34+ (name, getattr(self[name].installed, "version", None), version)
35 if self.CHANGELOG_ORIGIN not in [o.origin for o in origins]:
36 self._fetch_changelog_for_third_party_package(name, origins)
37 return
38diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
39index 2b0af65..aecabcf 100644
40--- a/UpdateManager/UpdateManager.py
41+++ b/UpdateManager/UpdateManager.py
42@@ -299,6 +299,7 @@ class UpdateManager(Gtk.Window):
43 self.ua_security_packages.append(
44 (name, version, size, downloadable)
45 )
46+ self.cache.create_pro_cache(self.ua_security_packages)
47
48 def _make_available_pane(self, install_count, need_reboot=False,
49 cancelled_update=False, error_occurred=False):
50diff --git a/debian/changelog b/debian/changelog
51index dc1c9e8..ae45c95 100644
52--- a/debian/changelog
53+++ b/debian/changelog
54@@ -1,3 +1,11 @@
55+update-manager (1:22.04.17) jammy; urgency=medium
56+
57+ * Fix incorrect available version for Ubuntu Pro updates in unattached case
58+ (LP: #2043425).
59+
60+ -- Nathan Pratta Teodosio <nathan.teodosio@canonical.com> Thu, 16 Nov 2023 10:07:06 +0100
61+ +0100
62+
63 update-manager (1:22.04.16) jammy; urgency=medium
64
65 * Ubuntu Pro (LP: #1990450):

Subscribers

People subscribed via source and target branches