Support referencing the stage dir from snapcraft.yaml
Metadata
Current evaluation
Implemented SNAPCRAFT_STAGE substitution for part properties and merged the fix in canonical/snapcraft#270 via eb033b40c.
Resolution: closed resolved
Reason: Launchpad #1538688 was resolved by canonical/snapcraft#270, merged as commit eb033b40c. The change added part-time replacement of $SNAPCRAFT_STAGE with the absolute stage-directory path.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Given the use of the after keyword for parts, it is also sometime desired to reference something inside the stage dir; given the execution location and the relocatable fact on building with snapcraft it makes sense to introduce a SNAPCRAFT_STAGE variable that can be used.
Here's an example:
snapcraft.yaml:
```yaml
parts:
part1:
plugin: autotools
source: .
configflags:
- --with-swig: $SNAPCRAFT_STAGE/usr/swig
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Implemented SNAPCRAFT_STAGE substitution for part properties and merged the fix in canonical/snapcraft#270 via eb033b40c. | |
| stealth/space-bunny-alpha | — | closed resolved | Implemented and merged: canonical/snapcraft#270 ("Support $SNAPCRAFT_STAGE for parts", merge commit eb033b40c) added $SNAPCRAFT_STAGE substitution so snapcraft.yaml parts can reference the absolute stage dir path. | |
| stealth/space-bunny-alpha | — | closed resolved | Implemented by merged PR canonical/snapcraft#270, adding $SNAPCRAFT_STAGE substitution so parts can reference the absolute stage directory. | |
| qwen/qwen3.6-35b-a3b | — | — | Request to introduce a $SNAPCRAFT_STAGE variable for referencing the stage directory was closed without implementation. Zero comments and minimal activity indicate the feature was abandoned. | |
| qwen/qwen3.6-35b-a3b | — | — | Feature request to introduce a SNAPCRAFT_STAGE environment variable for referencing the stage directory. Closed without implementation or discussion, effectively abandoned due to age and lack of maintainer engagement. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without implementation or discussion, indicating the feature request was abandoned. The SNAPCRAFT_STAGE variable was not added to snapcraft. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. The feature request to introduce a SNAPCRAFT_STAGE variable for referencing the stage directory in snapcraft.yaml was abandoned. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#270
(confidence 100%)
PR #270 implemented SNAPCRAFT_STAGE substitution and was merged as eb033b40c.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #270 Support $SNAPCRAFT_STAGE for parts | snapcraft | merged | Merged in canonical/snapcraft#270 via eb033b40c, adding part-time replacement of $SNAPCRAFT_STAGE with the absolute stage-directory path. | |
| #1557018 Access from the build system to $SNAPCRAFT_STAGE directory when after: keyword is used in parts | snapcraft (launchpad) | closed | Closed as stale on 2016-05-29 after 60 days without activity; no resolving PR or commit was recorded. SNAPCRAFT_STAGE was later exported globally in #757. | |
| #1588336 Enable snap version to be used in other parts of the snapcraft.yaml | snapcraft (launchpad) | closed | Feature request for using the snap version inside other snapcraft.yaml fields delivered by merged snapcore/snapcraft PR #757 (commit dc0b68174), exporting SNAPCRAFT_PROJECT_NAME/VERSION/STAGE so sources can use $SNAPCRAFT_PROJECT_VERSION. LP bug closed. | |
| #1983009 Snapcraft 7.1.0 fails to find stage package when cross-compiling | snapcraft (launchpad) | closed | Fixed by canonical/snapcraft#3416 (commit 8f418e3d9), restoring core20 behavior so stage packages come from build-on repositories during cross-compilation. | |
| #1157 repo: support versioned stage-packages | snapcraft | merged | Merged support for versioned stage-packages in canonical/snapcraft#1157 via commit ef4076821, resolving Launchpad bug #1666656. | |
| #1747778 Snapcraft.yml in 'snap' directory. prime/parts/stage in '.' | snapcraft (launchpad) | open | Feature request (2018) to let snapcraft put parts/stage/prime build dirs next to snap/snapcraft.yaml instead of the project root. Maintainer kyrofa agreed it is desirable; no implementation exists — lifecycle still uses Path.cwd() as work_dir. | |
| #6095 Allow staging snap components | snapcraft | open | Feature request to support snap components in stage-snaps (snap+component syntax). Triaged as feasible; implementation lives upstream in craft-parts PR #1604, currently on hold pending snapd UX decisions on component access/management. | |
| #1805214 stage-snaps | snapcraft (launchpad) | closed | Feature request for a stage-snaps keyword (unpack a snap's content into the snap being built, like stage-packages) was implemented and merged in canonical/snapcraft#2468 (commit 0983e4063), then shipped in the 3.2 release; follow-up fixes in #2525 and #3211. |