Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give organize access to variables set during the build step #5241

Open
dilyn-corner opened this issue Feb 6, 2025 · 0 comments
Open

Give organize access to variables set during the build step #5241

dilyn-corner opened this issue Feb 6, 2025 · 0 comments

Comments

@dilyn-corner
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant