Merge lp:~juliank/ubuntu-release-upgrader/upgrade-libc-first into lp:ubuntu-release-upgrader

Proposed by Julian Andres Klode
Status: Merged
Approved by: Steve Langasek
Approved revision: 3159
Merged at revision: 3158
Proposed branch: lp:~juliank/ubuntu-release-upgrader/upgrade-libc-first
Merge into: lp:ubuntu-release-upgrader
Diff against target: 89 lines (+57/-1)
1 file modified
DistUpgrade/DistUpgradeController.py (+57/-1)
To merge this branch: bzr merge lp:~juliank/ubuntu-release-upgrader/upgrade-libc-first
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+352553@code.launchpad.net

Description of the change

Upgrade libc6 first. Needs some testing

To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

Seems to work for the gnome-menus bug.

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

Not sure how the progress reporting looks on the GUIs, it's probably a bit confusing.

Revision history for this message
Steve Langasek (vorlon) :
review: Needs Fixing
3157. By Julian Andres Klode

Correctly abort if simulation failed

3158. By Julian Andres Klode

Do not _inhibitIdle() twice

3159. By Julian Andres Klode

askDistUpgrade: Return False if there are no changes

calcDistUpgrade returns False when we have no changes to perform, and
we need to abort in that case.

Revision history for this message
Steve Langasek (vorlon) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DistUpgrade/DistUpgradeController.py'
2--- DistUpgrade/DistUpgradeController.py 2018-08-01 18:58:08 +0000
3+++ DistUpgrade/DistUpgradeController.py 2018-08-07 16:21:14 +0000
4@@ -1073,7 +1073,7 @@
5 return True
6
7
8- def askDistUpgrade(self):
9+ def calcDistUpgrade(self):
10 self._view.updateStatus(_("Calculating the changes"))
11 if not self.cache.distUpgrade(self._view, self.serverMode, self._partialUpgrade):
12 return False
13@@ -1109,6 +1109,13 @@
14
15 # flush UI
16 self._view.processEvents()
17+ return changes
18+
19+ def askDistUpgrade(self):
20+ changes = self.calcDistUpgrade()
21+
22+ if not changes:
23+ return False
24
25 # ask the user
26 res = self._view.confirmChanges(_("Do you want to start the upgrade?"),
27@@ -1226,6 +1233,22 @@
28 res = apt_btrfs.create_btrfs_root_snapshot(prefix)
29 logging.info("creating snapshot '%s' (success=%s)" % (prefix, res))
30
31+ def doDistUpgradeSimulation(self):
32+ backups = {}
33+ backups["dir::bin::dpkg"] = [apt_pkg.config["dir::bin::dpkg"]]
34+ apt_pkg.config["dir::bin::dpkg"] = "/bin/true"
35+
36+ for lst in "dpkg::pre-invoke", "dpkg::pre-install-pkgs", "dpkg::post-invoke", "dpkg::post-install-pkgs":
37+ backups[lst + "::"] = apt_pkg.config.value_list(lst)
38+ apt_pkg.config.clear(lst)
39+
40+ try:
41+ return self.doDistUpgrade()
42+ finally:
43+ for lst in backups:
44+ for item in backups[lst]:
45+ apt_pkg.config.set(lst, item)
46+
47 def doDistUpgrade(self):
48 # add debug code only here
49 #apt_pkg.config.set("Debug::pkgDpkgPM", "1")
50@@ -1921,6 +1944,39 @@
51 self._enableAptCronJob()
52 self.abort()
53
54+ # simulate an upgrade
55+ self._view.setStep(Step.INSTALL)
56+ self._view.updateStatus(_("Upgrading"))
57+ if not self.doDistUpgradeSimulation():
58+ self._view.error(_("Upgrade infeasible"),
59+ _("The upgrade could not be completed, there "
60+ "were errors during the upgrade "
61+ "process."))
62+ self.abort()
63+
64+ # Just upgrade libc6 first
65+ self.cache.clear()
66+ self.cache["libc6"].mark_install()
67+ self._view.setStep(Step.INSTALL)
68+ self._view.updateStatus(_("Upgrading"))
69+ if not self.doDistUpgrade():
70+ # don't abort here, because it would restore the sources.list
71+ self._view.information(_("Upgrade incomplete"),
72+ _("The upgrade has partially completed but there "
73+ "were errors during the upgrade "
74+ "process."))
75+ # do not abort because we are part of the way through the process
76+ sys.exit(1)
77+
78+ # Reopen ask above
79+ self.openCache(restore_sources_list_on_fail=True)
80+ self.serverMode = self.cache.need_server_mode()
81+ self.quirks.ensure_recommends_are_installed_on_desktops()
82+
83+ self._view.updateStatus(_("Calculating the changes"))
84+ if not self.calcDistUpgrade():
85+ self.abort()
86+
87 # now do the upgrade
88 self._view.setStep(Step.INSTALL)
89 self._view.updateStatus(_("Upgrading"))

Subscribers

People subscribed via source and target branches