brizental pushed to branch tor-browser-140.4.0esr-15.0-1 at The Tor Project / Applications / Tor Browser

Commits:

4 changed files:

Changes:

  • build/moz.configure/bootstrap.configure
    ... ... @@ -221,11 +221,9 @@ def bootstrap_path(path, **kwargs):
    221 221
                     log.info("no path found in tbb/out for %s", artifact)
    
    222 222
                     return False
    
    223 223
     
    
    224
    -            # We will use the name of the artifact as the index.
    
    225
    -            #
    
    226
    -            # It's usually unique to the artifact version, but each artifact follows
    
    227
    -            # a different naming convention, so we can't really get more specific here.
    
    228
    -            artifact_index = artifact_path.rsplit("/", 1)[-1]
    
    224
    +            artifact_index = mozbuild.tbbutils.get_artifact_index(
    
    225
    +                artifact_path, artifact
    
    226
    +            )
    
    229 227
                 index_file = os.path.join(toolchains_base_dir, "indices", artifact)
    
    230 228
                 try:
    
    231 229
                     with open(index_file) as fh:
    

  • python/mozbuild/mozbuild/backend/base.py
    ... ... @@ -329,7 +329,7 @@ class BuildBackend(LoggingMixin):
    329 329
     
    
    330 330
                     # Set up Tor configuration files
    
    331 331
                     paths["tor_config"].mkdir(parents=True, exist_ok=True)
    
    332
    -                for file in ["geoip", "geoip6"]:
    
    332
    +                for file in ["geoip", "geoip6", "torrc-defaults"]:
    
    333 333
                         target = paths["tor_config"] / file
    
    334 334
                         _infallible_symlink(expert_bundle_location / "data" / file, target)
    
    335 335
     
    

  • python/mozbuild/mozbuild/tbbutils.py
    ... ... @@ -18,7 +18,7 @@ def list_files_http(url):
    18 18
                 continue
    
    19 19
     
    
    20 20
             if "tor-expert-bundle" in href:
    
    21
    -            href = f"{href}/tor-expert-bundle.tar.gz"
    
    21
    +            href = f"{href.rstrip('/')}/tor-expert-bundle.tar.gz"
    
    22 22
     
    
    23 23
             links.append(href)
    
    24 24
     
    
    ... ... @@ -45,6 +45,22 @@ ARTIFACT_NAME_MAP = {
    45 45
     }
    
    46 46
     
    
    47 47
     
    
    48
    +def get_artifact_index(artifact_path, artifact):
    
    49
    +    """
    
    50
    +    Return a unique identifier for the given artifact based on its path.
    
    51
    +
    
    52
    +    In most cases, artifacts built by tor-browser-build include part of their
    
    53
    +    SHA sum or version in the filename, so the file name itself serves as a unique
    
    54
    +    identifier. However, some artifacts are stored within subfolders where the file
    
    55
    +    name alone is not unique — in those cases, the name of the parent directory
    
    56
    +    provides the unique identifier instead.
    
    57
    +    """
    
    58
    +    if artifact in ["tor-expert-bundle"]:
    
    59
    +        return artifact_path.rsplit("/", 2)[-2]
    
    60
    +
    
    61
    +    return artifact_path.rsplit("/", 1)[-1]
    
    62
    +
    
    63
    +
    
    48 64
     def get_artifact_name(original_artifact_name, host):
    
    49 65
         # These are not build artifacts, they are pre-built artifacts to be added to the final build,
    
    50 66
         # therefore this check can come before the host check.
    

  • python/mozbuild/mozbuild/test/test_tbbutils.py
    ... ... @@ -4,7 +4,7 @@ from unittest.mock import MagicMock, patch
    4 4
     
    
    5 5
     import mozunit
    
    6 6
     
    
    7
    -from mozbuild.tbbutils import get_artifact_path, list_files_http
    
    7
    +from mozbuild.tbbutils import get_artifact_index, get_artifact_path, list_files_http
    
    8 8
     
    
    9 9
     
    
    10 10
     class TestGetArtifactName(unittest.TestCase):
    
    ... ... @@ -34,6 +34,20 @@ class TestGetArtifactName(unittest.TestCase):
    34 34
             self.assertEqual(result, self.artifact[::-1])
    
    35 35
     
    
    36 36
     
    
    37
    +class TestGetArtifactIndex(unittest.TestCase):
    
    38
    +    def test_regular_artifact(self):
    
    39
    +        artifact = "tor"
    
    40
    +        path = "https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out/tor/tor-b1f9824464dc-linux-x86_64-b0ffe2.tar.gz"
    
    41
    +        expected = "tor-b1f9824464dc-linux-x86_64-b0ffe2.tar.gz"
    
    42
    +        self.assertEqual(get_artifact_index(path, artifact), expected)
    
    43
    +
    
    44
    +    def test_expert_bundle_artifact(self):
    
    45
    +        artifact = "tor-expert-bundle"
    
    46
    +        path = "https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out/tor-expert-bundle/tor-expert-bundle-linux-x86_64-tbb-nightly.2025.10.14-d9aa09/"
    
    47
    +        expected = "tor-expert-bundle-linux-x86_64-tbb-nightly.2025.10.14-d9aa09"
    
    48
    +        self.assertEqual(get_artifact_index(path, artifact), expected)
    
    49
    +
    
    50
    +
    
    37 51
     class TestGetArtifactPath(unittest.TestCase):
    
    38 52
         def setUp(self):
    
    39 53
             self.url = "http://example.com"