Title: [285625] trunk/Tools
Revision
285625
Author
[email protected]
Date
2021-11-11 06:32:47 -0800 (Thu, 11 Nov 2021)

Log Message

[GTK][WPE] webkit-flatpak-run-nightly infinite self-call loop
https://bugs.webkit.org/show_bug.cgi?id=230400

Patch by Philippe Normand <[email protected]> on 2021-11-11
Reviewed by Adrian Perez de Castro.

Port the changes landed in r272712 for the webkit-bwrap script, which we can't directly use
within webkit-flatpak-run-nightly because it's nice to keep it as standalone as possible.

* Scripts/webkit-flatpak-run-nightly:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (285624 => 285625)


--- trunk/Tools/ChangeLog	2021-11-11 12:24:18 UTC (rev 285624)
+++ trunk/Tools/ChangeLog	2021-11-11 14:32:47 UTC (rev 285625)
@@ -1,3 +1,15 @@
+2021-11-11  Philippe Normand  <[email protected]>
+
+        [GTK][WPE] webkit-flatpak-run-nightly infinite self-call loop
+        https://bugs.webkit.org/show_bug.cgi?id=230400
+
+        Reviewed by Adrian Perez de Castro.
+
+        Port the changes landed in r272712 for the webkit-bwrap script, which we can't directly use
+        within webkit-flatpak-run-nightly because it's nice to keep it as standalone as possible.
+
+        * Scripts/webkit-flatpak-run-nightly:
+
 2021-11-10  Chris Dumez  <[email protected]>
 
         We should not kill all WebContent processes whenever the WebAuthn process crashes

Modified: trunk/Tools/Scripts/webkit-flatpak-run-nightly (285624 => 285625)


--- trunk/Tools/Scripts/webkit-flatpak-run-nightly	2021-11-11 12:24:18 UTC (rev 285624)
+++ trunk/Tools/Scripts/webkit-flatpak-run-nightly	2021-11-11 14:32:47 UTC (rev 285625)
@@ -29,7 +29,7 @@
 from html.parser import HTMLParser
 
 REPO = "https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo"
-SDK_BRANCH = "0.3"
+SDK_BRANCH = "21.08"
 USER_DIR = os.path.expanduser("~/.cache/wk-nightly")
 
 def spinning_cursor():
@@ -58,12 +58,12 @@
     branch = SDK_BRANCH
     if not os.path.isdir(USER_DIR):
         flatpak("remote-add", "--user", "webkit-nightly", REPO)
-        flatpak("install", "--user", "-y", f"org.webkit.Platform//{branch}")
+        flatpak("install", "--user", "-y", "webkit-nightly", f"org.webkit.Platform//{branch}")
     else:
         flatpak("update", "--user", "-y")
     if (build_type == "Debug") and (flatpak("info", "org.webkit.Sdk.Debug", stdout=subprocess.DEVNULL) >= 1):
-        flatpak("install", "--user", "-y", f"org.webkit.Sdk//{branch}")
-        flatpak("install", "--user", "-y", f"org.webkit.Sdk.Debug//{branch}")
+        flatpak("install", "--user", "-y", "webkit-nightly", f"org.webkit.Sdk//{branch}")
+        flatpak("install", "--user", "-y", "webkit-nightly", f"org.webkit.Sdk.Debug//{branch}")
 
 def get_build_path(platform, build_type, revision_number):
     dirname = f"{platform}-{build_type}-r{revision_number}"
@@ -137,7 +137,7 @@
             "--talk-name=org.freedesktop.Flatpak",
             "--talk-name=org.gtk.vfs",
             "--talk-name=org.gtk.vfs.*",
-            f"--command={args[0]}", "org.webkit.Platform", *args[1:], env=env)
+            f"--command={args[0]}", f"org.webkit.Platform//{SDK_BRANCH}", *args[1:], env=env)
 
 def main(args):
     parser = argparse.ArgumentParser()
@@ -171,12 +171,42 @@
     if parsed.path:
         run(parsed.path, parsed.build_type, parsed.command)
 
+def read_lines(fd: int):
+    new_fd = os.dup(fd)
+    pos = os.lseek(fd, 0, os.SEEK_CUR)
+    try:
+        with os.fdopen(new_fd, 'r') as handle:
+            data = ""
+            lines = data.split('\x00')
+            for line in lines:
+                yield line
+    except Exception as e:
+        print("Error reading bwrap arguments", file=sys.stderr)
+        print(e, file=sys.stderr)
+    finally:
+        os.lseek(fd, pos, os.SEEK_SET)
+
 def bwrap_main(args):
     bind_mounts = {
         "/run/shm": "/dev/shm",
     }
 
-    build_path = os.environ.get("WEBKIT_BUILD_DIR_BIND_MOUNT")
+    args_idx = args.index('--args')
+    arg_fd = int(args[args_idx + 1])
+    lines = read_lines(arg_fd)
+
+    environ = os.environ.copy()
+    while True:
+        try:
+            arg = next(lines)
+            if arg == '--setenv':
+                key = next(lines)
+                value = next(lines)
+                environ[key] = value
+        except StopIteration:
+            break
+
+    build_path = environ.get("WEBKIT_BUILD_DIR_BIND_MOUNT")
     if build_path:
         dest, src = ""
         bind_mounts[dest] = src
@@ -189,7 +219,7 @@
 
 if __name__ == "__main__":
     ld_library_path = os.environ.get("LD_LIBRARY_PATH", "")
-    if ld_library_path.startswith("/app") or "WEBKIT_BUILD_DIR_BIND_MOUNT" in os.environ:
+    if '--args' in sys.argv:
         bwrap_main(sys.argv[1:])
     else:
         main(sys.argv[1:])
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to