Snapcraft doesn't ignore already-built snaps when `source` is the folder containing the `snapcraft.yaml`
Metadata
Current evaluation
Snapcraft now filters *.snap files from sourcedir, preventing rebuilt artifacts from being copied into part build directories; shipped in version 2.10.1.
Resolution: closed resolved
Reason: Merged PR canonical/snapcraft#535 as commit e00f3f376, adding filtering of *.snap files from the sourcedir. The fix was verified in Snapcraft 2.10 and released in 2.10.1.
Evaluated by: mr-cal-bot
No scores available.
Issue body
[Impact]
* Many plugins support sources. When the `source` keyword points to the directory containing the `snapcraft.yaml`, Snapcraft creates a copy of that entire directory, including any snaps that have already been built (which can be very large).
[Test Case]
1. Download and run `snapcraft` on http://people.canonical.com/~kyrofa/test-cases/1575628.tar . The result should be a .snap.
2. Run `snapcraft clean`. This shouldn't remove the .snap.
3. Run `snapcraft` again.
4. Notice that the .snap that was already built was copied into `parts/foo/build/`.
5. Apply the fix for this bug.
6. Run steps 2 and 3 again.
7. Notice that the .snap that was already built was NOT copied into `parts/foo/build/`.
[Regression Potential]
* When copying the source folder, Snapcraft-specific data is excluded (e.g. parts/ stage/ snap/ snapcraft.yaml, etc.). That data may no longer be excluded correctly.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft now filters *.snap files from sourcedir, preventing rebuilt artifacts from being copied into part build directories; shipped in version 2.10.1. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #535 (commit e00f3f376), filtering *.snap files from sourcedir; verified in Snapcraft 2.10 and released in 2.10.1. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in merged canonical/snapcraft#535 (e00f3f376): sourcedir now excludes already-built *.snap files, preventing them from being copied into part build directories. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed and verified. Snapcraft now correctly excludes already-built .snap files when the source directory contains snapcraft.yaml, preventing unnecessary large copies during builds. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed Snapcraft to exclude already-built .snap files when the source directory contains snapcraft.yaml. The update prevents unnecessary copying of large build artifacts. Verified and closed. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#535
(confidence 100%)
The merged PR directly implemented the sourcedir filtering required to resolve Launchpad #1575628.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1990166 Snapcraft 7 silently ignores any files ending in *.snap when the source is a folder | snapcraft (launchpad) | open | Deliberate behavior: folder sources exclude *.snap files. The maintainer linked the ignore setting, and the exact build reproducer still fails when a needed snap is omitted. | |
| #645 If "source: .." do not copy the current directory into itself. | snapcraft | closed | Superseded by canonical/snapcraft#725, merged as a3d662744; it fixed LP #1600428 by excluding the snapcraft.yaml directory from parent-source traversal. | |
| #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). | |
| #1600428 Setting source: .. causes pull to fail | snapcraft (launchpad) | closed | Fixed by snapcore/snapcraft#725, adding support for snapcraft.yaml in a subdirectory and preventing recursive source copying. | |
| #2256 local source: don't include .snapcraft directory | snapcraft | merged | Merged #2256 (commit abbc92427), fixing LP #1791773 by excluding .snapcraft from local-source copies and stale-part checks. | |
| #1549676 source-subdir says its "a source dir within a repo to build from" but misses that snapcraft will only copy that subdir | snapcraft (launchpad) | closed | Fixed by merged ubuntu-core/snapcraft#344 (commit 6beb6fec6): Snapcraft now copies the full repository while building from the selected source-subdir. |