brizental pushed to branch tor-browser-147.0a1-16.0-2 at The Tor Project / Applications / Tor Browser Commits: b447dfc5 by Beatriz Rizental at 2026-01-26T11:21:23-03:00 fixup! BB 43564: Modify ./mach bootstrap for Base Browser Generalize extension symlinking code. - - - - - 3 changed files: - build/moz.configure/basebrowser-resources.configure - build/moz.configure/bootstrap.configure - python/mozbuild/mozbuild/backend/base.py Changes: ===================================== build/moz.configure/basebrowser-resources.configure ===================================== @@ -27,7 +27,7 @@ option( "noscript", no_unpack=True, when=depends("--with-noscript")(lambda x: not x) ), ) -@checking("for noscript") +@checking("for noscript extension") @imports(_from="pathlib", _import="Path") def noscript(value, mozbuild_state_path, _bootstrapped): if value: ===================================== build/moz.configure/bootstrap.configure ===================================== @@ -197,8 +197,8 @@ def bootstrap_path(path, **kwargs): if path_parts[0] == "clang-tools": path_prefix = path_parts.pop(0) - # Small hack because noscript is inside the browser folder. - if path_parts[0] == "noscript": + # Small hack because extensions are inside the browser folder. + if path_parts[0] in ("noscript", ): path_prefix = "browser" def try_tbb_bootstrap(exists): ===================================== python/mozbuild/mozbuild/backend/base.py ===================================== @@ -243,29 +243,42 @@ class BuildBackend(LoggingMixin): with open(mozpath.join(dir, ".purgecaches"), "w") as f: f.write("\n") - def _setup_tor_browser_environment(self, config): + def _create_or_replace_symlink(self, src, dst): + try: + os.symlink(src, dst) + except OSError as e: + if e.errno == errno.EEXIST: + # If the symlink already exists, remove it and try again. + os.remove(dst) + os.symlink(src, dst) + else: + return + + def _setup_extension_symlink(self, location, target_filename, exts_path): + if not location: + return + + target = exts_path / target_filename + + self.log( + logging.INFO, + "_setup_extension_symlink", + { + "location": location, + "target": str(target), + }, + "Creating symlink for extension from {location} to {target}", + ) + + exts_path.mkdir(parents=True, exist_ok=True) + self._create_or_replace_symlink(location, target) + + def _setup_base_browser_environment(self, config): app = config.substs["MOZ_BUILD_APP"] noscript_target_filename = "{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi" noscript_location = config.substs.get("NOSCRIPT") - def _infallible_symlink(src, dst): - try: - os.symlink(src, dst) - except OSError as e: - if e.errno == errno.EEXIST: - # If the symlink already exists, remove it and try again. - os.remove(dst) - os.symlink(src, dst) - else: - self.log( - logging.ERROR, - "_setup_tor_browser_environment", - {}, - "Error creating symlink.", - ) - return - if app == "mobile/android": # Set up NoScript extension # We put it in the srcdir... It will be moved to the APK in the gradle build. @@ -312,7 +325,7 @@ class BuildBackend(LoggingMixin): if fonts_location: self.log( logging.INFO, - "_setup_tor_browser_environment", + "_setup_base_browser_environment", { "fonts_location": fonts_location, "fonts_target": str(paths["fonts"]), @@ -322,23 +335,13 @@ class BuildBackend(LoggingMixin): for file in Path(fonts_location).iterdir(): target = paths["fonts"] / file.name - _infallible_symlink(file, target) + self._create_or_replace_symlink(file, target) - # Set up NoScript extension - if noscript_location: - noscript_target = paths["exts"] / noscript_target_filename - self.log( - logging.INFO, - "_setup_tor_browser_environment", - { - "noscript_location": noscript_location, - "noscript_target": str(noscript_target), - }, - "Creating symlink for NoScript from {noscript_location} to {noscript_target}", - ) - - paths["exts"].mkdir(parents=True, exist_ok=True) - _infallible_symlink(noscript_location, noscript_target) + self._setup_extension_symlink( + noscript_location, + noscript_target_filename, + paths["exts"], + ) expert_bundle_location = config.substs.get("TOR_EXPERT_BUNDLE") if expert_bundle_location: @@ -417,7 +420,7 @@ class BuildBackend(LoggingMixin): self._write_purgecaches(config) if status == 0: - self._setup_tor_browser_environment(config) + self._setup_base_browser_environment(config) return status View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/b447dfc5... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/b447dfc5... You're receiving this email because of your account on gitlab.torproject.org.