[neon/forks/ubuntu-release-upgrader/Neon/unstable_jammy] DistUpgrade: stop notifications of updates from discover by masking packagekit

Harald Sitter null at kde.org
Tue Apr 26 19:20:53 BST 2022


Git commit bb25823fbfa45e3ec94f9d0c1573c28457eb51a3 by Harald Sitter.
Committed on 26/04/2022 at 18:16.
Pushed by sitter into branch 'Neon/unstable_jammy'.

stop notifications of updates from discover by masking packagekit

masking surrounds the view so we have close
coverage of the "cricitcal" section (i.e. the actual upgradey bits).

this is --now so it immediately kills packagekit (and aborting any prending
refresh requests)

this is --runtime so it definitely gets unmasked on reboot regardless of
what happens during the upgrade (e.g. upgrader crashes)

M  +14   -0    DistUpgrade/DistUpgradeViewKDE.py

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

diff --git a/DistUpgrade/DistUpgradeViewKDE.py b/DistUpgrade/DistUpgradeViewKDE.py
index aa913a5b..69661367 100644
--- a/DistUpgrade/DistUpgradeViewKDE.py
+++ b/DistUpgrade/DistUpgradeViewKDE.py
@@ -650,6 +650,12 @@ class DistUpgradeViewKDE(DistUpgradeView):
         self.konsole_frame_layout.addWidget(self.terminal_text)
         self.terminal_text.show()
 
+        # Mask packagekit to avoid discover getting notifications or doing
+        # any manipulations. The UX of this isn't ideal but since we can't
+        # switch pk into an upgrade state it's the best we can do.
+        self.maskPackageKit()
+        atexit.register(self.unmaskPackageKit)
+
         # for some reason we need to start the main loop to get everything displayed
         # this app mostly works with processEvents but run main loop briefly to keep it happily displaying all widgets
         QTimer.singleShot(10, self.exitMainLoopMidFlight)
@@ -660,6 +666,14 @@ class DistUpgradeViewKDE(DistUpgradeView):
         print("exitMainLoopMidFlight")
         self.app.exit()
 
+
+    def maskPackageKit(self):
+        subprocess.run(['systemctl', 'mask', '--runtime', '--now', 'packagekit.socket'])
+        subprocess.run(['systemctl', 'mask', '--runtime', '--now', 'packagekit.service'])
+
+    def unmaskPackageKit(self):
+        subprocess.run(['systemctl', 'unmask', '--runtime', 'packagekit.service'])
+        subprocess.run(['systemctl', 'unmask', '--runtime', 'packagekit.socket'])
     def translate_widget_children(self, parentWidget=None):
         if parentWidget == None:
             parentWidget = self.window_main



More information about the Neon-commits mailing list