Title: [261917] trunk/Tools
Revision
261917
Author
[email protected]
Date
2020-05-20 07:32:08 -0700 (Wed, 20 May 2020)

Log Message

Unreviewed, reverting r261909.

Execution of LayoutTests returns syntax error in the bots (GTK, WPE)

Reverted changeset:

"[Flatpak SDK] Add bubblewrap ... wrapper"
https://bugs.webkit.org/show_bug.cgi?id=212077
https://trac.webkit.org/changeset/261909

Modified Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (261916 => 261917)


--- trunk/Tools/ChangeLog	2020-05-20 14:24:02 UTC (rev 261916)
+++ trunk/Tools/ChangeLog	2020-05-20 14:32:08 UTC (rev 261917)
@@ -1,3 +1,15 @@
+2020-05-20  Diego Pino Garcia  <[email protected]>
+
+        Unreviewed, reverting r261909.
+
+        Execution of LayoutTests returns syntax error in the bots (GTK, WPE)
+
+        Reverted changeset:
+
+        "[Flatpak SDK] Add bubblewrap ... wrapper"
+        https://bugs.webkit.org/show_bug.cgi?id=212077
+        https://trac.webkit.org/changeset/261909
+
 2020-05-20  Philippe Normand  <[email protected]>
 
         [Flatpak SDK] Bump rr and bst

Modified: trunk/Tools/flatpak/flatpakutils.py (261916 => 261917)


--- trunk/Tools/flatpak/flatpakutils.py	2020-05-20 14:24:02 UTC (rev 261916)
+++ trunk/Tools/flatpak/flatpakutils.py	2020-05-20 14:32:08 UTC (rev 261917)
@@ -487,11 +487,11 @@
         self.sccache_token = ""
         self.sccache_scheduler = DEFAULT_SCCACHE_SCHEDULER
 
-    def execute_command(self, args, stdout=None, stderr=None, env=None):
+    def execute_command(self, args, stdout=None, stderr=None):
         _log.debug('Running in sandbox: %s\n' % ' '.join(args))
         result = 0
         try:
-            result = subprocess.check_call(args, stdout=stdout, stderr=stderr, env=env)
+            result = subprocess.check_call(args, stdout=stdout, stderr=stderr)
         except subprocess.CalledProcessError as err:
             if self.verbose:
                 cmd = ' '.join(err.cmd)
@@ -651,11 +651,22 @@
         else:
             building = False
 
-        flatpak_command = ["flatpak", "run",
-                           "--devel",
+        # FIXME: Using the `run` flatpak command would be better, but it doesn't
+        # have a --bind-mount option.
+        flatpak_command = ["flatpak", "build",
+                           "--die-with-parent",
                            "--talk-name=org.a11y.Bus",
                            "--talk-name=org.gtk.vfs",
-                           "--talk-name=org.gtk.vfs.*"]
+                           "--talk-name=org.gtk.vfs.*",
+                           "--bind-mount=/run/shm=/dev/shm",
+                           # Access to /run/host is required by the crash log reporter.
+                           "--bind-mount=/run/host/%s=%s" % (tempfile.gettempdir(), tempfile.gettempdir()),
+                           # flatpak build doesn't expose a --socket option for
+                           # white-listing the systemd journal socket. So
+                           # white-list it in /run, hoping this is the right
+                           # path.
+                           "--bind-mount=/run/systemd/journal=/run/systemd/journal",
+                           "--bind-mount=%s=%s" % (self.sandbox_source_root, self.source_root)]
 
         if args and args[0].endswith("build-webkit") and not self.is_branch_build():
             # Ensure self.build_path exists.
@@ -665,6 +676,12 @@
                 if e.errno != errno.EEXIST:
                     raise e
 
+        # We mount WebKitBuild/PORTNAME/BuildType to /app/webkit/WebKitBuild/BuildType
+        # so we can build WPE and GTK in a same source tree.
+        # The bind-mount is always needed, excepted during the initial setup (SDK install/updates).
+        if os.path.isdir(self.build_path):
+            flatpak_command.append("--bind-mount=%s=%s" % (sandbox_build_path, self.build_path))
+
         if not building:
             flatpak_command.extend([
                 "--device=all",
@@ -678,9 +695,31 @@
                 "--socket=x11",
                 "--system-talk-name=org.a11y.Bus",
                 "--system-talk-name=org.freedesktop.GeoClue2",
+                "--talk-name=org.a11y.Bus",
                 "--talk-name=org.freedesktop.Flatpak"
             ])
 
