Title: [266450] trunk/Tools
Revision
266450
Author
dp...@igalia.com
Date
2020-09-01 21:50:35 -0700 (Tue, 01 Sep 2020)

Log Message

[Flatpak SDK] Adapt clean-webkit script to flatpak
https://bugs.webkit.org/show_bug.cgi?id=216044

Reviewed by Philippe Normand.

Keep relevant directories in WebKitBuild/ when using flatpak.

* Scripts/clean-webkit:
(usesFlatpak):
(listWebKitBuildFiles):
(removeFiles):
(main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (266449 => 266450)


--- trunk/Tools/ChangeLog	2020-09-02 03:13:28 UTC (rev 266449)
+++ trunk/Tools/ChangeLog	2020-09-02 04:50:35 UTC (rev 266450)
@@ -1,3 +1,18 @@
+2020-09-01  Diego Pino Garcia  <dp...@igalia.com>
+
+        [Flatpak SDK] Adapt clean-webkit script to flatpak
+        https://bugs.webkit.org/show_bug.cgi?id=216044
+
+        Reviewed by Philippe Normand.
+
+        Keep relevant directories in WebKitBuild/ when using flatpak.
+
+        * Scripts/clean-webkit:
+        (usesFlatpak):
+        (listWebKitBuildFiles):
+        (removeFiles):
+        (main):
+
 2020-09-01  Hector Lopez  <hector_i_lo...@apple.com>
 
         Unreviewed, reverting r266408.

Modified: trunk/Tools/Scripts/clean-webkit (266449 => 266450)


--- trunk/Tools/Scripts/clean-webkit	2020-09-02 03:13:28 UTC (rev 266449)
+++ trunk/Tools/Scripts/clean-webkit	2020-09-02 04:50:35 UTC (rev 266450)
@@ -29,12 +29,30 @@
 
 import sys
 import argparse
+import os
 
 from webkitpy.common.checkout.scm.detection import SCMDetector
 from webkitpy.common.host import Host
 from webkitpy.common.system.filesystem import FileSystem
 
+def usesFlatpak():
+    return not os.environ.get('WEBKIT_JHBUILD') or os.environ.get('WEBKIT_JHBUILD') == '0'
 
+def listWebKitBuildFiles(fs):
+    ret = []
+    if fs.isdir("WebKitBuild"):
+        for build_dir in fs.listdir("WebKitBuild"):
+            build_path = fs.join("WebKitBuild", build_dir)
+            ret.append(build_path)
+    return ret
+
+def removeFiles(l):
+    for each in l:
+        if fs.isdir(each):
+            fs.rmtree(each)
+        else:
+            fs.remove(each)
+
 def main(args):
     fs = FileSystem()
     host = Host()
@@ -46,13 +64,10 @@
         # Clean everything inside WebKitBuild, except the JHBuild directories.
         scm.discard_untracked_files(discard_ignored_files=True, keep_webkitbuild_directory=True)
         if fs.isdir("WebKitBuild"):
-            for build_dir in fs.listdir("WebKitBuild"):
-                build_path = fs.join("WebKitBuild", build_dir)
-                if fs.isdir(build_path):
-                    if build_dir not in ["DependenciesGTK", "DependenciesWPE"]:
-                        fs.rmtree(build_path)
-                else:
-                    fs.remove(build_path)
+            files = listWebKitBuildFiles(fs)
+            keepDirs = usesFlatpak() and ["Toolchains", "UserFlatpak"] or ["DependenciesGTK", "DependenciesWPE"]
+            files = filter(lambda path: path[len("WebKitBuild/"):] not in keepDirs, files)
+            removeFiles(files)
     else:
         scm.discard_untracked_files(discard_ignored_files=True)
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to