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

[tor-commits] [Git][tpo/applications/tor-browser-build][maint-15.0] Bug 41681: Keep public suffixes up-to-date on 140esr-based Tor Browser for Android.



Title: GitLab

ma1 pushed to branch maint-15.0 at The Tor Project / Applications / tor-browser-build

Commits:

  • 5d84e9bf
    by hackademix at 2026-01-12T11:45:22+01:00
    Bug 41681: Keep public suffixes up-to-date on 140esr-based Tor Browser for Android.
    

4 changed files:

Changes:

  • projects/browser/build.android
    ... ... @@ -29,6 +29,8 @@ unzip $rootdir/[% c('input_files_by_name/noscript') %]
    29 29
       }) %]
    
    30 30
     popd
    
    31 31
     
    
    32
    +unzip -o "$rootdir"/[% c('input_files_by_name/fenix-nightly-apk') %] assets/publicsuffixes
    
    33
    +
    
    32 34
     [%IF c("var/tor-browser") -%]
    
    33 35
       tar -xaf "$rootdir/[% c('input_files_by_name/tor-expert-bundle') %]/tor-expert-bundle.tar.gz" tor/pluggable_transports/pt_config.json
    
    34 36
       tar -xf "$rootdir/[% c('input_files_by_name/moat-settings') %]"
    

  • projects/browser/config
    ... ... @@ -113,6 +113,10 @@ input_files:
    113 113
         enable: '[% ! c("var/android") %]'
    
    114 114
       - filename: dmg-root
    
    115 115
         enable: '[% ! c("var/android") %]'
    
    116
    +  - name: fenix-nightly-apk
    
    117
    +    URL: https://ftp.mozilla.org/pub/fenix/nightly/2026/01/2026-01-11-21-42-32-fenix-148.0a1-android-arm64-v8a/fenix-148.0a1.multi.android-arm64-v8a.apk
    
    118
    +    enable: '[% c("var/android") %]'
    
    119
    +    sha256sum: c39056d428bf573aa9df1d4be11493064f867bc247bda1e8b7e1836d5aae7a31
    
    116 120
       - URL: https://dist.torproject.org/torbrowser/noscript/noscript-13.5.2.1984.xpi
    
    117 121
         name: noscript
    
    118 122
         sha256sum: 4579c70b69e3198ea0bf064f9912b9341696b9ad4ed177cb19994208872425fd
    

  • tools/relprep.py
    ... ... @@ -18,7 +18,7 @@ import ruamel.yaml
    18 18
     
    
    19 19
     import fetch_changelogs
    
    20 20
     from update_manual import update_manual
    
    21
    -
    
    21
    +from update_fenix_nightly_apk import update_fenix_nightly_apk
    
    22 22
     
    
    23 23
     logger = logging.getLogger(__name__)
    
    24 24
     
    
    ... ... @@ -140,6 +140,7 @@ class ReleasePreparation:
    140 140
                 self.update_zlib()
    
    141 141
                 if self.android:
    
    142 142
                     self.update_zstd()
    
    143
    +                update_fenix_nightly_apk(self.base_path)
    
    143 144
                 self.update_go()
    
    144 145
                 self.update_manual()
    
    145 146
                 self.update_moat_settings()
    

  • tools/update_fenix_nightly_apk.py
    1
    +#!/usr/bin/env python3
    
    2
    +import hashlib
    
    3
    +import re
    
    4
    +from pathlib import Path
    
    5
    +
    
    6
    +import requests
    
    7
    +import ruamel.yaml
    
    8
    +
    
    9
    +
    
    10
    +def find_apk_url():
    
    11
    +    base_url = "https://ftp.mozilla.org"
    
    12
    +    path = "/pub/fenix/nightly/"
    
    13
    +    while True:
    
    14
    +        url = f"{base_url}{path}"
    
    15
    +        r = requests.get(url)
    
    16
    +        r.raise_for_status()
    
    17
    +        match = re.match(f'.*"({re.escape(path)}.*)"', r.text, re.DOTALL)
    
    18
    +        if not match:
    
    19
    +            raise Exception(f"Could not find apk url from  {url}!")
    
    20
    +        # we want to get the smallest apk, which is arm64-v8a
    
    21
    +        path = match.group(1).replace("-android/", "-android-arm64-v8a/")
    
    22
    +        if path.endswith(".apk"):
    
    23
    +            return f"{base_url}{path}"
    
    24
    +
    
    25
    +
    
    26
    +def update_config(base_path, url):
    
    27
    +    yaml = ruamel.yaml.YAML()
    
    28
    +    yaml.indent(mapping=2, sequence=4, offset=2)
    
    29
    +    yaml.width = 150
    
    30
    +    yaml.preserve_quotes = True
    
    31
    +
    
    32
    +    config_path = base_path / "projects/browser/config"
    
    33
    +    config_name = "fenix-nightly-apk"
    
    34
    +    config = yaml.load(config_path)
    
    35
    +
    
    36
    +    for input_file in config["input_files"]:
    
    37
    +        if input_file.get("name") == config_name:
    
    38
    +            apk_file_path = base_path / "out/browser" / url.split("/")[-1]
    
    39
    +            if url == input_file["URL"]:
    
    40
    +                if apk_file_path.exists():
    
    41
    +                    print(f"{apk_file_path} exists, checking hash...")
    
    42
    +                    sha256 = hashlib.sha256()
    
    43
    +                    with apk_file_path.open("rb") as f:
    
    44
    +                        while chunk := f.read(16384):
    
    45
    +                            sha256.update(chunk)
    
    46
    +                    sha256sum = sha256.hexdigest()
    
    47
    +                    if sha256sum == input_file["sha256sum"]:
    
    48
    +                        print(f"{config_name}/URL is up-to-date, nothing to do.")
    
    49
    +                        return False
    
    50
    +            sha256sum = download_apk(url, apk_file_path)
    
    51
    +            input_file["sha256sum"] = sha256sum
    
    52
    +            input_file["URL"] = url
    
    53
    +            with config_path.open("w") as f:
    
    54
    +                yaml.dump(config, f)
    
    55
    +                print(f"Updated input_files/{config_name} in {config_path}.")
    
    56
    +            return True
    
    57
    +    raise Exception(f"Cannot find input_files/{config_name} in {config_path}!")
    
    58
    +
    
    59
    +
    
    60
    +def download_apk(url, dest):
    
    61
    +    print(f"Downloading {url} to {dest}....")
    
    62
    +    r = requests.get(url, stream=True)
    
    63
    +    r.raise_for_status()
    
    64
    +    sha256 = hashlib.sha256()
    
    65
    +    with dest.open("wb") as f:
    
    66
    +        for chunk in r.iter_content(chunk_size=8192):
    
    67
    +            f.write(chunk)
    
    68
    +            sha256.update(chunk)
    
    69
    +    return sha256.hexdigest()
    
    70
    +
    
    71
    +
    
    72
    +def update_fenix_nightly_apk(base_path):
    
    73
    +    url = find_apk_url()
    
    74
    +    return update_config(base_path, url)
    
    75
    +
    
    76
    +
    
    77
    +if __name__ == "__main__":
    
    78
    +    update_fenix_nightly_apk(Path(__file__).parent.parent)

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