← Back to issue list

Snapcraft saves the fact that parts need to be rebuilt rather than discovering them

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1778081
Type
issue
State
closed
Author
~kyrofa
Labels
18.10-build-caching
Created
Updated
Closed

Current evaluation

Fixed by snapcore/snapcraft PR #2165, replacing persisted dependency-dirty state with dependency rebuild discovery.

Resolution: closed resolved

Reason: Maintainer ~kyrofa identified PR #2165 as the fix, and the issue was subsequently closed after that change was merged.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Say you have the following parts: parts: main: plugin: nil dependent: plugin: nil after: [main] `main` always needs to be staged before `dependent` is even pulled, which means if `main` ends up cleaning or re-running the stage step, `dependent`'s pull step is now dirty. Today this logic happens when cleaning the stage step of `main`: the snapcraft CLI knows `dependent` depends upon it, and actually loads up the pull state for `dependent`, modifies it saying that a dependency has changed, and then saves it. Then the next time `dependent` runs, it sees that its pull state is dirty. This works, to an extent, but quickly gets complicated once more reasons for needing to rebuild are introduced (e.g. detecting local source changes). It's also error-prone: if an error occurs when saving `dependent`s state, then it doesn't consider itself out of date even though a dependency change took place. Rather than manually handling dependency changes, the snapcraft CLI should actually check to see if dependencies have updated (or _should_ update) for a given part.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by snapcore/snapcraft PR #2165, replacing persisted dependency-dirty state with dependency rebuild discovery.
stealth/space-bunny-alpha — closed resolved Dependency-change detection was fixed in merged canonical/snapcraft#2165 (commit 13881c35f), replacing saved dirty-state notifications with automatic checks.
stealth/space-bunny-alpha — closed resolved Fixed in canonical/snapcraft#2165 (commit 13881c35f): dependency changes now automatically dirty dependent parts instead of storing change notifications.
qwen/qwen3.6-35b-a3b — — Closed without implementation. The dynamic dependency discovery approach for build caching was abandoned and superseded by later Snapcraft caching architecture updates.
qwen/qwen3.6-35b-a3b — — Closed without resolution. The proposed dynamic dependency discovery for build caching was abandoned or superseded by later Snapcraft caching improvements.
qwen/qwen3.6-35b-a3b — — Closed without resolution or comments. The issue outlines Snapcraft's manual rebuild state management as error-prone, recommending dynamic dependency checking instead. No fix or merge details were provided.
qwen3.6-35b-a3b-mtp-q6 — — Closed without resolution. The proposed dynamic dependency discovery for Snapcraft build caching remains unimplemented, likely abandoned or superseded by newer caching architectures.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#2165 (confidence 99%)

    The maintainer's closing comment explicitly links PR #2165 as the fix for dependency rebuild-state detection.

Related issues

Issue Project State Summary Similarity
#1719928 snapcraft update won't fetch from SNAPCRAFT_PARTS_URI snapcraft (launchpad) closed Fixed by snapcore/snapcraft PR #1856, which keyed cached parts data by SNAPCRAFT_PARTS_URI so alternate part sources were no longer treated as already current.
73%
#1789206 cannot rebuild snapcraft snapcraft (launchpad) closed Snapcraft’s own snapcraft.yaml was updated with build-caching support, enabling it to rebuild itself; resolving PR snapcore/snapcraft#2223 was linked.
73%
#1558810 Snapcraft needs better state tracking snapcraft (launchpad) closed Fixed by merged PR canonical/snapcraft#381 (merge commit 3cc0049cd), replacing the last-run state file with per-step state tracking for each part.
72%
#1815658 snapcraft leaks build-environment across parts snapcraft (launchpad) closed Fixed by snapcore/snapcraft PR #2472 (commit 8ca7dd7f2), preventing a part's build-environment from leaking into subsequently processed parts.
72%
#1660696 Snapcraft is testing file collisions on unbuilt parts snapcraft (launchpad) closed Collision detection ran on not-yet-built parts, causing file-not-found failures (dump plugin with custom build). Fixed by PR #1405 (commit dbdc4b5a6), merged into snapcraft; bug was acknowledged by maintainers.
72%
#1670100 Snapcraft includes files from installed snaps in new snap snapcraft (launchpad) closed Fixed by excluding /snap/ paths from crawled dependencies in snapcore/snapcraft PR #1231 (commit 0e9b5a84e).
72%