Introducing a new way to review your PRs.

Read the announcement

imputnet / helium

Private, fast, and honest web browser

View on GitHub

17 documents · Updated Nov 23, 2026

docs / download-management

Download and dependency management

Download and dependency management gives the build pipeline a controlled way to obtain Chromium source and other external artifacts. It declares each required file with a source, a stable name, an integrity check, and a destination, then retrieves, verifies, and places those files before patching and asset generation. This page is a child of Build configuration and downloads and relates to Build asset generation.

Download declarations

The download declaration model describes external artifacts as named components. An external artifact is a file fetched from outside the repository. The model keeps the source URL, local cache name, expected hash, and source-tree destination together so later build steps do not need to define those details again.

The repository uses two declaration sets with different roles:

Declaration setRoleWhen it is used
downloads.iniChromium source archiveBefore source patching and build setup
deps.iniAssets needed after the source tree is availableAfter source retrieval and before later build steps

Entries can also name a version, an archive format, and a directory to remove from the archive root. This lets a downloaded file land at the path expected by Chromium or Helium without changing the archive itself.

Component records

Each component record must provide a URL, a download file name, and an output path. It can use a direct hash or a supported hash file URL. The parser checks these rules when it combines one or more INI files, and it rejects a malformed record before any download starts.

The main source record points to the versioned Chromium archive and its matching hash data in downloads.ini. The post-clone records in deps.ini provide versioned search data, onboarding assets, and the uBlock Origin package. These records are inputs to the same download service even though they enter the pipeline at different times. A uBlock Origin version change also requires the bundled assets.json data to be re-stripped so the downloaded package keeps the intended network behavior.

References: utils/downloads.py• L46-166 downloads.ini• L1-8 deps.ini• L1-25 devutils/clear-ublock-assets.js• L5-60

Download lifecycle

The download lifecycle moves a declared component from a remote source to a verified directory in the build source tree. The cache separates network retrieval from source-tree placement, so a later run can reuse a complete file without fetching it again.

The pipeline follows this sequence:

  1. Parse and validate the selected declaration files.
  2. Retrieve missing files into the download cache.
  3. Retrieve any hash files required by the declaration.
  4. Compute the declared hashes and stop on a mismatch.
  5. Unpack verified archives into their declared output paths.
  6. Continue with source patching or asset generation.

This diagram shows how the two declaration sets join the build at different points while sharing the same cache and validation path.

flowchart LR
    D[Download declarations] --> P[Parse and validate]
    P --> C[Download cache]
    C --> H[Hash check]
    H --> U[Unpack to source tree]
    U --> B[Patch and build pipeline]
    S[Chromium source setup] --> C
    D1[downloads.ini] --> P
    D2[deps.ini] --> P

The command can select named components. A selected component still passes through the same retrieval and integrity checks. A missing named component is an error rather than an empty result.

Retrieval and integrity checks

Retrieval treats an existing complete cache file as reusable. An interrupted transfer remains separate from the final file and can resume when the command-line downloader is available. After retrieval, the integrity step reads each file in chunks and compares it with every declared hash or with hashes read from a supported hash file.

The retrieve action performs both retrieval and checking. This makes the cache usable by the unpack step only after the file has passed its declared integrity check.

References: utils/downloads.py• L208-322 utils/downloads.py• L391-436 .github/…/ci.yml• L70-92

Archive placement

The unpack action takes verified files from the cache and places their contents under each component's output path. The declared extractor or the archive suffix selects the archive handling path. A leading directory can be removed when an archive wraps its useful contents in a versioned or package-specific root.

Archive handling uses the platform's available tools when needed and has a Python fallback for supported tar and zip formats. The output path and leading-directory rule are part of the component contract because later patch and build steps expect the files at those locations.

References: utils/downloads.py• L325-374 utils/_extraction.py• L75-145 utils/_extraction.py• L199-269 .github/…/ci.yml• L94-99

Source dependency setup

Source dependency setup creates the Chromium source and the tools required to prepare it. A source dependency is a source tree or tool checkout that the build needs, rather than a single archive declared in an INI file.

The source setup uses the Chromium version as its source revision. It also aligns depot_tools and gn with revisions named by Chromium, synchronizes the configured source dependencies, and obtains profile data used by the source build. If the matching Chromium archive is unavailable, the pipeline creates an equivalent archive from a fresh source setup and stores it in the same cache.

