Changeset 261909 in webkit
- Timestamp:
- May 20, 2020 1:37:13 AM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r261903 r261909 1 2020-05-20 Philippe Normand <pnormand@igalia.com> 2 3 [Flatpak SDK] Add bubblewrap ... wrapper 4 https://bugs.webkit.org/show_bug.cgi?id=212077 5 6 Reviewed by Carlos Alberto Lopez Perez. 7 8 The bind-mounts are now handled through webkit-bwrap. 9 10 * flatpak/flatpakutils.py: 11 (WebkitFlatpak.execute_command): 12 (WebkitFlatpak.run_in_sandbox): 13 * flatpak/webkit-bwrap: Added. 14 1 15 2020-05-19 Darin Adler <darin@apple.com> 2 16 -
trunk/Tools/flatpak/flatpakutils.py
r261879 r261909 488 488 self.sccache_scheduler = DEFAULT_SCCACHE_SCHEDULER 489 489 490 def execute_command(self, args, stdout=None, stderr=None ):490 def execute_command(self, args, stdout=None, stderr=None, env=None): 491 491 _log.debug('Running in sandbox: %s\n' % ' '.join(args)) 492 492 result = 0 493 493 try: 494 result = subprocess.check_call(args, stdout=stdout, stderr=stderr )494 result = subprocess.check_call(args, stdout=stdout, stderr=stderr, env=env) 495 495 except subprocess.CalledProcessError as err: 496 496 if self.verbose: … … 652 652 building = False 653 653 654 # FIXME: Using the `run` flatpak command would be better, but it doesn't 655 # have a --bind-mount option. 656 flatpak_command = ["flatpak", "build", 657 "--die-with-parent", 654 flatpak_command = ["flatpak", "run", 655 "--devel", 658 656 "--talk-name=org.a11y.Bus", 659 657 "--talk-name=org.gtk.vfs", 660 "--talk-name=org.gtk.vfs.*", 661 "--bind-mount=/run/shm=/dev/shm", 662 # Access to /run/host is required by the crash log reporter. 663 "--bind-mount=/run/host/%s=%s" % (tempfile.gettempdir(), tempfile.gettempdir()), 664 # flatpak build doesn't expose a --socket option for 665 # white-listing the systemd journal socket. So 666 # white-list it in /run, hoping this is the right 667 # path. 668 "--bind-mount=/run/systemd/journal=/run/systemd/journal", 669 "--bind-mount=%s=%s" % (self.sandbox_source_root, self.source_root)] 658 "--talk-name=org.gtk.vfs.*"] 670 659 671 660 if args and args[0].endswith("build-webkit") and not self.is_branch_build(): … … 676 665 if e.errno != errno.EEXIST: 677 666 raise e 678 679 # We mount WebKitBuild/PORTNAME/BuildType to /app/webkit/WebKitBuild/BuildType680 # so we can build WPE and GTK in a same source tree.681 # The bind-mount is always needed, excepted during the initial setup (SDK install/updates).682 if os.path.isdir(self.build_path):683 flatpak_command.append("--bind-mount=%s=%s" % (sandbox_build_path, self.build_path))684 667 685 668 if not building: … … 696 679 "--system-talk-name=org.a11y.Bus", 697 680 "--system-talk-name=org.freedesktop.GeoClue2", 698 "--talk-name=org.a11y.Bus",699 681 "--talk-name=org.freedesktop.Flatpak" 700 682 ]) 701 702 xdg_runtime_dir = os.environ.get('XDG_RUNTIME_DIR', None)703 if not xdg_runtime_dir:704 _log.debug('XDG_RUNTIME_DIR not set. Trying default location.')705 try:706 with open(os.devnull, 'w') as devnull:707 uid = subprocess.check_output(("id", "-u"), stderr=devnull).decode().strip()708 xdg_runtime_dir = '/run/user/{uid}'.format(uid=uid)709 except subprocess.CalledProcessError:710 _log.debug("Could not determine XDG_RUNIME_DIR. This may cause bubblewrap to fail.")711 712 if xdg_runtime_dir:713 uid_doc_path = os.path.join(xdg_runtime_dir, 'doc')714 if os.path.exists(uid_doc_path):715 flatpak_command.append("--bind-mount={uid_doc_path}={uid_doc_path}".format(uid_doc_path=uid_doc_path))716 else:717 _log.debug("Can't find user document path at '{uid_doc_path}'. Not mounting it.".format(uid_doc_path=uid_doc_path))718 719 coredumps_dir = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY")720 if coredumps_dir and os.path.isdir(coredumps_dir):721 flatpak_command.append("--bind-mount={coredumps_dir}={coredumps_dir}".format(coredumps_dir=coredumps_dir))722 683 723 684 sandbox_environment.update({ … … 797 758 if share_network_option not in flatpak_command: 798 759 flatpak_command.append(share_network_option) 799 flatpak_command.append("--bind-mount=/var/run/icecc=/var/run/icecc")800 760 801 761 n_cores = multiprocessing.cpu_count() * 3 … … 808 768 sandbox_environment.update({ 809 769 "CCACHE_PREFIX": "icecc", 770 "ICECC_TEST_SOCKET": "/run/icecc/iceccd.socket", 810 771 "ICECC_VERSION": toolchain_path, 811 772 "NUMBER_OF_PROCESSORS": n_cores, … … 819 780 gst_env = self.setup_gstbuild(building) 820 781 821 flatpak_command += extra_flatpak_args + [self.flatpak_build_path] + gst_env + args 782 flatpak_command += extra_flatpak_args + gst_env + ['--command="%s"' % args[0], "org.webkit.Sdk"] + args[1:] 783 784 flatpak_env = os.environ 785 flatpak_env.update({ 786 "FLATPAK_BWRAP": os.path.join(scriptdir, "webkit-bwrap"), 787 "WEBKIT_BUILD_DIR_BIND_MOUNT": "%s:%s" % (sandbox_build_path, self.build_path) 788 }) 822 789 823 790 try: 824 return self.execute_command(flatpak_command, stdout=stdout )791 return self.execute_command(flatpak_command, stdout=stdout, env=flatpak_env) 825 792 except KeyboardInterrupt: 826 793 return 0
Note: See TracChangeset
for help on using the changeset viewer.