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


Commits:
5a5ae016 by Beatriz Rizental at 2025-10-14T15:56:06+02:00
fixup! BB 43564: Modify ./mach bootstrap for Base Browser

- - - - -
8118ce43 by Beatriz Rizental at 2025-10-14T15:56:33+02:00
fixup! TB 43564: Modify ./mach bootstrap for Tor Browser

- - - - -


4 changed files:

- build/moz.configure/bootstrap.configure
- python/mozbuild/mozbuild/backend/base.py
- python/mozbuild/mozbuild/tbbutils.py
- python/mozbuild/mozbuild/test/test_tbbutils.py


Changes:

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


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


=====================================
python/mozbuild/mozbuild/tbbutils.py
=====================================
@@ -18,7 +18,7 @@ def list_files_http(url):
             continue
 
         if "tor-expert-bundle" in href:
-            href = f"{href}/tor-expert-bundle.tar.gz"
+            href = f"{href.rstrip('/')}/tor-expert-bundle.tar.gz"
 
         links.append(href)
 
@@ -45,6 +45,22 @@ ARTIFACT_NAME_MAP = {
 }
 
 
+def get_artifact_index(artifact_path, artifact):
+    """
+    Return a unique identifier for the given artifact based on its path.
+
+    In most cases, artifacts built by tor-browser-build include part of their
+    SHA sum or version in the filename, so the file name itself serves as a 
unique
+    identifier. However, some artifacts are stored within subfolders where the 
file
+    name alone is not unique — in those cases, the name of the parent directory
+    provides the unique identifier instead.
+    """
+    if artifact in ["tor-expert-bundle"]:
+        return artifact_path.rsplit("/", 2)[-2]
+
+    return artifact_path.rsplit("/", 1)[-1]
+
+
 def get_artifact_name(original_artifact_name, host):
     # These are not build artifacts, they are pre-built artifacts to be added 
to the final build,
     # 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
 
 import mozunit
 
-from mozbuild.tbbutils import get_artifact_path, list_files_http
+from mozbuild.tbbutils import get_artifact_index, get_artifact_path, 
list_files_http
 
 
 class TestGetArtifactName(unittest.TestCase):
@@ -34,6 +34,20 @@ class TestGetArtifactName(unittest.TestCase):
         self.assertEqual(result, self.artifact[::-1])
 
 
+class TestGetArtifactIndex(unittest.TestCase):
+    def test_regular_artifact(self):
+        artifact = "tor"
+        path = 
"https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out/tor/tor-b1f9824464dc-linux-x86_64-b0ffe2.tar.gz";
+        expected = "tor-b1f9824464dc-linux-x86_64-b0ffe2.tar.gz"
+        self.assertEqual(get_artifact_index(path, artifact), expected)
+
+    def test_expert_bundle_artifact(self):
+        artifact = "tor-expert-bundle"
+        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/";
+        expected = 
"tor-expert-bundle-linux-x86_64-tbb-nightly.2025.10.14-d9aa09"
+        self.assertEqual(get_artifact_index(path, artifact), expected)
+
+
 class TestGetArtifactPath(unittest.TestCase):
     def setUp(self):
         self.url = "http://example.com";



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/385a963050d6dd8e9e5c54ecfea7445f8141889f...8118ce4374a68c10f0395c1a17a8e2c8cf3027f2

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/385a963050d6dd8e9e5c54ecfea7445f8141889f...8118ce4374a68c10f0395c1a17a8e2c8cf3027f2
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to