Merge lp:~sil2100/ubuntu-release-upgrader/package-section-fix into lp:ubuntu-release-upgrader

Proposed by Łukasz Zemczak
Status: Merged
Merged at revision: 3294
Proposed branch: lp:~sil2100/ubuntu-release-upgrader/package-section-fix
Merge into: lp:ubuntu-release-upgrader
Diff against target: 31 lines (+4/-3)
1 file modified
DistUpgrade/DistUpgradeCache.py (+4/-3)
To merge this branch: bzr merge lp:~sil2100/ubuntu-release-upgrader/package-section-fix
Reviewer Review Type Date Requested Status
Julian Andres Klode Approve
Brian Murray Approve
Review via email: mp+373868@code.launchpad.net

Commit message

New python3-apt bindings no longer provide Package.section, so switch to using Package.candidate.section whenever applicable. This fixes broken partial upgrades.

Description of the change

New python3-apt bindings no longer provide Package.section, so switch to using Package.candidate.section whenever applicable. This fixes broken partial upgrades.

I have tested this on eoan by installing a package with lots of dependencies, removing it (leaving many unneeded packages) and additionally downgrading of some other package. Then I ran dist-upgrade.py --partial etc., first on the package as-is (reproducing the failure) and then with the changes applied. Seems to work as expected.

I guess Julian originally mentioned going through the list of versions (via Package.versions) to get the section match, but I think that's not needed here and Package.candidate is more than enough.

To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) :
review: Needs Information
3295. By Łukasz Zemczak

As per Julian's recommendation, check .installed instead.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Thanks Julian! That indeed seems like a much safer bet.

Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for fixing this!

review: Approve
Revision history for this message
Julian Andres Klode (juliank) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DistUpgrade/DistUpgradeCache.py'
2--- DistUpgrade/DistUpgradeCache.py 2019-09-10 15:47:31 +0000
3+++ DistUpgrade/DistUpgradeCache.py 2019-10-09 15:42:09 +0000
4@@ -474,7 +474,8 @@
5 for section in self.config.getlist("Distro", "KeepInstalledSection"):
6 for pkg in self:
7 if (pkg.candidate and pkg.candidate.downloadable
8- and pkg.marked_delete and pkg.section == section):
9+ and pkg.marked_delete
10+ and pkg.candidate.section == section):
11 self._keep_installed(pkg.name, "Distro KeepInstalledSection rule: %s" % section)
12 for key in self.metapkgs:
13 if key in self and (self[key].is_installed or
14@@ -483,7 +484,7 @@
15 for pkg in self:
16 if (pkg.candidate and pkg.candidate.downloadable
17 and pkg.marked_delete and
18- pkg.section == section):
19+ pkg.candidate.section == section):
20 self._keep_installed(pkg.name, "%s KeepInstalledSection rule: %s" % (key, section))
21
22
23@@ -938,7 +939,7 @@
24 return False
25 # ensure we honor KeepInstalledSection here as well
26 for section in self.config.getlist("Distro", "KeepInstalledSection"):
27- if pkgname in self and self[pkgname].section == section:
28+ if pkgname in self and self[pkgname].installed.section == section:
29 logging.debug("skipping '%s' (in KeepInstalledSection)" % pkgname)
30 return False
31 # if we don't have the package anyway, we are fine (this can

Subscribers

People subscribed via source and target branches