brizental pushed to branch tor-browser-140.2.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
e3afce24
by Beatriz Rizental at 2025-09-08T18:43:45+02:00
3 changed files:
- build/moz.configure/bootstrap.configure
- python/mozbuild/mozbuild/tbbutils.py
- python/mozbuild/mozbuild/test/test_tbbutils.py
Changes:
| ... | ... | @@ -211,7 +211,11 @@ def bootstrap_path(path, **kwargs): |
| 211 | 211 | return False
|
| 212 | 212 | |
| 213 | 213 | artifact_path = mozbuild.tbbutils.get_artifact_path(
|
| 214 | - tor_browser_build_out, artifact, target, prefix=path_prefix
|
|
| 214 | + tor_browser_build_out,
|
|
| 215 | + artifact,
|
|
| 216 | + target,
|
|
| 217 | + prefix=path_prefix,
|
|
| 218 | + log=log.warning,
|
|
| 215 | 219 | )
|
| 216 | 220 | if not artifact_path:
|
| 217 | 221 | log.info("no path found in tbb/out for %s", artifact)
|
| ... | ... | @@ -58,7 +58,7 @@ def get_artifact_name(original_artifact_name, host): |
| 58 | 58 | return ARTIFACT_NAME_MAP.get(original_artifact_name)
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | -def get_artifact_path(url, artifact, target, prefix=""):
|
|
| 61 | +def get_artifact_path(url, artifact, target, prefix="", log=lambda *args, **kwargs: {}):
|
|
| 62 | 62 | if prefix:
|
| 63 | 63 | path = prefix
|
| 64 | 64 | else:
|
| ... | ... | @@ -71,6 +71,7 @@ def get_artifact_path(url, artifact, target, prefix=""): |
| 71 | 71 | files = list_files_http(f"{url}/{path}?C=M;O=D")
|
| 72 | 72 | |
| 73 | 73 | if not files:
|
| 74 | + log(f"No files found in {url} for {artifact}.")
|
|
| 74 | 75 | return None
|
| 75 | 76 | |
| 76 | 77 | def filter_files(files, keyword):
|
| ... | ... | @@ -78,6 +79,10 @@ def get_artifact_path(url, artifact, target, prefix=""): |
| 78 | 79 | |
| 79 | 80 | artifact_files = [file for file in files if file.startswith(artifact)]
|
| 80 | 81 | |
| 82 | + if len(artifact_files) == 0:
|
|
| 83 | + log(f"No files found in {url} for {artifact}.")
|
|
| 84 | + return None
|
|
| 85 | + |
|
| 81 | 86 | if len(artifact_files) == 1:
|
| 82 | 87 | return f"{url}/{path}/{artifact_files[0]}"
|
| 83 | 88 |
| ... | ... | @@ -48,6 +48,12 @@ class TestGetArtifactPath(unittest.TestCase): |
| 48 | 48 | result = get_artifact_path(self.url, self.artifact, self.target)
|
| 49 | 49 | self.assertIsNone(result)
|
| 50 | 50 | |
| 51 | + @patch("mozbuild.tbbutils.list_files_http")
|
|
| 52 | + def test_no_matching_files_returns_none(self, mock_list_files):
|
|
| 53 | + mock_list_files.return_value = ["somethingelse.zip", "yetanotherthing.zip"]
|
|
| 54 | + result = get_artifact_path(self.url, self.artifact, self.target)
|
|
| 55 | + self.assertIsNone(result)
|
|
| 56 | + |
|
| 51 | 57 | @patch("mozbuild.tbbutils.list_files_http")
|
| 52 | 58 | def test_single_artifact_match(self, mock_list_files):
|
| 53 | 59 | mock_list_files.return_value = ["artifact-1.zip"]
|