[neon/forks/ubuntu-release-upgrader/Neon/unstable_focal] /: DistUpgrade/DistUpgradeQuirks.py: Modify the deb-to-snap quirk to also upgrade preseeded snaps to latest/stable/ubuntu-$version for their new release. (LP: #1922297)
Brian Murray
null at kde.org
Wed Apr 28 11:06:46 BST 2021
Git commit ad499ebb18dcd98d11c1f3616fafc8c0fb480f6e by Brian Murray.
Committed on 13/04/2021 at 18:36.
Pushed by jriddell into branch 'Neon/unstable_focal'.
DistUpgrade/DistUpgradeQuirks.py: Modify the deb-to-snap quirk to also upgrade preseeded snaps to latest/stable/ubuntu-$version for their new release. (LP: #1922297)
M +10 -8 DistUpgrade/DistUpgradeQuirks.py
M +2 -1 DistUpgrade/deb2snap.json
M +8 -0 debian/changelog
M +14 -8 tests/test_quirks.py
https://invent.kde.org/neon/forks/ubuntu-release-upgrader/commit/ad499ebb18dcd98d11c1f3616fafc8c0fb480f6e
diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
index d1d204a5..28122bb5 100644
--- a/DistUpgrade/DistUpgradeQuirks.py
+++ b/DistUpgrade/DistUpgradeQuirks.py
@@ -992,19 +992,21 @@ class DistUpgradeQuirks(object):
except Exception as e:
logging.warning("error reading deb2snap.json file (%s)" % e)
+ snap_list = ''
# list the installed snaps and add them to seeded ones
snap_list = subprocess.Popen(["snap", "list"],
universal_newlines=True,
stdout=subprocess.PIPE).communicate()
- # first line of output is a header and the last line is empty
- snaps_installed = [line.split()[0]
- for line in snap_list[0].split('\n')[1:-1]]
+ if snap_list:
+ # first line of output is a header and the last line is empty
+ snaps_installed = [line.split()[0]
+ for line in snap_list[0].split('\n')[1:-1]]
- for snap in snaps_installed:
- if snap in seeded_snaps or snap in unseeded_snaps:
- continue
- else:
- seeded_snaps[snap] = (None, from_channel, to_channel)
+ for snap in snaps_installed:
+ if snap in seeded_snaps or snap in unseeded_snaps:
+ continue
+ else:
+ seeded_snaps[snap] = (None, from_channel, to_channel)
self._view.updateStatus(_("Checking for installed snaps"))
for snap, (deb, from_channel, to_channel) in seeded_snaps.items():
diff --git a/DistUpgrade/deb2snap.json b/DistUpgrade/deb2snap.json
index 3b57b98a..e79fe2d7 100644
--- a/DistUpgrade/deb2snap.json
+++ b/DistUpgrade/deb2snap.json
@@ -2,7 +2,8 @@
"seeded": {
"core18": {
"from_channel": "stable",
- "to_channel": "stable"
+ "to_channel": "stable",
+ "metapkg": "ubuntu-desktop"
},
"gnome-3-34-1804": {
"metapkg": "ubuntu-desktop"
diff --git a/debian/changelog b/debian/changelog
index c6d8ac57..9af7e0b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ubuntu-release-upgrader (1:20.04.32) UNRELEASED; urgency=medium
+
+ * DistUpgrade/DistUpgradeQuirks.py: Modify the deb-to-snap quirk to also
+ upgrade preseeded snaps to latest/stable/ubuntu-$version for their new
+ release. (LP: #1922297)
+
+ -- Brian Murray <brian at ubuntu.com> Tue, 13 Apr 2021 11:35:32 -0700
+
ubuntu-release-upgrader (1:20.04.31) focal; urgency=medium
* DistUpgrade/DistUpgradeQuirks.py: use apt's problem resolver to better
diff --git a/tests/test_quirks.py b/tests/test_quirks.py
index 66aae133..b125008d 100644
--- a/tests/test_quirks.py
+++ b/tests/test_quirks.py
@@ -31,6 +31,8 @@ class MockPopenSnap():
self.command = cmd
def communicate(self):
+ if self.command[1] == "list":
+ return []
snap_name = self.command[2]
if snap_name == 'gnome-logs':
# Package to refresh
@@ -460,6 +462,10 @@ class TestSnapQuirks(unittest.TestCase):
# Call method under test
controller.cache = {
+ 'ubuntu-desktop':
+ make_mock_pkg(
+ name="ubuntu-desktop",
+ is_installed=True),
'core18':
make_mock_pkg(
name="core18",
@@ -501,20 +507,20 @@ class TestSnapQuirks(unittest.TestCase):
self.assertDictEqual(
q._snap_list,
{'core18': {
+ 'channel': 'stable',
'command': 'install',
- 'deb': None, 'snap-id': '1234',
- 'channel': 'stable'},
+ 'deb': None, 'snap-id': '1234'},
'gnome-3-34-1804': {
+ 'channel': 'stable/ubuntu-19.10',
'command': 'install',
- 'deb': None, 'snap-id': '1234',
- 'channel': 'stable/ubuntu-19.10'},
+ 'deb': None, 'snap-id': '1234'},
+ 'gnome-logs': {
+ 'command': 'remove'},
'snap-store': {
+ 'channel': 'stable/ubuntu-19.10',
'command': 'install',
'deb': 'gnome-software',
- 'snap-id': '1234',
- 'channel': 'stable/ubuntu-19.10'},
- 'gnome-logs': {
- 'command': 'remove'}})
+ 'snap-id': '1234'}})
@mock.patch("DistUpgrade.DistUpgradeQuirks.get_arch")
@mock.patch("urllib.request.urlopen")
More information about the Neon-commits
mailing list