← 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
2025-02-06 18:53:39+00:00
Updated
2025-04-21 19:48:22+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

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

No evaluation history available.