boklm pushed to branch main at The Tor Project / Applications / tor-browser-build Commits: 8b8abf69 by Nicolas Vigier at 2026-07-28T13:41:58+02:00 Bug 41711: Update our manual machinery for its new home - - - - - 7 changed files: - doc/how-to-update-the-manual.txt - projects/browser/build - projects/manual/README.md - projects/manual/build - projects/manual/config - − projects/manual/packagemanual.py - tools/update_manual.py Changes: ===================================== doc/how-to-update-the-manual.txt ===================================== @@ -1,9 +1,3 @@ -1. Go to https://gitlab.torproject.org/tpo/web/manual/-/jobs/ -2. Open the latest build stage -3. Download the artifacts (they come in a .zip file). -4. Rename it to manual_$PIPELINEID.zip -5. Upload it to people.tpo -6. Update projects/manual/config - 6.1 Change the version to $PIPELINEID - 6.2 Update the hash in the input_files section - 6.3 Update the URL if it was different from the previous uploader +1. Run ./tools/update_manual.py +2. Upload the new file to tb-build-02.torproject.org:~tb-builder/public_html/ +3. Commit the changes made by the script to projects/manual/config ===================================== projects/browser/build ===================================== @@ -184,7 +184,7 @@ tar -C "${TB_STAGE_DIR}" -xf [% c('input_files_by_name/firefox') %]/browser.tar. find . -exec [% c("touch") %] {} \; for tbdir in "${TBDIRS[@]}" do - find chrome/ | sort | zip -X -@ "$tbdir[% IF c('var/macos') %]/Contents/Resources[% END %]/browser/omni.ja" + find chrome/ defaults/preferences/tor-browser-manual.js | sort | zip -X -@ "$tbdir[% IF c('var/macos') %]/Contents/Resources[% END %]/browser/omni.ja" done popd rm -rf $TMP_MANUAL_PATH ===================================== projects/manual/README.md ===================================== @@ -10,7 +10,11 @@ So, since the manual doesn't contain binary executables, we decided not to build it, but to mirror the latest result of the CI to make sure a build stays reproducible (otherwise, CI artifacts would be deleted after a week). -However, the CI artifacts include a lot of files used by other Tor sites but not -from the manual, so we delete them in our build script to save space in the -builds. Also, the paths to resources need to be updated, because we serve the -manual as an about page, so we need to convert them to full `chrome://` URIs. +The download of the latest CI artifacts can be done by the script +`tools/update_manual.py`. + +However, the CI artifacts include a lot of files used by other Tor sites +but not from the manual, so they need to be deleted, and some of the +files need to be adapted for offline use. This is done by the script +`package_marble_build_artifacts.py` (which has tests in +`test_package_marble_build_artifacts.py`). ===================================== projects/manual/build ===================================== @@ -1,19 +1,26 @@ #!/bin/bash [% c("var/set_default_env") -%] -mkdir -p chrome/browser/content/browser/manual -unzip $rootdir/[% c('input_files_by_name/manual') %] -python3 $rootdir/[% c('input_files_by_name/package_script') %] public chrome/browser/content/browser/manual +manual_dir='chrome/browser/content/browser/aboutmanual' +mkdir -p "$manual_dir" manual-src +unzip -d manual-src $rootdir/[% c('input_files_by_name/manual') %] +python3 $rootdir/[% c('input_files_by_name/package_script') %] \ + --in-dir manual-src/public --out-dir "$manual_dir" \ + --out-locales "$rootdir/supported-locales.txt" -pushd chrome/browser/content/browser/manual/static -find -name '*.map' -delete -rm -rf fonts -rm -rf css/digital-climate-strike css/images -# We prune unused images in the Python script, but empty directories remain -find images -type d -empty -delete -popd +# Check for the expected characters, which will also ensure this can +# form a valid javascript string literal. +# Note that $() will strip any trailing newlines, if any. +supported_locales="$(cat "$rootdir/supported-locales.txt")" +if [[ ! "$supported_locales" =~ ^[a-zA-Z,-]*$ ]]; then + echo 'Error: unexpected characters in supported-locales.txt' >&2 + exit 1 +fi + +mkdir -p defaults/preferences +echo 'pref("torbrowser.manual.available-locales", "'"$supported_locales"'");' > defaults/preferences/tor-browser-manual.js [% c('tar', { - tar_src => [ 'chrome' ], + tar_src => [ 'chrome', 'defaults' ], tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'), }) %] ===================================== projects/manual/config ===================================== @@ -1,7 +1,7 @@ # vim: filetype=yaml sw=2 # To update, see doc/how-to-update-the-manual.txt # Remember to update also the package's hash, with the version! -version: 321660 +version: 402523 filename: 'manual-[% c("version") %]-[% c("var/build_id") %].tar.[% c("compress_tar") %]' container: use_container: 1 @@ -21,8 +21,8 @@ var: input_files: - project: container-image - - URL: 'https://build-sources.tbb.torproject.org/manual_[% c("version") %].zip' + - URL: 'https://build-sources.tbb.torproject.org/marble-support_[% c("version") %].zip' name: manual - sha256sum: 9adb7d8ca2c9cb7dbd8d13d46135ea9f42636eafd053192fc5e233f2426cd8a3 - - filename: packagemanual.py + sha256sum: e0f09c869719bf9dc0ae2761f121cae7cd9b5324f817f2cc0a5861c58442f3ff + - filename: package_marble_build_artifacts.py name: package_script ===================================== projects/manual/packagemanual.py deleted ===================================== @@ -1,69 +0,0 @@ -#!/usr/bin/env python3 -from pathlib import Path -import re -import sys -import shutil - - -PAGE_NAME = 'offline-docs' -STATIC_PATH = 'chrome://browser/content/manual/static' - -if len(sys.argv) < 3: - print(f'Usage: {sys.argv[0]} lektor-out-directory target-directory') - sys.exit(1) - -source = Path(sys.argv[1]) -target = Path(sys.argv[2]) -if not target.exists(): - target.mkdir(exist_ok=True) - -static_re = re.compile('"(?:../)*static/([^"]+)"') -link_re = re.compile('href="../([^"]+)"') - - -def clean_urls(match): - m = re.match(r'(?:../)?([^/#]+)[/]?[#]?(.*)', match.group(1)) - slug = m.group(1) - if m.group(2): - anchor = '_' + m.group(2) - else: - anchor = '' - return f'href="#{slug}{anchor}"' - - -remove_images = [] -for p in (source / 'static/images').glob('**/*'): - if p.is_file(): - rel = p.relative_to(source) - remove_images.append(rel) - -htmls = source.rglob(f'{PAGE_NAME}/index.html') -for page in htmls: - with page.open(encoding='utf8') as f: - contents = f.read() - - remove_images = list(filter( - lambda im: contents.find(str(im)) == -1, remove_images)) - - contents = static_re.sub(f'"{STATIC_PATH}/\\1"', contents) - contents = link_re.sub(clean_urls, contents) - - rel = page.relative_to(source) - dest_name = str(list(rel.parents)[-2].name) - if dest_name == PAGE_NAME: - dest_name = 'en' - dest_name += '.html' - with (target / dest_name).open('w', encoding='utf8') as f: - f.write(contents) - - -def ignore_images(path, names): - return [ - n - for n in names - if Path(path, n).relative_to(source) in remove_images - ] - - -shutil.rmtree(target / 'static', ignore_errors=True) -shutil.copytree(source / 'static', target / 'static', ignore=ignore_images) ===================================== tools/update_manual.py ===================================== @@ -10,7 +10,7 @@ from fetch_changelogs import load_token, AUTH_HEADER GITLAB = "https://gitlab.torproject.org" API_URL = f"{GITLAB}/api/v4" -PROJECT_ID = 23 +PROJECT_ID = 3354 REF_NAME = "main" @@ -66,7 +66,7 @@ def update_manual(auth_token, base_path): raise RuntimeError("No usable job found") pipeline_id = int(job["pipeline"]["id"]) - manual_fname = f"manual_{pipeline_id}.zip" + manual_fname = f"marble-support_{pipeline_id}.zip" url = f"https://build-sources.tbb.torproject.org/{manual_fname}" r = requests.head(url) needs_upload = r.status_code != 200 View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/8b... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/8b... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
boklm (@boklm)