Merge ~brian-murray/ubuntu-release-upgrader:python-dbg-fix into ubuntu-release-upgrader:ubuntu/master

Proposed by Brian Murray
Status: Merged
Merged at revision: 1229ab6c7893bfb17609cbab4dcfa1672763c682
Proposed branch: ~brian-murray/ubuntu-release-upgrader:python-dbg-fix
Merge into: ubuntu-release-upgrader:ubuntu/master
Diff against target: 69 lines (+30/-19)
2 files modified
DistUpgrade/DistUpgradeQuirks.py (+23/-19)
debian/changelog (+7/-0)
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Lukas Märdian Pending
Ubuntu Core Development Team Pending
Review via email: mp+388513@code.launchpad.net

Description of the change

The fix for bug 1875523 does not resolve failures to calculate upgrades for people who have python-dbg installed on Ubuntu 18.04 LTS. This was discovered when investigating bug 1887544 and a minimal test case can be created by just installing python-pyqt5-dbg and then trying to upgrade to Ubuntu 20.04 LTS. By replacing python-dbg with python2-dbg the upgrade can proceed.

Here's a portion of the an upgrade I did from 18.04 LTS w/ python-pyqt5-dbg installed to Ubuntu 20.04 LTS.

2020-07-31 09:45:21,140 DEBUG quirks: running PreDistUpgradeCache
2020-07-31 09:45:21,140 DEBUG running Quirks.PreDistUpgradeCache
2020-07-31 09:45:21,140 INFO checking for python-dbg
2020-07-31 09:45:21,140 INFO installing python2-dbg because python-dbg was installed
2020-07-31 09:45:21,140 DEBUG Installing 'python2-dbg' (python-dbg was installed on the system)
2020-07-31 09:45:21,282 INFO removing python-dbg because python2-dbg is being installed
2020-07-31 09:45:21,282 DEBUG Removing 'python-dbg' (python2-dbg is being installed on the system)
2020-07-31 09:45:21,282 INFO failed to remove python-dbg
2020-07-31 09:45:21,283 INFO checking for python-minimal
2020-07-31 09:45:21,283 INFO installing python-is-python2 because python-minimal was installed
2020-07-31 09:45:21,283 DEBUG Installing 'python-is-python2' (python-minimal was installed on the system)
2020-07-31 09:45:21,300 INFO removing python-minimal because python-is-python2 is being installed
2020-07-31 09:45:21,300 DEBUG Removing 'python-minimal' (python-is-python2 is being installed on the system)
2020-07-31 09:45:21,300 INFO failed to remove python-minimal

While the log file says the packages failed to remove (which I just noticed) they did end up being removed.

2020-07-31 09:45:26,664 DEBUG Remove: fwupdate-signed gnome-settings-daemon-schemas libapt-inst2.0 libapt-pkg5.0 libcupscgi1 libcupsmime1 libcupsppdc1 libebook-1.2-19 libedata-book-1.2-25 libedata-cal-1.2-28 libfwup1 libldb1 libpolkit-backend-1-0 libpython-dbg libpython-stdlib libsensors4 libsnmp30 python python-dbg python-minimal python-pyqt5 python-pyqt5-dbg python-pyqt5.qtopengl python-pyqt5.qtopengl-dbg python-pyqt5.qtsensors python-pyqt5.qtsensors-dbg python-pyqt5.qtwebchannel uno-libs3

So I think this change is okay but I'd appreciate a second opinion.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

python-dev => python2-dev
libpython-dev => libpython2-dev
libpython-stdlib => libpython2-stdlib
python-doc => python2-doc
libpython-dbg => libpython2-dbg

will probably need transitions too. However, i'm not sure if we should be explicitely installing the new ones, or like allow for them to be pullsed in via dependencies.

Revision history for this message
Lukas Märdian (slyon) wrote :

I can confirm this resolves the minimal test case described. I've added two smaller comments inline.

Should we hard-code all those transition xnox described in the upgrader, or should src:what-is-python provide proper upgrade paths for those packages? There is python-dev-is-python2 already: https://packages.ubuntu.com/focal/python-dev-is-python2

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

Bug 1891381 is another failure to calculate the upgrade with python-qt4-dev installed.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

replacements should be extended to replate:
python-doc with python2-doc
python-dbg with python2-dbg

however, the following ones should have no replacement, and simply removed:
python-dev
libpython-dev
libpython-stdlib
libpython-dbg

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
2index c414424..144335e 100644
3--- a/DistUpgrade/DistUpgradeQuirks.py
4+++ b/DistUpgrade/DistUpgradeQuirks.py
5@@ -848,26 +848,30 @@ class DistUpgradeQuirks(object):
6 other package and the python-is-python2 package is installed instead,
7 if python-minimal was installed.
8 """
9- old = 'python-minimal'
10- new = 'python-is-python2'
11+ # python-dbg must come first for reasons unknown
12+ replacements = [('python-dbg','python2-dbg'),
13+ ('python-minimal', 'python-is-python2')]
14 cache = self.controller.cache
15- if old in cache and cache[old].is_installed:
16- logging.info("installing %s because %s was installed" % (new, old))
17- reason = "%s was installed on the system" % old
18- if not cache.mark_install(new, reason):
19- logging.info("failed to install %s" % new)
20- logging.info("removing %s because %s is being installed" %
21- (old, new))
22- reason = "%s is being installed on the system" % new
23- if not cache.mark_remove(old, reason):
24- logging.info("failed to remove %s", old)
25-
26- # protect our decision to remove legacy 'python' (as a dependency
27- # of python-minimal, removed above)
28- py = 'python'
29- if py in cache and cache[py].marked_delete:
30- resolver = apt.cache.ProblemResolver(cache)
31- resolver.protect(cache[py])
32+ for old, new in replacements:
33+ logging.info("checking for %s" % old)
34+ if old in cache and cache[old].is_installed:
35+ logging.info("installing %s because %s was installed" %
36+ (new, old))
37+ reason = "%s was installed on the system" % old
38+ if not cache.mark_install(new, reason):
39+ logging.info("failed to install %s" % new)
40+ logging.info("removing %s because %s is being installed" %
41+ (old, new))
42+ reason = "%s is being installed on the system" % new
43+ if not cache.mark_remove(old, reason):
44+ logging.info("failed to remove %s", old)
45+
46+ # protect our decision to remove legacy 'python' (as a
47+ # dependency of python-minimal, removed above)
48+ py = 'python'
49+ if py in cache and cache[py].marked_delete:
50+ resolver = apt.cache.ProblemResolver(cache)
51+ resolver.protect(cache[py])
52
53 def ensure_recommends_are_installed_on_desktops(self):
54 """ ensure that on a desktop install recommends are installed
55diff --git a/debian/changelog b/debian/changelog
56index f548e84..3d4b40d 100644
57--- a/debian/changelog
58+++ b/debian/changelog
59@@ -1,3 +1,10 @@
60+ubuntu-release-upgrader (1:20.10.9) UNRELEASED; urgency=medium
61+
62+ * DistUpgrade/DistUpgradeQuirks.py: In addition to quirking python-minimal
63+ we also need to quirk python-dbg. (LP: #1887544)
64+
65+ -- Brian Murray <brian@ubuntu.com> Fri, 31 Jul 2020 12:55:41 -0700
66+
67 ubuntu-release-upgrader (1:20.10.8) groovy; urgency=medium
68
69 * DistUpgrade/DistUpgradeCache.py: Ensure that the linux metapackage is

Subscribers

People subscribed via source and target branches