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
1diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
2index 0127d44..6a4526e 100644
3--- a/DistUpgrade/DistUpgradeQuirks.py
4+++ b/DistUpgrade/DistUpgradeQuirks.py
5@@ -122,12 +122,10 @@ class DistUpgradeQuirks(object):
6 cache = self.controller.cache
7 self._test_and_warn_if_ros_installed(cache)
8
9- if 'ubuntu-desktop' not in cache or \
10- 'snapd' not in cache:
11+ if 'snapd' not in cache:
12 logging.debug("package required for Quirk not in cache")
13 return
14- if cache['ubuntu-desktop'].is_installed and \
15- cache['snapd'].is_installed:
16+ if cache['snapd'].is_installed:
17 self._checkStoreConnectivity()
18 # If the snap store is accessible, at the same time calculate the
19 # extra size needed by to-be-installed snaps. This also prepares
20@@ -138,12 +136,10 @@ class DistUpgradeQuirks(object):
21 def hirsutePostUpgrade(self):
22 logging.debug("running Quirks.hirsutePostUpgrade")
23 cache = self.controller.cache
24- if 'ubuntu-desktop' not in cache or \
25- 'snapd' not in cache:
26+ if 'snapd' not in cache:
27 logging.debug("package required for Quirk not in cache")
28 return
29- if cache['ubuntu-desktop'].is_installed and \
30- cache['snapd'].is_installed and \
31+ if cache['snapd'].is_installed and \
32 self._snap_list:
33 self._replaceDebsAndSnaps()
34
35@@ -994,6 +990,12 @@ class DistUpgradeQuirks(object):
36
37 for snap in d2s["seeded"]:
38 seed = d2s["seeded"][snap]
39+ metapkg = seed.get("metapkg", None)
40+ if metapkg not in self.controller.cache:
41+ continue
42+ if metapkg and \
43+ self.controller.cache[metapkg].is_installed == False:
44+ continue
45 deb = seed.get("deb", None)
46 from_chan = seed.get("from_channel", from_channel)
47 to_chan = seed.get("to_channel", to_channel)
48@@ -1002,11 +1004,31 @@ class DistUpgradeQuirks(object):
49 for snap in d2s["unseeded"]:
50 unseed = d2s["unseeded"][snap]
51 deb = unseed.get("deb", None)
52+ metapkg = unseed.get("metapkg", None)
53+ if metapkg not in self.controller.cache:
54+ continue
55+ if metapkg and \
56+ self.controller.cache[metapkg].is_installed == False:
57+ continue
58 from_chan = unseed.get("from_channel", from_channel)
59 unseeded_snaps[snap] = (deb, from_chan)
60 except Exception as e:
61 logging.warning("error reading deb2snap.json file (%s)" % e)
62
63+ # list the installed snaps and add them to seeded ones
64+ snap_list = subprocess.Popen(["snap", "list"],
65+ universal_newlines=True,
66+ stdout=subprocess.PIPE).communicate()
67+ # first line of output is a header and the last line is empty
68+ snaps_installed = [line.split()[0] \
69+ for line in snap_list[0].split('\n')[1:-1]]
70+
71+ for snap in snaps_installed:
72+ if snap in seeded_snaps or snap in unseeded_snaps:
73+ continue
74+ else:
75+ seeded_snaps[snap] = (None, from_channel, to_channel)
76+
77 self._view.updateStatus(_("Checking for installed snaps"))
78 for snap, (deb, from_channel, to_channel) in seeded_snaps.items():
79 snap_object = {}
80diff --git a/DistUpgrade/deb2snap.json b/DistUpgrade/deb2snap.json
81index 8681e24..3b57b98 100644
82--- a/DistUpgrade/deb2snap.json
83+++ b/DistUpgrade/deb2snap.json
84@@ -5,24 +5,30 @@
85 "to_channel": "stable"
86 },
87 "gnome-3-34-1804": {
88+ "metapkg": "ubuntu-desktop"
89 },
90 "gtk-common-themes": {
91+ "metapkg": "ubuntu-desktop"
92 },
93 "snap-store": {
94- "deb": "gnome-software"
95+ "deb": "gnome-software",
96+ "metapkg": "ubuntu-desktop"
97 }
98 },
99 "unseeded": {
100 "gnome-3-28-1804": {
101 },
102 "gnome-calculator": {
103- "deb": "gnome-calculator"
104+ "deb": "gnome-calculator",
105+ "metapkg": "ubuntu-desktop"
106 },
107 "gnome-characters": {
108- "deb": "gnome-characters"
109+ "deb": "gnome-characters",
110+ "metapkg": "ubuntu-desktop"
111 },
112 "gnome-logs": {
113- "deb": "gnome-logs"
114+ "deb": "gnome-logs",
115+ "metapkg": "ubuntu-desktop"
116 }
117 }
118 }

Subscribers

People subscribed via source and target branches