Changeset 262057 in webkit
- Timestamp:
- May 22, 2020 7:58:41 AM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r262052 r262057 1 2020-05-22 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-22 Javier Fernandez <jfernandez@igalia.com> 2 16 -
trunk/Tools/flatpak/flatpakutils.py
r262052 r262057 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: … … 639 639 } 640 640 641 if not args: 642 args.append("bash") 643 641 644 if args: 642 645 if os.path.exists(args[0]): … … 652 655 building = False 653 656 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 flatpak_command = ["flatpak", "run", 657 658 "--die-with-parent", 659 "--allow=devel", 658 660 "--talk-name=org.a11y.Bus", 659 661 "--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)] 662 "--talk-name=org.gtk.vfs.*"] 670 663 671 664 if args and args[0].endswith("build-webkit") and not self.is_branch_build(): … … 676 669 if e.errno != errno.EEXIST: 677 670 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 671 685 672 if not building: … … 696 683 "--system-talk-name=org.a11y.Bus", 697 684 "--system-talk-name=org.freedesktop.GeoClue2", 698 "--talk-name=org.a11y.Bus",699 685 "--talk-name=org.freedesktop.Flatpak" 700 686 ]) 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 687 723 688 sandbox_environment.update({ … … 798 763 if share_network_option not in flatpak_command: 799 764 flatpak_command.append(share_network_option) 800 flatpak_command.append("--bind-mount=/var/run/icecc=/var/run/icecc")801 765 802 766 n_cores = multiprocessing.cpu_count() * 3 … … 809 773 sandbox_environment.update({ 810 774 "CCACHE_PREFIX": "icecc", 775 "ICECC_TEST_SOCKET": "/run/icecc/iceccd.socket", 811 776 "ICECC_VERSION": toolchain_path, 812 777 "NUMBER_OF_PROCESSORS": n_cores, … … 820 785 gst_env = self.setup_gstbuild(building) 821 786 822 flatpak_command += extra_flatpak_args + [self.flatpak_build_path] + gst_env + args 787 flatpak_command += extra_flatpak_args + gst_env + ['--command=%s' % args[0], "org.webkit.Sdk"] + args[1:] 788 789 flatpak_env = os.environ 790 flatpak_env.update({ 791 "FLATPAK_BWRAP": os.path.join(scriptdir, "webkit-bwrap"), 792 "WEBKIT_BUILD_DIR_BIND_MOUNT": "%s:%s" % (sandbox_build_path, self.build_path) 793 }) 823 794 824 795 try: 825 return self.execute_command(flatpak_command, stdout=stdout )796 return self.execute_command(flatpak_command, stdout=stdout, env=flatpak_env) 826 797 except KeyboardInterrupt: 827 798 return 0
Note: See TracChangeset
for help on using the changeset viewer.