Skip to main content

Module install

Module install 

Source
Expand description

High-level package installation: fetch from registry, extract, lock.

The install flow glues the pieces together:

  1. Resolve a version for name (from version_req, or the registry’s latest if none is given).
  2. Download the tarball via NetworkRegistry, which caches it under the cache directory and verifies its SHA-256 checksum.
  3. Extract the tarball into .bock/packages/<name>/<version>/.
  4. Update bock.package to list the dependency.
  5. Update bock.lock with a LockedPackage entry carrying the exact resolved version and checksum for reproducibility.

Offline mode: when no registry can be reached and a matching tarball already sits in the cache, installation is still possible — the tarball is extracted and the lockfile kept consistent, but the manifest entry records whichever version was already cached.

Structs§

InstallOptions
Options controlling a single package install.
InstalledPackage
Information about a newly installed package.

Constants§

CACHE_SUBDIR
Relative path (under a project) of the tarball cache.
PACKAGES_SUBDIR
Relative path (under a project) where extracted packages are installed.

Functions§

clear_cache
Wipe every tarball out of the cache directory.
extract_tarball
Extract a .tar.gz archive into target_dir, creating parents as needed.
install_package
Install a package: download, extract, and update the manifest + lockfile.