home / docs / mirrors & cache

Mirrors and cache

Where source comes from, and where it waits.

Every Keru build is a network operation. Two mechanisms keep that sane and reproducible: a mirror-first download policy, and a well-defined cache on disk.

Download order

  • 1. SOURCE_MIRROR — tried first when set; run a mirror of source tarballs and point it here.
  • 2. Upstream — the canonical source URL from the recipe. Used when no mirror is set or the mirror lacks a file.
  • Verification at every step. A file that doesn't match its checksum is dropped, and the next source in line is tried. Tampered files never reach a build.

The cache layout

/var/cache/kama/ # CACHEDIR (set CACHEDIR=/path to relocate) ├── dl/ # downloaded tarballs, one per package ├── src/ # extracted source (per package dir) └── stage/ # staged installs before they commit to $ROOT
DirEverythingPurpose
dlDownloadsAlready-downloaded archives are reused, never re-fetched.
srcExtractedExtraction is skipped when the checked-out source is present.
stageStaged buildsProgress survives a failed build; re-running continues.

Working offline, or your own mirror

# warm the cache once, then build with the network down SOURCE_MIRROR=https://mirror.example.org kama fetch busybox ... CACHEDIR=/var/cache/kama kama make busybox # no network needed

Run a mirror yourself and point SOURCE_MIRROR at it. The layout mirrors dl/; the fetch layer treats it as a read-mostly source of truth.

Cleanup

  • rm -rf /var/cache/kama/src/* — free extracted source (re-extracts on next build).
  • rm -rf /var/cache/kama/dl/* — dump downloads (re-fetches next time).
  • rm -rf /var/cache/kama/stage/* — discard staged builds.
A corrupt cache is the #1 source of confusing fetch errors. When in doubt, clear the relevant dir — downloads verify anyway, so you lose nothing but time.

← kama usage · Troubleshooting