deb: do not retain staged trees over the retention size cap
The per-target retention kept the newest five staged trees however large they are: five carried kernel trees are three-digit GiB, most of it compiled objects whose resume value does not scale with their size. A staged tree larger than the retention cap (a user setting, see below) is now dropped at the end of its own build — the record degrades to metadata-only and the next build re-stages from scratch — and the retention sweep also degrades older oversized trees, covering records kept by older pkh versions and interrupted builds. The cap of 0 disables the size rule; the count cap is unchanged. The cap is the first setting of a user configuration file, ~/.config/pkh/config.json (the directory already holds contexts.json): missing file and missing keys mean defaults, a corrupt file is backed up and the defaults apply, and PKH_STAGED_MAXSIZE overrides the file. The default is 20G, the scale where a carried kernel tree stops earning its disk. Every retained tree's size is measured once at retention (the same concurrent, mount-crossing-safe walker the prune report uses) and stored in the record manifest, so sweeps reuse it instead of re-walking the trees on every build.
This commit is contained in:
@@ -184,14 +184,24 @@ pkh deb --no-ccache # build without the shared compile cache
|
||||
```
|
||||
|
||||
Each target keeps at most five staged trees: when a sixth is retained,
|
||||
the oldest degrades to a metadata-only record (manifest and log stay),
|
||||
and `pkh prune` removes records older than a week. `pkh prune --dry-run`
|
||||
previews everything it would remove, grouped by kind with sizes;
|
||||
`--all` ignores the age and removes everything a live build does not
|
||||
hold, recent records and staged trees included; `-f/--force` skips the
|
||||
size pass and the confirmation prompt, removing immediately. `pkh deb
|
||||
--incremental` never forks a record built for a different
|
||||
series/architecture.
|
||||
the oldest degrades to a metadata-only record (manifest and log stay).
|
||||
A staged tree larger than 20 GiB is never kept at all — a tree that
|
||||
size costs more disk than the resume it buys, so its record degrades
|
||||
too and the next build re-stages from scratch. The cap is a setting:
|
||||
|
||||
```json
|
||||
// ~/.config/pkh/config.json (missing = defaults; keys may be omitted)
|
||||
{ "staged_maxsize": "20G" }
|
||||
```
|
||||
|
||||
`"0"` disables the size rule entirely, and `PKH_STAGED_MAXSIZE`
|
||||
overrides the file when set. `pkh prune` removes records older than a
|
||||
week. `pkh prune --dry-run` previews everything it would remove,
|
||||
grouped by kind with sizes; `--all` ignores the age and removes
|
||||
everything a live build does not hold, recent records and staged trees
|
||||
included; `-f/--force` skips the size pass and the confirmation
|
||||
prompt, removing immediately. `pkh deb --incremental` never forks a
|
||||
record built for a different series/architecture.
|
||||
|
||||
Packages whose `debian/rules` keeps an input-untracked stamp cache (the
|
||||
kernels' `debian/stamps`) declare it in the quirks data
|
||||
|
||||
Reference in New Issue
Block a user