Title: [260747] trunk/Tools
Revision
260747
Author
[email protected]
Date
2020-04-27 03:00:24 -0700 (Mon, 27 Apr 2020)

Log Message

[Flatpak SDK] Regenerate toolchains only if new updates were downloaded
https://bugs.webkit.org/show_bug.cgi?id=210804

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

The SDK toolchain archives are now regenerated only if an actual
update was downloaded from the Flatpak repository. Some redundant
flatpak calls were removed as well, such as the GL extension and
Debug reinstalls that were happening during webkit-flatpak
updates.

* flatpak/flatpakutils.py:
(FlatpakObject.flatpak):
(FlatpakRepo.__init__):
(WebkitFlatpak.main):
(WebkitFlatpak.setup_dev_env):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (260746 => 260747)


--- trunk/Tools/ChangeLog	2020-04-27 09:57:53 UTC (rev 260746)
+++ trunk/Tools/ChangeLog	2020-04-27 10:00:24 UTC (rev 260747)
@@ -1,5 +1,24 @@
 2020-04-27  Philippe Normand  <[email protected]>
 
+        [Flatpak SDK] Regenerate toolchains only if new updates were downloaded
+        https://bugs.webkit.org/show_bug.cgi?id=210804
+
+        Reviewed by Žan Doberšek.
+
+        The SDK toolchain archives are now regenerated only if an actual
+        update was downloaded from the Flatpak repository. Some redundant
+        flatpak calls were removed as well, such as the GL extension and
+        Debug reinstalls that were happening during webkit-flatpak
+        updates.
+
+        * flatpak/flatpakutils.py:
+        (FlatpakObject.flatpak):
+        (FlatpakRepo.__init__):
+        (WebkitFlatpak.main):
+        (WebkitFlatpak.setup_dev_env):
+
+2020-04-27  Philippe Normand  <[email protected]>
+
         unable to build from tot - linux - flatpakutils.py - TypeError: not enough arguments for format string
         https://bugs.webkit.org/show_bug.cgi?id=210941
 

Modified: trunk/Tools/flatpak/flatpakutils.py (260746 => 260747)


--- trunk/Tools/flatpak/flatpakutils.py	2020-04-27 09:57:53 UTC (rev 260746)
+++ trunk/Tools/flatpak/flatpakutils.py	2020-04-27 10:00:24 UTC (rev 260747)
@@ -156,15 +156,19 @@
     def flatpak(self, command, *args, **kwargs):
         show_output = kwargs.pop("show_output", False)
         comment = kwargs.pop("comment", None)
+        gather_output = kwargs.get("gather_output", False)
         if comment:
             Console.message(comment)
 
         command = ["flatpak", command]
-        res = subprocess.check_output(command + ["--help"]).decode("utf-8")
-        if self.user and "--user" in res:
+        help_output = subprocess.check_output(command + ["--help"]).decode("utf-8")
+        if self.user and "--user" in help_output:
             command.append("--user")
-        if "--assumeyes" in res:
+        if "--assumeyes" in help_output:
             command.append("--assumeyes")
+        if "--noninteractive" and gather_output:
+            command.append("--noninteractive")
+
         command.extend(args)
 
         _log.debug("Executing %s" % ' '.join(command))
@@ -171,7 +175,12 @@
         if not show_output:
             return subprocess.check_output(command).decode("utf-8")
 
-        return subprocess.check_call(command)
+        if not gather_output:
+            return subprocess.check_call(command)
+        else:
+            p = subprocess.Popen(command, stdout=subprocess.PIPE)
+            output = p.communicate()
+            return output
 
 
 class FlatpakPackages(FlatpakObject):
@@ -272,11 +281,9 @@
             assert url
 
         self._app_registry = {}
-        output = self.flatpak("list", "--columns=application,branch,origin")
+        output = self.flatpak("list", "--columns=application,branch", "-a")
         for line in output.splitlines():
-            name, branch, origin = line.split("\t")
-            if origin != self.name:
-                continue
+            name, branch = line.split("\t")
             self._app_registry[name] = branch
 
     def is_app_installed(self, name, branch=None):
@@ -761,7 +768,9 @@
 
         if self.update:
             repo = self.sdk_repo
-            repo.flatpak("update", show_output=True, comment="Updating Flatpak %s environment" % self.build_type)
+            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
+
             for package in self._get_packages():
                 if package.name.startswith("org.webkit") and repo.is_app_installed(package.name) \
                    and not repo.is_app_installed(package.name, branch=self.sdk_branch):
@@ -768,10 +777,20 @@
                     Console.message("New SDK version available, removing local UserFlatpak directory before switching to new version")
                     shutil.rmtree(self.flatpak_build_path)
                     self._reset_repository()
+                    regenerate_toolchains = True
                     break
                 elif not repo.is_app_installed(package.name):
                     package.install()
+                    regenerate_toolchains = True
+        else:
+            regenerate_toolchains = self.regenerate_toolchains
 
+        if regenerate_toolchains:
+            self.icc_version = {}
+            self.setup_icecc("gcc")
+            self.setup_icecc("clang")
+            self.save_config()
+
         return self.setup_dev_env()
 
     def run(self):
@@ -809,16 +828,7 @@
     def setup_dev_env(self):
         if not os.path.exists(os.path.join(self.flatpak_build_path, "runtime", "org.webkit.Sdk")) or self.update:
             self.install_all()
-            regenerate_toolchains = True
-        else:
-            regenerate_toolchains = self.regenerate_toolchains
 
-        if regenerate_toolchains:
-            self.icc_version = {}
-            self.setup_icecc("gcc")
-            self.setup_icecc("clang")
-            self.save_config()
-
         if not self.update:
             for package in self._get_packages():
                 if package.name.startswith("org.webkit") and not package.is_installed(self.sdk_branch):
@@ -833,7 +843,7 @@
                 self.user_command.append("--cmakeargs=%s" % self.cmakeargs)
 
             return self.run_in_sandbox(*self.user_command)
-        elif not self.update and not self.build_gst:
+        elif not self.update and not self.build_gst and not self.regenerate_toolchains:
             return self.run_in_sandbox()
 
         return 0
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to