This arrangement gives the pipeline two paths to the same source input:

PathResult
Cached archiveFast, repeatable source unpack
Source setup fallbackFresh source tree that can be archived for later reuse

After source setup, deps.ini assets are retrieved and unpacked into the source tree. The common cache and ordered placement keep these assets separate from the Chromium source while allowing the later build stages to consume both.

Source and tool revisions

The source setup reads the Chromium revision from the repository version file. It then uses Chromium's dependency metadata to select compatible tool revisions. This keeps the source tree and its preparation tools tied to the same upstream state instead of relying on an unrelated local checkout.

The setup also performs source preparation that produces files needed by later build steps. These generated source inputs belong to the source setup stage even though they are not external download declarations.

References: utils/clone.py• L20-45 utils/clone.py• L48-118 utils/clone.py• L143-188 utils/clone.py• L190-234

Configuration validation

Configuration validation is the early gate for the download contract. check_downloads_ini.py loads the declared INI files through the same parser used by retrieval and reports schema errors with a failing exit status.

The repository-wide configuration check includes the main downloads.ini file along with patch and GN configuration checks. Continuous integration runs this gate before the source-backed build, so malformed download declarations fail before network work or source preparation begins.

The validation scope is intentionally narrow: it checks declaration shape and supported values. It does not prove that a remote URL is reachable or that a cached file has the expected content; retrieval and hash checking provide those later guarantees.

Configuration consumers

The download declaration model is also used by tooling that needs a version from a dependency record. For example, localization generation reads the onboarding version from deps.ini, which makes that version part of more than the asset download step.

References: devutils/check_downloads_ini.py• L7-59 devutils/validate_config.py• L7-53 .github/…/ci.yml• L45-57 devutils/i18n_generate.py• L16-24

Change checklist

When these files or sections are changed, remember to consider these:

  • When a component name or output path changes, check the build step that consumes that path and any version lookup that reads the component by name.
  • When a version, URL, or archive name changes, update the matching hash source and the cache key inputs used by continuous integration.
  • When a uBlock Origin version changes, re-strip its assets.json file with devutils/clear-ublock-assets.js so the package does not restore blocked outgoing connections.
  • When a source archive layout changes, recheck its leading-directory rule so unpacking does not leave an extra root directory in the source tree.
  • When a dependency is moved between downloads.ini and deps.ini, preserve its position in the pipeline because post-clone assets require a source tree.
  • When a new archive format or extractor is declared, check the platform fallback and the tools available to the build action.

Important failure modes

TriggerConsequenceGuard
A declaration omits a required value or uses an unsupported extractor or hash URLConfiguration validation fails before retrievalThe shared declaration schema and validate_config.py check the record shape
A requested cache file is absent or a remote transfer failsRetrieval stops and the source-backed build cannot use the cacheThe pipeline falls back to source setup only for a failed Chromium archive retrieval; other dependency retrieval errors remain failures
A downloaded file does not match its declared hashThe file is rejected before unpackingretrieve performs hash checking and returns a failure on mismatch
An archive does not contain the declared leading directoryUnpacking cannot place the contents at the expected rootThe unpack stage checks and removes the declared directory only when it exists
The required platform extractor is not availableArchive unpacking can fail or use the supported Python fallbackPlatform-specific extractor selection and fallback logic handle tar and zip support
A uBlock Origin update is not followed by asset strippingThe packaged extension can retain outgoing URLs that should be removed before user consentThe deps.ini update note and clear-ublock-assets.js define the required preparation step

Key files

FileWhy to read it
utils/downloads.pyDefines the shared contract for parsing declarations, retrieving files, checking hashes, and unpacking archives.
downloads.iniShows the declaration for the versioned Chromium source archive.
deps.iniShows the post-clone external assets and their source-tree destinations.
utils/clone.pyExplains the source and tool setup used when the source archive is not available.
utils/_extraction.pyDescribes the platform choices and fallback behavior for archive placement.
devutils/clear-ublock-assets.jsShows the required asset cleanup when the packaged uBlock Origin version changes.
devutils/validate_config.pyShows how download declaration checks join the repository-wide configuration gate.
.github/…/ci.ymlShows the order of cache use, retrieval, source fallback, unpacking, and later build work.