Merge ~brian-murray/ubuntu-release-upgrader:deb2snap into ubuntu-release-upgrader:ubuntu/master

Proposed by Brian Murray
Status: Merged
Merged at revision: d584a13303614e902c08c80c2b2699296851deed
Proposed branch: ~brian-murray/ubuntu-release-upgrader:deb2snap
Merge into: ubuntu-release-upgrader:ubuntu/master
Diff against target: 118 lines (+40/-12)
2 files modified
DistUpgrade/DistUpgradeQuirks.py (+30/-8)
DistUpgrade/deb2snap.json (+10/-4)
Reviewer Review Type Date Requested Status
Joshua Powers (community) Approve
Ubuntu Core Development Team Pending
Review via email: mp+400993@code.launchpad.net

Description of the change

Utilize the existing code in the deb-to-snap quirk to also migrate preseeded snaps from latest/stable/ubuntu-20.10 to latest/stable/ubuntu-21.04. This'll fix bug 1922297.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

The "metapkg" information is added to deb2snap.json to prevent those packages from being install on systems without the ubuntu-dekstop metapackage installed e.g. a GCE image.

Revision history for this message
Joshua Powers (powersj) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
index 0127d44..6a4526e 100644
--- a/DistUpgrade/DistUpgradeQuirks.py
+++ b/DistUpgrade/DistUpgradeQuirks.py
@@ -122,12 +122,10 @@ class DistUpgradeQuirks(object):
122 cache = self.controller.cache122 cache = self.controller.cache
123 self._test_and_warn_if_ros_installed(cache)123 self._test_and_warn_if_ros_installed(cache)
124124
125 if 'ubuntu-desktop' not in cache or \125 if 'snapd' not in cache:
126 'snapd' not in cache:
127 logging.debug("package required for Quirk not in cache")126 logging.debug("package required for Quirk not in cache")
128 return127 return
129 if cache['ubuntu-desktop'].is_installed and \128 if cache['snapd'].is_installed:
130 cache['snapd'].is_installed:
131 self._checkStoreConnectivity()129 self._checkStoreConnectivity()
132 # If the snap store is accessible, at the same time calculate the130 # If the snap store is accessible, at the same time calculate the
133 # extra size needed by to-be-installed snaps. This also prepares131 # extra size needed by to-be-installed snaps. This also prepares
@@ -138,12 +136,10 @@ class DistUpgradeQuirks(object):
138 def hirsutePostUpgrade(self):136 def hirsutePostUpgrade(self):
139 logging.debug("running Quirks.hirsutePostUpgrade")137 logging.debug("running Quirks.hirsutePostUpgrade")
140 cache = self.controller.cache138 cache = self.controller.cache
141 if 'ubuntu-desktop' not in cache or \139 if 'snapd' not in cache:
142 'snapd' not in cache:
143 logging.debug("package required for Quirk not in cache")140 logging.debug("package required for Quirk not in cache")
144 return141 return
145 if cache['ubuntu-desktop'].is_installed and \142 if cache['snapd'].is_installed and \
146 cache['snapd'].is_installed and \
147 self._snap_list:143 self._snap_list:
148 self._replaceDebsAndSnaps()144 self._replaceDebsAndSnaps()
149145
@@ -994,6 +990,12 @@ class DistUpgradeQuirks(object):
994990
995 for snap in d2s["seeded"]:991 for snap in d2s["seeded"]:
996 seed = d2s["seeded"][snap]992 seed = d2s["seeded"][snap]
993 metapkg = seed.get("metapkg", None)
994 if metapkg not in self.controller.cache:
995 continue
996 if metapkg and \
997 self.controller.cache[metapkg].is_installed == False:
998 continue
997 deb = seed.get("deb", None)999 deb = seed.get("deb", None)
998 from_chan = seed.get("from_channel", from_channel)1000 from_chan = seed.get("from_channel", from_channel)
999 to_chan = seed.get("to_channel", to_channel)1001 to_chan = seed.get("to_channel", to_channel)
@@ -1002,11 +1004,31 @@ class DistUpgradeQuirks(object):
1002 for snap in d2s["unseeded"]:1004 for snap in d2s["unseeded"]:
1003 unseed = d2s["unseeded"][snap]1005 unseed = d2s["unseeded"][snap]
1004 deb = unseed.get("deb", None)1006 deb = unseed.get("deb", None)
1007 metapkg = unseed.get("metapkg", None)
1008 if metapkg not in self.controller.cache:
1009 continue
1010 if metapkg and \
1011 self.controller.cache[metapkg].is_installed == False:
1012 continue
1005 from_chan = unseed.get("from_channel", from_channel)1013 from_chan = unseed.get("from_channel", from_channel)
1006 unseeded_snaps[snap] = (deb, from_chan)1014 unseeded_snaps[snap] = (deb, from_chan)
1007 except Exception as e:1015 except Exception as e:
1008 logging.warning("error reading deb2snap.json file (%s)" % e)1016 logging.warning("error reading deb2snap.json file (%s)" % e)
10091017
1018 # list the installed snaps and add them to seeded ones
1019 snap_list = subprocess.Popen(["snap", "list"],
1020 universal_newlines=True,
1021 stdout=subprocess.PIPE).communicate()
1022 # first line of output is a header and the last line is empty
1023 snaps_installed = [line.split()[0] \
1024 for line in snap_list[0].split('\n')[1:-1]]
1025
1026 for snap in snaps_installed:
1027 if snap in seeded_snaps or snap in unseeded_snaps:
1028 continue
1029 else:
1030 seeded_snaps[snap] = (None, from_channel, to_channel)
1031
1010 self._view.updateStatus(_("Checking for installed snaps"))1032 self._view.updateStatus(_("Checking for installed snaps"))
1011 for snap, (deb, from_channel, to_channel) in seeded_snaps.items():1033 for snap, (deb, from_channel, to_channel) in seeded_snaps.items():
1012 snap_object = {}1034 snap_object = {}
diff --git a/DistUpgrade/deb2snap.json b/DistUpgrade/deb2snap.json
index 8681e24..3b57b98 100644
--- a/DistUpgrade/deb2snap.json
+++ b/DistUpgrade/deb2snap.json
@@ -5,24 +5,30 @@
5 "to_channel": "stable"5 "to_channel": "stable"
6 },6 },
7 "gnome-3-34-1804": {7 "gnome-3-34-1804": {
8 "metapkg": "ubuntu-desktop"
8 },9 },
9 "gtk-common-themes": {10 "gtk-common-themes": {
11 "metapkg": "ubuntu-desktop"
10 },12 },
11 "snap-store": {13 "snap-store": {
12 "deb": "gnome-software"14 "deb": "gnome-software",
15 "metapkg": "ubuntu-desktop"
13 }16 }
14 },17 },
15 "unseeded": {18 "unseeded": {
16 "gnome-3-28-1804": {19 "gnome-3-28-1804": {
17 },20 },
18 "gnome-calculator": {21 "gnome-calculator": {
19 "deb": "gnome-calculator"22 "deb": "gnome-calculator",
23 "metapkg": "ubuntu-desktop"
20 },24 },
21 "gnome-characters": {25 "gnome-characters": {
22 "deb": "gnome-characters"26 "deb": "gnome-characters",
27 "metapkg": "ubuntu-desktop"
23 },28 },
24 "gnome-logs": {29 "gnome-logs": {
25 "deb": "gnome-logs"30 "deb": "gnome-logs",
31 "metapkg": "ubuntu-desktop"
26 }32 }
27 }33 }
28}34}

Subscribers

People subscribed via source and target branches