[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-147.0a1-16.0-2] fixup! BB 43564: Modify ./mach bootstrap for Base Browser



Title: GitLab

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:

Changes:

  • build/moz.configure/basebrowser-resources.configure
    ... ... @@ -27,7 +27,7 @@ option(
    27 27
             "noscript", no_unpack=True, when=depends("--with-noscript")(lambda x: not x)
    
    28 28
         ),
    
    29 29
     )
    
    30
    -@checking("for noscript")
    
    30
    +@checking("for noscript extension")
    
    31 31
     @imports(_from="pathlib", _import="Path")
    
    32 32
     def noscript(value, mozbuild_state_path, _bootstrapped):
    
    33 33
         if value:
    

  • build/moz.configure/bootstrap.configure
    ... ... @@ -197,8 +197,8 @@ def bootstrap_path(path, **kwargs):
    197 197
             if path_parts[0] == "clang-tools":
    
    198 198
                 path_prefix = path_parts.pop(0)
    
    199 199
     
    
    200
    -        # Small hack because noscript is inside the browser folder.
    
    201
    -        if path_parts[0] == "noscript":
    
    200
    +        # Small hack because extensions are inside the browser folder.
    
    201
    +        if path_parts[0] in ("noscript", ):
    
    202 202
                 path_prefix = "browser"
    
    203 203
     
    
    204 204
             def try_tbb_bootstrap(exists):
    

  • python/mozbuild/mozbuild/backend/base.py
    ... ... @@ -243,29 +243,42 @@ class BuildBackend(LoggingMixin):
    243 243
                 with open(mozpath.join(dir, ".purgecaches"), "w") as f:
    
    244 244
                     f.write("\n")
    
    245 245
     
    
    246
    -    def _setup_tor_browser_environment(self, config):
    
    246
    +    def _create_or_replace_symlink(self, src, dst):
    
    247
    +        try:
    
    248
    +            os.symlink(src, dst)
    
    249
    +        except OSError as e:
    
    250
    +            if e.errno == errno.EEXIST:
    
    251
    +                # If the symlink already exists, remove it and try again.
    
    252
    +                os.remove(dst)
    
    253
    +                os.symlink(src, dst)
    
    254
    +            else:
    
    255
    +                return
    
    256
    +
    
    257
    +    def _setup_extension_symlink(self, location, target_filename, exts_path):
    
    258
    +        if not location:
    
    259
    +            return
    
    260
    +
    
    261
    +        target = exts_path / target_filename
    
    262
    +
    
    263
    +        self.log(
    
    264
    +            logging.INFO,
    
    265
    +            "_setup_extension_symlink",
    
    266
    +            {
    
    267
    +                "location": location,
    
    268
    +                "target": str(target),
    
    269
    +            },
    
    270
    +            "Creating symlink for extension from {location} to {target}",
    
    271
    +        )
    
    272
    +
    
    273
    +        exts_path.mkdir(parents=True, exist_ok=True)
    
    274
    +        self._create_or_replace_symlink(location, target)
    
    275
    +
    
    276
    +    def _setup_base_browser_environment(self, config):
    
    247 277
             app = config.substs["MOZ_BUILD_APP"]
    
    248 278
     
    
    249 279
             noscript_target_filename = "{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
    
    250 280
             noscript_location = config.substs.get("NOSCRIPT")
    
    251 281
     
    
    252
    -        def _infallible_symlink(src, dst):
    
    253
    -            try:
    
    254
    -                os.symlink(src, dst)
    
    255
    -            except OSError as e:
    
    256
    -                if e.errno == errno.EEXIST:
    
    257
    -                    # If the symlink already exists, remove it and try again.
    
    258
    -                    os.remove(dst)
    
    259
    -                    os.symlink(src, dst)
    
    260
    -                else:
    
    261
    -                    self.log(
    
    262
    -                        logging.ERROR,
    
    263
    -                        "_setup_tor_browser_environment",
    
    264
    -                        {},
    
    265
    -                        "Error creating symlink.",
    
    266
    -                    )
    
    267
    -                    return
    
    268
    -
    
    269 282
             if app == "mobile/android":
    
    270 283
                 # Set up NoScript extension
    
    271 284
                 # We put it in the srcdir... It will be moved to the APK in the gradle build.
    
    ... ... @@ -312,7 +325,7 @@ class BuildBackend(LoggingMixin):
    312 325
                 if fonts_location:
    
    313 326
                     self.log(
    
    314 327
                         logging.INFO,
    
    315
    -                    "_setup_tor_browser_environment",
    
    328
    +                    "_setup_base_browser_environment",
    
    316 329
                         {
    
    317 330
                             "fonts_location": fonts_location,
    
    318 331
                             "fonts_target": str(paths["fonts"]),
    
    ... ... @@ -322,23 +335,13 @@ class BuildBackend(LoggingMixin):
    322 335
     
    
    323 336
                     for file in Path(fonts_location).iterdir():
    
    324 337
                         target = paths["fonts"] / file.name
    
    325
    -                    _infallible_symlink(file, target)
    
    338
    +                    self._create_or_replace_symlink(file, target)
    
    326 339
     
    
    327
    -            # Set up NoScript extension
    
    328
    -            if noscript_location:
    
    329
    -                noscript_target = paths["exts"] / noscript_target_filename
    
    330
    -                self.log(
    
    331
    -                    logging.INFO,
    
    332
    -                    "_setup_tor_browser_environment",
    
    333
    -                    {
    
    334
    -                        "noscript_location": noscript_location,
    
    335
    -                        "noscript_target": str(noscript_target),
    
    336
    -                    },
    
    337
    -                    "Creating symlink for NoScript from {noscript_location} to {noscript_target}",
    
    338
    -                )
    
    339
    -
    
    340
    -                paths["exts"].mkdir(parents=True, exist_ok=True)
    
    341
    -                _infallible_symlink(noscript_location, noscript_target)
    
    340
    +            self._setup_extension_symlink(
    
    341
    +                noscript_location,
    
    342
    +                noscript_target_filename,
    
    343
    +                paths["exts"],
    
    344
    +            )
    
    342 345
     
    
    343 346
                 expert_bundle_location = config.substs.get("TOR_EXPERT_BUNDLE")
    
    344 347
                 if expert_bundle_location:
    
    ... ... @@ -417,7 +420,7 @@ class BuildBackend(LoggingMixin):
    417 420
             self._write_purgecaches(config)
    
    418 421
     
    
    419 422
             if status == 0:
    
    420
    -            self._setup_tor_browser_environment(config)
    
    423
    +            self._setup_base_browser_environment(config)
    
    421 424
     
    
    422 425
             return status
    
    423 426
     
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx