Merge lp:~brian-murray/ubuntu-release-upgrader/deb-to-snap into lp:ubuntu-release-upgrader

Proposed by Brian Murray
Status: Merged
Merged at revision: 3144
Proposed branch: lp:~brian-murray/ubuntu-release-upgrader/deb-to-snap
Merge into: lp:ubuntu-release-upgrader
Diff against target: 101 lines (+76/-0)
1 file modified
DistUpgrade/DistUpgradeQuirks.py (+76/-0)
To merge this branch: bzr merge lp:~brian-murray/ubuntu-release-upgrader/deb-to-snap
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+348916@code.launchpad.net
To post a comment you must log in.
3142. By Brian Murray

fix merge conflict

3143. By Brian Murray

really fix merge conflict

Revision history for this message
Steve Langasek (vorlon) :
review: Needs Fixing
3144. By Brian Murray

DistUpgradeQuirks.py: adjust language based on reviewer feedback, raise a dialog instead of aborting the upgrade

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

I've made most of the changes suggested.

Revision history for this message
Steve Langasek (vorlon) wrote :

The changes all look good; I think we still need to sort out the timeout on the snap downloads before pushing this through.

Revision history for this message
Steve Langasek (vorlon) wrote :

FWIW I think it would be nicer if the prompt offered to "retry" the failed snap store check, rather than being just a yes/no dialog; but I don't think that should block this MP.

3145. By Brian Murray

DistUpgradeQuirks.py: wait for the snap install to complete rather than using a timeout

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

On Thu, Jul 05, 2018 at 07:24:45PM -0000, Steve Langasek wrote:
> The changes all look good; I think we still need to sort out the timeout on the snap downloads before pushing this through.

That's sorted with my latest change.

--
Brian Murray

3146. By Brian Murray

DistUpgradeQuirks.py: modify the quirks for cosmic

Revision history for this message
Steve Langasek (vorlon) :
review: Approve
3147. By Brian Murray

clarify docstring

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'DistUpgrade/DistUpgradeController.py'
=== modified file 'DistUpgrade/DistUpgradeQuirks.py'
--- DistUpgrade/DistUpgradeQuirks.py 2018-07-05 23:22:00 +0000
+++ DistUpgrade/DistUpgradeQuirks.py 2018-07-06 18:05:00 +0000
@@ -122,6 +122,19 @@
122 """ run before the apt cache is opened the first time """122 """ run before the apt cache is opened the first time """
123 logging.debug("running Quirks.PreCacheOpen")123 logging.debug("running Quirks.PreCacheOpen")
124124
125 # individual quirks handler that run *after* the cache is opened
126 def cosmicPostInitialUpdate(self):
127 #PreCacheOpen would be better but controller.abort fails terribly
128 """ run after the apt cache is opened the first time """
129 logging.debug("running Quirks.cosmicPostInitialUpdate")
130 if self.controller.cache['ubuntu-desktop'].is_installed:
131 self._checkStoreConnectivity()
132
133 def cosmicPostUpgrade(self):
134 logging.debug("running Quirks.cosmicPostUpgrade")
135 if self.controller.cache['ubuntu-desktop'].is_installed:
136 self._replaceDebsWithSnaps()
137
125 # individual quirks handler when the dpkg run is finished ---------138 # individual quirks handler when the dpkg run is finished ---------
126 def PostCleanup(self):139 def PostCleanup(self):
127 " run after cleanup "140 " run after cleanup "
@@ -129,6 +142,7 @@
129142
130 # run right before the first packages get installed143 # run right before the first packages get installed
131 def StartUpgrade(self):144 def StartUpgrade(self):
145 logging.debug("running Quirks.StartUpgrade")
132 self._applyPatches()146 self._applyPatches()
133 self._removeOldApportCrashes()147 self._removeOldApportCrashes()
134 self._killUpdateNotifier()148 self._killUpdateNotifier()
@@ -416,6 +430,68 @@
416 except Exception as e:430 except Exception as e:
417 logging.warning("error during unlink of old crash files (%s)" % e)431 logging.warning("error during unlink of old crash files (%s)" % e)
418432
433 def _checkStoreConnectivity(self):
434 """ check for connectivity to the snap store to install snaps"""
435 msg = ""
436 summary = ""
437 connected = Popen(["snap", "debug", "connectivity"], stdout=PIPE,
438 stderr=PIPE, universal_newlines=True).communicate()
439 if re.search("^ \* PASS", connected[0], re.MULTILINE):
440 return
441 # can't connect
442 elif re.search("^ \*.*unreachable", connected[0], re.MULTILINE):
443 logging.error("No snap store connectivity")
444 res = self._view.askYesNoQuestion(
445 _("Connection to Snap Store failed"),
446 _("Your system does not have a connection to the Snap "
447 "Store. For the best upgrade experience make sure "
448 "that your system can connect to api.snapcraft.io.\n"
449 "Do you still want to continue with the upgrade?")
450 )
451 # debug command not available
452 elif 'error: unknown command' in connected[1]:
453 logging.error("snap debug command not available")
454 res = self._view.askYesNoQuestion(
455 _("Outdated snapd package"),
456 _("Your system does not have the latest version of snapd. "
457 "Please update the version of snapd on your system to "
458 "improve the upgrade experience.\n"
459 "Do you still want to continue with the upgrade?")
460 )
461 # not running as root
462 elif 'error: access denied' in connected[1]:
463 res = False
464 logging.error("Not running as root!")
465 if not res:
466 self.controller.abort()
467
468 def _replaceDebsWithSnaps(self):
469 """ install a snap and mark its corresponding package for removal """
470 # gtk-common-themes isn't a package name but is this risky?
471 snaps = ['gtk-common-themes', 'gnome-calculator', 'gnome-characters',
472 'gnome-logs', 'gnome-system-monitor']
473 installed_snaps = subprocess.Popen(["snap", "list"], stdout=PIPE,
474 universal_newlines=True).communicate()
475 for snap in snaps:
476 installed = False
477 # check to see if the snap is already installed
478 if re.search("^%s " % snap, installed_snaps[0], re.MULTILINE):
479 logging.debug("Snap %s is already installed" % snap)
480 installed = True
481 if not installed:
482 try:
483 proc = subprocess.run(["snap", "install", "--channel",
484 "stable/ubuntu-18.04", snap],
485 stdout=subprocess.PIPE,
486 check=True)
487 except subprocess.CalledProcessError:
488 logging.debug("Install of snap %s failed" % snap)
489 if proc.returncode == 0:
490 logging.debug("Install of snap %s succeeded" % snap)
491 installed = True
492 if installed:
493 self.controller.forced_obsoletes.append(snap)
494
419 def _checkPae(self):495 def _checkPae(self):
420 " check PAE in /proc/cpuinfo "496 " check PAE in /proc/cpuinfo "
421 # upgrade from Precise will fail if PAE is not in cpu flags497 # upgrade from Precise will fail if PAE is not in cpu flags

Subscribers

People subscribed via source and target branches