← Back to issue list

Give `organize` access to variables set during the build step

View original Github issue

Metadata

Project
snapcraft
Number
#5241
Type
issue
State
open
Author
dilyn-corner
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed

Current evaluation

Enhancement request to allow the organize keyword to access build-environment variables and variables set during the build step. Triaged by a maintainer and tracked upstream in craft-parts#1076, which remains open with no progress.

Suggested action: keep open

Reason: Maintainer mr-cal explicitly endorsed the request on 2025-04-21 ('I think this is a good idea') and created upstream tracking issue craft-parts#1076, which is still open. The issue is triaged and valid, with a clear use case (kernel snaps needing build-time-known paths), so it should remain open pending upstream implementation.

Impact: 50 Quick Win: 20.0 Staleness: 55 Complexity: 60 Confidence: 75 Support Request: 5

Issue body

### What needs to get done When snapcraft performs the build step for a part, keys in `build-environment` or variables set during the build should exist for the `organize` portion of the build step to use. ### Why it needs to get done Suppose something like the below: ``` parts: foo: build-environment: NAME: bar VERSION: baz ``` If some piece of `foo` needs to be in a specifically named directory, this must currently be done manually: ``` override-build: | craftctl default mv -f "${CRAFT_PART_INSTALL}/my/file" "${CRAFT_PART_INSTALL}/$NAME/$VERSION/my/file" ``` The `organize` part of the build step is a more natural use-case: ``` organize: my/file: $NAME/$VERSION/my/file ``` The utility becomes more obvious just in case `$NAME` or `$VERSION` are generated and only known *during the build* (i.e. in the case of kernel snaps): ``` override-build: | craftctl default kver="$(basename "${CRAFT_PART_INSTALL}/lib/modules/"*)" organize: modules/**/kernel/drivers/net/wireless/rtw88: (component/wlan)/modules/$kver/kernel/drivers/net/wireless/rtw88 ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 20.0
Staleness: 55
Complexity: 60
Confidence: 75
Support Request: 5
keep open Enhancement request to allow the organize keyword to access build-environment variables and variables set during the build step. Triaged by a maintainer and tracked upstream in craft-parts#1076, which remains open with no progress.
qwen/qwen3.6-35b-a3b
Staleness: 70
Complexity: 40
Confidence: 85
Support Request: 10
keep open Enhancement request to allow organize directives to access variables defined in build-environment or set during override-build. Triaged, with maintainer support and an upstream craft-parts issue created.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 40
Confidence: 80
Support Request: 10
keep open Feature request to let organize directives access build-environment or override-build variables. Triaged, escalated upstream, and awaiting resolution despite over a year of inactivity.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 50
Confidence: 85
Support Request: 10
keep open Enable snapcraft's organize step to access build-time variables and paths, removing the need for manual file moves. The enhancement is triaged and tracked via an upstream craft-parts bug.

Update history

No update history recorded yet.

Related work

  • Blocked By: craft-parts#1076 (confidence 90%)

    Maintainer created this upstream issue to track the feature; the snapcraft-side request depends on craft-parts implementing variable access in organize.

Related issues

Issue Project State Summary Similarity
#1076 Give organize access to variables set during the build step #5241 craft-parts open Enhancement to allow the organize keyword to reference variables set during the build step, enabling dynamic file paths. Triaged by a maintainer 497 days ago with no further activity or implementation progress.
86%