Title: [263029] trunk/Tools
Revision
263029
Author
[email protected]
Date
2020-06-15 02:31:24 -0700 (Mon, 15 Jun 2020)

Log Message

[Flatpak SDK] flatpak update still not displayed
https://bugs.webkit.org/show_bug.cgi?id=213180

Patch by Philippe Normand <[email protected]> on 2020-06-15
Reviewed by Žan Doberšek.

Added a new --version option to the script. We no longer gather the flatpak update command
output to know if something was updated or not. Instead we get the version of the SDK prior
to the update operation and compare that with the version after the update.

* flatpak/flatpakutils.py:
(FlatpakObject.version):
(WebkitFlatpak.load_from_args):
(WebkitFlatpak.main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (263028 => 263029)


--- trunk/Tools/ChangeLog	2020-06-15 09:27:11 UTC (rev 263028)
+++ trunk/Tools/ChangeLog	2020-06-15 09:31:24 UTC (rev 263029)
@@ -1,3 +1,19 @@
+2020-06-15  Philippe Normand  <[email protected]>
+
+        [Flatpak SDK] flatpak update still not displayed
+        https://bugs.webkit.org/show_bug.cgi?id=213180
+
+        Reviewed by Žan Doberšek.
+
+        Added a new --version option to the script. We no longer gather the flatpak update command
+        output to know if something was updated or not. Instead we get the version of the SDK prior
+        to the update operation and compare that with the version after the update.
+
+        * flatpak/flatpakutils.py:
+        (FlatpakObject.version):
+        (WebkitFlatpak.load_from_args):
+        (WebkitFlatpak.main):
+
 2020-06-15  Carlos Garcia Campos  <[email protected]>
 
         [GTK][WPE] Add API to expose UIClient::requestStorageAccessConfirm

Modified: trunk/Tools/flatpak/flatpakutils.py (263028 => 263029)


--- trunk/Tools/flatpak/flatpakutils.py	2020-06-15 09:27:11 UTC (rev 263028)
+++ trunk/Tools/flatpak/flatpakutils.py	2020-06-15 09:31:24 UTC (rev 263029)
@@ -196,6 +196,16 @@
         _log.debug("Executing %s" % ' '.join(command))
         return run_sanitized(command, gather_output=gather_output)
 
+    def version(self, ref_id):
+        output = self.flatpak("info", ref_id, gather_output=True)
+        for line in output.splitlines():
+            tokens = line.split(":")
+            if len(tokens) != 2:
+                continue
+            if tokens[0].strip().lower() == "version":
+                return tokens[1].strip()
+        return ""
+
 class FlatpakPackages(FlatpakObject):
 
     def __init__(self, repos, user=True):
@@ -391,8 +401,8 @@
 
         parser = argparse.ArgumentParser(prog="webkit-flatpak", add_help=add_help)
         general = parser.add_argument_group("General")
-        general.add_argument('--verbose', action='',
-                             help='Show debug message')
+        general.add_argument('--verbose', action='', help='Show debug messages')
+        general.add_argument('--version', action='', help='Show SDK version', dest="show_version")
         type_group = parser.add_mutually_exclusive_group()
         type_group.add_argument("--debug",
                                 help="Compile with Debug configuration, also installs Sdk debug symbols.",
@@ -454,6 +464,7 @@
         self.sdk = None
         self.user_repo = None
 
+        self.show_version = False
         self.verbose = False
         self.quiet = False
         self.update = False
@@ -812,10 +823,15 @@
         if not self.clean_args():
             return 1
 
+        if self.show_version:
+            print(self.sdk_repo.version("org.webkit.Sdk"))
+            return 0
+
         if self.update:
             repo = self.sdk_repo
-            update_output = repo.flatpak("update", gather_output=True, comment="Updating Flatpak %s environment" % self.build_type)
-            regenerate_toolchains = update_output.find("Nothing to do") == -1
+            version_before_update = repo.version("org.webkit.Sdk")
+            repo.flatpak("update", comment="Updating Flatpak %s environment" % self.build_type)
+            regenerate_toolchains = repo.version("org.webkit.Sdk") != version_before_update
 
             for package in self._get_packages():
                 if package.name.startswith("org.webkit") and repo.is_app_installed(package.name) \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to