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

snapcraft 7.x fails to replace new variables #4677

Open
dilyn-corner opened this issue Mar 19, 2024 · 4 comments
Open

snapcraft 7.x fails to replace new variables #4677

dilyn-corner opened this issue Mar 19, 2024 · 4 comments
Labels
bug Actual bad behavior that don't fall into maintenance or documentation

Comments

@dilyn-corner
Copy link

dilyn-corner commented Mar 19, 2024

Bug Description

Snapcraft will fail to replace the new variable syntax and will only replace the old variable syntax.

To Reproduce

Install snapcraft 7.x (only tested 7.5.4+), use the provided snapcraft.yaml.
Compare the error message just in case you remove the { } around the variable.

Environment

Ubuntu 23.04, building with --use-lxd

snapcraft.yaml

name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

architectures:
  - build-on: amd64
    build-for: riscv64

parts:
  my-part:
    # See 'snapcraft plugins'
    plugin: nil
    build-packages:
      - gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR}

Relevant log output

2024-03-18 20:52:34.621 :: 2024-03-18 20:52:28.857 part build packages: ['gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR}']
2024-03-18 20:52:34.621 :: 2024-03-18 20:52:28.857 Requested build-packages: ['gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR}']
2024-03-18 20:52:34.621 :: 2024-03-18 20:52:30.183 Marking gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR} (and its dependencies) to be fetched
2024-03-18 20:52:34.621 :: 2024-03-18 20:52:34.160 Cannot find package listed in 'build-packages': gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR}

Additional context

No response

@dilyn-corner dilyn-corner added the bug Actual bad behavior that don't fall into maintenance or documentation label Mar 19, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2623.

This message was autogenerated

@tigarmo
Copy link
Contributor

tigarmo commented Mar 19, 2024

The problem here is that CRAFT_ARCH_TRIPLET_BUILD_FOR was introduced in craft-parts 1.24.0, but Snapcraft 7.5.x uses craft-parts 1.19.7.
For that particular case you can fallback to CRAFT_ARCH_TRIPLET instead

@sergiusens
Copy link
Collaborator

so the env did not get replaced, leaving the _ after the : triggering the slice check. The slice check probably needs to check things before the architecture check. I am not even sure we support slices with architecture tags, so : might also not be allowed for slices specifically

@tigarmo
Copy link
Contributor

tigarmo commented Mar 19, 2024

I wonder how useful it is to fix this on the slice-verification side, because if a variable didn't get expanded then basically all bets are off: the build would fail later when trying to install gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR} from apt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

No branches or pull requests

3 participants