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

[tor-commits] [Git][tpo/applications/tor-browser-bundle-testsuite][main] Bug 40101: Figure the android-sdk URL dinamically



Title: GitLab

brizental pushed to branch main at The Tor Project / Applications / tor-browser-bundle-testsuite

Commits:

  • 1bdaea90
    by Beatriz Rizental at 2026-05-06T12:59:12-03:00
    Bug 40101: Figure the android-sdk URL dinamically
    

2 changed files:

Changes:

  • .gitlab/_base.yml
    ... ... @@ -78,8 +78,7 @@ variables:
    78 78
         - when: never
    
    79 79
     
    
    80 80
       variables:
    
    81
    -    # TODO (tor-browser-bundle-testsuite#40101): Stop hardcoding the filename here.
    
    82
    -    ANDROID_SDK_REPACK_URL: "https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out/android-sdk/android-sdk-36.1.0-f31d7b.tar.zst"
    
    81
    +    SETUP_ANDROID_SDK: 1
    
    83 82
         INSTALLER_URL: "$[[ inputs.android_x86_64_installer_url ]]"
    
    84 83
         ARTIFACTS_URL: "$[[ inputs.android_x86_64_artifacts_url ]]"
    
    85 84
         PACKAGE_NAME: "$[[ inputs.android_x86_64_package_name ]]"
    

  • .gitlab/scripts/before_script.py
    ... ... @@ -6,6 +6,7 @@ import time
    6 6
     import urllib.request
    
    7 7
     import zipfile
    
    8 8
     from pathlib import Path
    
    9
    +import re
    
    9 10
     
    
    10 11
     SPECULATIVE_DOWNLOAD_RETRY_ATTEMPTS = 3
    
    11 12
     SPECULATIVE_DOWNLOAD_RETRY_DELAY = 300  # 5min
    
    ... ... @@ -14,6 +15,10 @@ SPECULATIVE_DOWNLOAD_RETRY_DELAY = 300 # 5min
    14 15
     # expects the emulator to have a this exact android version.
    
    15 16
     EMULATOR_ANDROID_VERSION = 34
    
    16 17
     
    
    18
    +TOR_BROWSER_BUILD_OUT = (
    
    19
    +    "https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out"
    
    20
    +)
    
    21
    +
    
    17 22
     
    
    18 23
     def download_file(url: str, dest: Path, sha256: str = "") -> None:
    
    19 24
         print(f"Downloading {url} -> {dest}")
    
    ... ... @@ -77,15 +82,27 @@ def download_minidump_stackwalk(
    77 82
         print(f"Extracted minidump-stackwalk -> {dest_dir}")
    
    78 83
     
    
    79 84
     
    
    80
    -def setup_android_sdk(
    
    81
    -    moz_fetches_dir: str,
    
    82
    -    android_sdk_repack_url: str,
    
    83
    -) -> None:
    
    85
    +def get_android_sdk_repack_url():
    
    86
    +    url = f"{TOR_BROWSER_BUILD_OUT}/android-sdk?C=M;O=D"
    
    87
    +    req = urllib.request.Request(url, method="GET")
    
    88
    +    with urllib.request.urlopen(req) as response:
    
    89
    +        html = response.read().decode()
    
    90
    +        found = re.search(
    
    91
    +            r'<a href="">"(android-sdk-[^"]+\.tar\.zst)"',
    
    92
    +            html,
    
    93
    +        )
    
    94
    +        if not found:
    
    95
    +            raise RuntimeError(f"Could not find android-sdk tarball URL in {url}")
    
    96
    +
    
    97
    +        return f"{url}/{found.group(1)}"
    
    98
    +
    
    99
    +
    
    100
    +def setup_android_sdk(moz_fetches_dir: str) -> None:
    
    84 101
         android_sdk_dir = Path(moz_fetches_dir) / "android-sdk-linux"
    
    85 102
         android_sdk_dir.mkdir(parents=True, exist_ok=True)
    
    86 103
     
    
    87 104
         tar_zst_path = Path("android-sdk.tar.zst")
    
    88
    -    download_file(android_sdk_repack_url, tar_zst_path)
    
    105
    +    download_file(get_android_sdk_repack_url(), tar_zst_path)
    
    89 106
         extract_tar(tar_zst_path, android_sdk_dir)
    
    90 107
     
    
    91 108
         # Remove fake emulator binary added by tor-browser-build
    
    ... ... @@ -139,7 +156,7 @@ def before_script(
    139 156
         minidump_stackwalk_sha256: str,
    
    140 157
         moz_fetches_dir: str,
    
    141 158
         sha256sums_url: str = "",
    
    142
    -    android_sdk_repack_url: str = "",
    
    159
    +    setup_android: bool = False,
    
    143 160
     ) -> None:
    
    144 161
         check_sha256sums_url(sha256sums_url)
    
    145 162
         download_mozharness(mozharness_url)
    
    ... ... @@ -147,11 +164,8 @@ def before_script(
    147 164
             minidump_stackwalk_url, moz_fetches_dir, minidump_stackwalk_sha256
    
    148 165
         )
    
    149 166
     
    
    150
    -    if android_sdk_repack_url:
    
    151
    -        setup_android_sdk(
    
    152
    -            moz_fetches_dir,
    
    153
    -            android_sdk_repack_url,
    
    154
    -        )
    
    167
    +    if setup_android:
    
    168
    +        setup_android_sdk(moz_fetches_dir)
    
    155 169
     
    
    156 170
     
    
    157 171
     if __name__ == "__main__":
    
    ... ... @@ -161,6 +175,5 @@ if __name__ == "__main__":
    161 175
             minidump_stackwalk_sha256=os.environ.get("MINIDUMP_STACKWALK_SHA256", ""),
    
    162 176
             moz_fetches_dir=os.environ["MOZ_FETCHES_DIR"],
    
    163 177
             sha256sums_url=os.environ.get("SHA256SUMS_URL", ""),
    
    164
    -        # Android-only stuff.
    
    165
    -        android_sdk_repack_url=os.environ.get("ANDROID_SDK_REPACK_URL", ""),
    
    178
    +        setup_android="SETUP_ANDROID_SDK" in os.environ,
    
    166 179
         )

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