+            xdg_runtime_dir = os.environ.get('XDG_RUNTIME_DIR', None)
+            if not xdg_runtime_dir:
+                _log.debug('XDG_RUNTIME_DIR not set. Trying default location.')
+                try:
+                    with open(os.devnull, 'w') as devnull:
+                        uid = subprocess.check_output(("id", "-u"), stderr=devnull).decode().strip()
+                        xdg_runtime_dir = '/run/user/{uid}'.format(uid=uid)
+                except subprocess.CalledProcessError:
+                    _log.debug("Could not determine XDG_RUNIME_DIR. This may cause bubblewrap to fail.")
+
+            if xdg_runtime_dir:
+                uid_doc_path = os.path.join(xdg_runtime_dir, 'doc')
+                if os.path.exists(uid_doc_path):
+                    flatpak_command.append("--bind-mount={uid_doc_path}={uid_doc_path}".format(uid_doc_path=uid_doc_path))
+                else:
+                    _log.debug("Can't find user document path at '{uid_doc_path}'. Not mounting it.".format(uid_doc_path=uid_doc_path))
+
+            coredumps_dir = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY")
+            if coredumps_dir and os.path.isdir(coredumps_dir):
+                flatpak_command.append("--bind-mount={coredumps_dir}={coredumps_dir}".format(coredumps_dir=coredumps_dir))
+
             sandbox_environment.update({
                 "TZ": "PST8PDT",
                 "LANG": "en_US.UTF-8",
@@ -757,6 +796,7 @@
             _log.debug('Enabling the icecream compiler')
             if share_network_option not in flatpak_command:
                 flatpak_command.append(share_network_option)
+            flatpak_command.append("--bind-mount=/var/run/icecc=/var/run/icecc")
 
             n_cores = multiprocessing.cpu_count() * 3
             _log.debug('Following icecream recommendation for the number of cores to use: %d' % n_cores)
@@ -767,7 +807,6 @@
                 return 1
             sandbox_environment.update({
                 "CCACHE_PREFIX": "icecc",
-                "ICECC_TEST_SOCKET": "/run/icecc/iceccd.socket",
                 "ICECC_VERSION": toolchain_path,
                 "NUMBER_OF_PROCESSORS": n_cores,
             })
@@ -779,16 +818,10 @@
         if not kwargs.get('building_gst'):
             gst_env = self.setup_gstbuild(building)
 
-        flatpak_command += extra_flatpak_args + gst_env + ['--command="%s"' % args[0], "org.webkit.Sdk"] + args[1:]
+        flatpak_command += extra_flatpak_args + [self.flatpak_build_path] + gst_env + args
 
-        flatpak_env = os.environ
-        flatpak_env.update({
-            "FLATPAK_BWRAP": os.path.join(scriptdir, "webkit-bwrap"),
-            "WEBKIT_BUILD_DIR_BIND_MOUNT": "%s:%s" % (sandbox_build_path, self.build_path)
-        })
-
         try:
-            return self.execute_command(flatpak_command, stdout=stdout, env=flatpak_env)
+            return self.execute_command(flatpak_command, stdout=stdout)
         except KeyboardInterrupt:
             return 0
 

Deleted: trunk/Tools/flatpak/webkit-bwrap (261916 => 261917)


--- trunk/Tools/flatpak/webkit-bwrap	2020-05-20 14:24:02 UTC (rev 261916)
+++ trunk/Tools/flatpak/webkit-bwrap	2020-05-20 14:32:08 UTC (rev 261917)
@@ -1,59 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# Copyright (C) 2020 Igalia S.L.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-import os
-import subprocess
-import sys
-import tempfile
-
-scriptdir = os.path.abspath(os.path.dirname(__file__))
-
-def main(args: list) -> int:
-    tmpdir = tempfile.gettempdir()
-    source_root = os.path.normpath(os.path.abspath(os.path.join(scriptdir, '../../')))
-    bind_mounts = {
-        "/app/webkit":  source_root,
-        # Access to /run/host is required by the crash log reporter.
-        f"/run/host{tmpdir}": f"{tmpdir}"
-    }
-
-    try_bind_mounts = {
-        "/run/icecc": "/var/run/icecc"
-    }
-
-    build_path = os.environ.get("WEBKIT_BUILD_DIR_BIND_MOUNT")
-    if build_path:
-        dest, src = ""
-        try_bind_mounts[dest] = src
-
-    coredumps_dir = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY")
-    if coredumps_dir:
-        try_bind_mounts[coredumps_dir] = coredumps_dir
-
-    bwrap_args = []
-    for dest, src in bind_mounts.items():
-        bwrap_args.append(f"--bind {src} {dest}")
-
-    for dest, src in try_bind_mounts.items():
-        bwrap_args.append(f"--bind-try {src} {dest}")
-
-    return os.system("bwrap " + ' '.join(bwrap_args + args))
-
-if __name__ == "__main__":
-    sys.exit(main(sys.argv[1:]))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to