← Back to issue list

feat: prune primed files if they exist on the base

View original Github issue

Metadata

Project
rockcraft
Number
#417
Type
pull request
State
merged
Author
tigarmo
Labels
—
Created
Updated
Closed

Current evaluation

Merged as 623551b5, adding lifecycle pruning of identical regular files already in the base layer, reducing ROCK size and fixing #363.

Resolution: closed resolved

Reason: Commit 623551b5 merged PR #417 and implements the base-layer file pruning described in the PR, resolving redundant content in the resulting OCI layer.

Evaluated by: mr-cal-bot

No scores available.

Issue body

**Note** The first commit is from PR #416 and doesn't need to be reviewed here ------------ This commit adds a lifecycle callback that "prunes" (removes) those primed files that already exist (with same contents and permissions) in the base layer. This is necessary because the dependency resolver doesn't look into the base layer when deciding dependency cutoffs (and also to support chisel slices, which only look at the target install dir). Some notes: 1) This first implementation only looks are regular files (no symlinks and directories), as those are the simplest to handle and provide the biggest size "wins". If necessary, we can address symlinks and/or directories in follow-up work. 2) This could have been implemented during the archiving of the new layer, where we already loop on the files and look at the base layer (to handle things like the usrmerge). We decided to implement this as part of the lifecycle to improve the "clarity" and "debuggability" of Rockcraft runs: after running the lifecycle, the prime directory contains exactly what's going to be packed in the new layer. The resulting ROCK should be "semantically" equivalent, but smaller. For instance, the Pyfiglet ROCK in docs/tutorials/code/pyfiglet goes from 69MB to 53MB, with no functional changes. Fixes #363

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged as 623551b5, adding lifecycle pruning of identical regular files already in the base layer, reducing ROCK size and fixing #363.
stealth/space-bunny-alpha — closed resolved Merged in canonical/rockcraft#417 as commit 623551b5, pruning primed regular files already identical to base-layer files to reduce ROCK size. Fixes #363.
qwen/qwen3.6-35b-a3b — — Merged implementation of a lifecycle callback that prunes primed files already present in the base layer, reducing ROCK image size. Approved by two reviewers, passed CI, and resolves issue #363.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Implements a lifecycle callback to prune primed files already in the base layer, reducing ROCK size without functional changes. Fixes #363. Initial implementation handles regular files only.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/rockcraft#363 (confidence 100%)

    PR #417 explicitly states that it fixes this issue by pruning primed files already present in the base image.

Related issues

No related issues found above the similarity threshold.