[neon/forks/ubuntu-release-upgrader/Neon/unstable_focal] DistUpgrade: upgrade snaps if a specific metapkg is installed

Brian Murray null at kde.org
Wed Apr 28 11:06:46 BST 2021


Git commit e482711c59f8a527d5791aedc8e89493e75b2c34 by Brian Murray.
Committed on 13/04/2021 at 18:33.
Pushed by jriddell into branch 'Neon/unstable_focal'.

upgrade snaps if a specific metapkg is installed

M  +12   -8    DistUpgrade/DistUpgradeQuirks.py
M  +12   -4    DistUpgrade/deb2snap.json

https://invent.kde.org/neon/forks/ubuntu-release-upgrader/commit/e482711c59f8a527d5791aedc8e89493e75b2c34

diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
index 0460c59a..ffca4551 100644
--- a/DistUpgrade/DistUpgradeQuirks.py
+++ b/DistUpgrade/DistUpgradeQuirks.py
@@ -121,12 +121,10 @@ class DistUpgradeQuirks(object):
         cache = self.controller.cache
         self._test_and_warn_if_ros_installed(cache)
 
-        if 'ubuntu-desktop' not in cache or \
-                'snapd' not in cache:
+        if 'snapd' not in cache:
             logging.debug("package required for Quirk not in cache")
             return
-        if cache['ubuntu-desktop'].is_installed and \
-                cache['snapd'].is_installed:
+        if cache['snapd'].is_installed:
             self._checkStoreConnectivity()
         # If the snap store is accessible, at the same time calculate the
         # extra size needed by to-be-installed snaps.  This also prepares
@@ -137,12 +135,10 @@ class DistUpgradeQuirks(object):
     def focalPostUpgrade(self):
         logging.debug("running Quirks.focalPostUpgrade")
         cache = self.controller.cache
-        if 'ubuntu-desktop' not in cache or \
-                'snapd' not in cache:
+        if 'snapd' not in cache:
             logging.debug("package required for Quirk not in cache")
             return
-        if cache['ubuntu-desktop'].is_installed and \
-                cache['snapd'].is_installed and \
+        if cache['snapd'].is_installed and \
                 self._snap_list:
             self._replaceDebsAndSnaps()
 
@@ -971,6 +967,10 @@ class DistUpgradeQuirks(object):
 
             for snap in d2s["seeded"]:
                 seed = d2s["seeded"][snap]
+                metapkg = seed.get("metapkg", None)
+                if metapkg and \
+                        self.controller.cache[metapkg].is_installed == False:
+                    continue
                 deb = seed.get("deb", None)
                 from_chan = seed.get("from_channel", from_channel)
                 to_chan = seed.get("to_channel", to_channel)
@@ -979,6 +979,10 @@ class DistUpgradeQuirks(object):
             for snap in d2s["unseeded"]:
                 unseed = d2s["unseeded"][snap]
                 deb = unseed.get("deb", None)
+                metapkg = unseed.get("metapkg", None)
+                if metapkg and \
+                        self.controller.cache[metapkg].is_installed == False:
+                    continue
                 from_chan = unseed.get("from_channel", from_channel)
                 unseeded_snaps[snap] = (deb, from_chan)
         except Exception as e:
diff --git a/DistUpgrade/deb2snap.json b/DistUpgrade/deb2snap.json
index 8681e249..aeb72bc3 100644
--- a/DistUpgrade/deb2snap.json
+++ b/DistUpgrade/deb2snap.json
@@ -5,24 +5,32 @@
             "to_channel": "stable"
         },
         "gnome-3-34-1804": {
+            "metapkg": "ubuntu-desktop"
         },
         "gtk-common-themes": {
+            "metapkg": "ubuntu-desktop"
         },
         "snap-store": {
-            "deb": "gnome-software"
+            "deb": "gnome-software",
+            "metapkg": "ubuntu-desktop"
+        },
+        "google-cloud-sdk": {
         }
     },
     "unseeded": {
         "gnome-3-28-1804": {
         },
         "gnome-calculator": {
-            "deb": "gnome-calculator"
+            "deb": "gnome-calculator",
+            "metapkg": "ubuntu-desktop"
         },
         "gnome-characters": {
-            "deb": "gnome-characters"
+            "deb": "gnome-characters",
+            "metapkg": "ubuntu-desktop"
         },
         "gnome-logs": {
-            "deb": "gnome-logs"
+            "deb": "gnome-logs",
+            "metapkg": "ubuntu-desktop"
         }
     }
 }



More information about the Neon-commits mailing list