brizental pushed to branch base-browser-140.4.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
a7eeac64
by Beatriz Rizental at 2025-10-14T16:25:12+02:00
3 changed files:
- build/moz.configure/bootstrap.configure
- python/mozbuild/mozbuild/tbbutils.py
- python/mozbuild/mozbuild/test/test_tbbutils.py
Changes:
| ... | ... | @@ -221,11 +221,7 @@ 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(artifact_path)
|
|
| 229 | 225 | index_file = os.path.join(toolchains_base_dir, "indices", artifact)
|
| 230 | 226 | try:
|
| 231 | 227 | with open(index_file) as fh:
|
| ... | ... | @@ -41,6 +41,17 @@ ARTIFACT_NAME_MAP = { |
| 41 | 41 | }
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | +def get_artifact_index(artifact_path):
|
|
| 45 | + """
|
|
| 46 | + Return a unique identifier for the given artifact based on its path.
|
|
| 47 | + |
|
| 48 | + In most cases, artifacts built by tor-browser-build include part of their
|
|
| 49 | + SHA sum or version in the filename, so the file name itself serves as a unique
|
|
| 50 | + identifier.
|
|
| 51 | + """
|
|
| 52 | + return artifact_path.rsplit("/", 1)[-1]
|
|
| 53 | + |
|
| 54 | + |
|
| 44 | 55 | def get_artifact_name(original_artifact_name, host):
|
| 45 | 56 | # These are not build artifacts, they are pre-built artifacts to be added to the final build,
|
| 46 | 57 | # therefore this check can come before the host check.
|
| ... | ... | @@ -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,13 @@ 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 | + path = "https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out/tor/tor-b1f9824464dc-linux-x86_64-b0ffe2.tar.gz"
|
|
| 40 | + expected = "tor-b1f9824464dc-linux-x86_64-b0ffe2.tar.gz"
|
|
| 41 | + self.assertEqual(get_artifact_index(path), expected)
|
|
| 42 | + |
|
| 43 | + |
|
| 37 | 44 | class TestGetArtifactPath(unittest.TestCase):
|
| 38 | 45 | def setUp(self):
|
| 39 | 46 | self.url = "http://example.com"
|