← Back to issue list

Some variables aren't properly set

View original Github issue

Metadata

Project
snapcraft
Number
#4704
Type
issue
State
closed
Author
dilyn-corner
Labels
—
Created
Updated
Closed

Current evaluation

Fixed core24 architecture/project environment-variable setup by merged PR #4757 (commit 27957515c); remaining CRAFT_PROJECT_NAME/VERSION interpolation stayed tracked in craft-application#320.

Resolution: closed resolved

Reason: PR #4757 was merged as commit 27957515c and fixed the core24 variable setup reported here. Maintainer mr-cal explicitly confirmed, "Fixed via #4757"; separate project-name/version interpolation remained in canonical/craft-application#320.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description When building a core24 snap for a different architecture, the `BUILD_FOR` variables are set to the host architecture instead of the target. This might be similar to #4702 ### To Reproduce Install snapcraft from `latest/edge` (tested with revision 11178) `snapcraft`, `snapcraft --build-for riscv64`, and `snapcraft --build-for=riscv64` all fail to set the correct architecture. Curiously, `snapcraft --build-for amd64` returns no errors but also doesn't do anything (no-op with no message?) but that may be unrelated. ### Environment Snapcraft on a 23.10 host building with `--use-lxd`. ### snapcraft.yaml ```shell name: my-snap-name # you probably want to 'snapcraft register <name>' base: core24 # the base snap is the execution environment for this snap build-base: devel 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 platforms: riscv64: build-on: [amd64, riscv64] build-for: [riscv64] parts: my-part: # See 'snapcraft plugins' plugin: nil override-build: | echo BUILD_FOR is "${CRAFT_ARCH_BUILD_FOR}" echo BUILD_ON is "${CRAFT_ARCH_BUILD_ON}" echo TRIPLET_BUILD_FOR is "${CRAFT_ARCH_TRIPLET_BUILD_FOR}" echo TRIPLET_BUILD_ON is "${CRAFT_ARCH_TRIPLET_BUILD_ON}" echo PROJECT_NAME is "${CRAFT_PROJECT_NAME}" echo PROJECT_VERSION is "${CRAFT_PROJECT_VERSION}" ``` ### Relevant log output ```shell Starting snapcraft, version 8.0.5.post149+git2fd36174 Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240329-130845.515502.log' Starting snapcraft, version 8.0.5.post149+git2fd36174 Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20240329-130845.515502.log' Launching managed ubuntu devel instance... Starting instance Starting snapcraft, version 8.0.5.post149+git2fd36174 Logging execution to '/tmp/snapcraft.log' Starting snapcraft, version 8.0.5.post149+git2fd36174 Logging execution to '/tmp/snapcraft.log' Initialising lifecycle Installing build-packages Installing build-snaps Skipping pull for my-part (already ran) Building my-part :: + echo BUILD_FOR is amd64 :: BUILD_FOR is amd64 :: + echo BUILD_ON is amd64 :: BUILD_ON is amd64 :: + echo TRIPLET_BUILD_FOR is x86_64-linux-gnu :: TRIPLET_BUILD_FOR is x86_64-linux-gnu :: + echo TRIPLET_BUILD_on is x86_64-linux-gnu :: TRIPLET_BUILD_ON is x86_64-linux-gnu :: + echo PROJECT_NAME is my-snap-name :: PROJECT_NAME is my-snap-name :: + echo PROJECT_VERSION is 0.1 :: PROJECT_VERSION is 0.1 Staging my-part Priming my-part Packing... Reading snap metadata... Running linters... Running linter: classic Running linter: library Creating snap package... Packed my-snap-name_0.1_riscv64.snap ``` ### Additional context Also of note: `SNAPCRAFT_PROJECT_{NAME,VERSION}` are invalid variables (though their `CRAFT_` counterparts *are* valid), which means the [documentation](https://snapcraft.io/docs/parts-environment-variables#heading--snapcraft-configuration-core22) is incorrect. `SNAPCRAFT_PROJECT_GRADE` and `CRAFT_PROJECT_GRADE` are never replaced and both raise an unbound variable error, but I think these things are more related to #4702 than this bug.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed core24 architecture/project environment-variable setup by merged PR #4757 (commit 27957515c); remaining CRAFT_PROJECT_NAME/VERSION interpolation stayed tracked in craft-application#320.
stealth/space-bunny-alpha — closed resolved Fixed in merged PR #4757 (commit 27957515c), correcting core24 BUILD_FOR variables. CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION remained outstanding in craft-application#320.
qwen/qwen3.6-35b-a3b — — Fixed via PR #4757 by correctly setting architecture variables for core24 cross-architecture builds. CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION remain unprocessed and are tracked separately in craft-application issue #320.
qwen/qwen3.6-35b-a3b — — Fixed via PR #4757. Architecture setup method extracted and applied to core24 projects, resolving incorrect BUILD_FOR assignments. CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION remain unevaluated and tracked in craft-application#320.
qwen/qwen3.6-35b-a3b — — Fixed via PR #4757. Core24 BUILD_FOR variables now correctly target the specified architecture. CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION evaluation remains unresolved and tracked separately.
qwen3.6-35b-a3b-mtp-q6 — — Fixed via PR #4757 by correctly setting architecture variables for core24 builds. CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION evaluation remains unresolved and is tracked in craft-application issue #320.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: snapcraft#4757 (confidence 100%)

    Merged fix for core24 project-variable setup, committed as 27957515c.

  • Related To: canonical/craft-application#320 (confidence 99%)

    Tracked the remaining CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION interpolation problem.

  • Related To: snapcraft#4702 (confidence 98%)

    Reported the same core24 variable-expansion problem and was addressed by the same fix.

Related issues

Issue Project State Summary Similarity
#4757 fix: set project variables for core24 snapcraft merged Merged #4757 as commit 27957515c, fixing core24 project-variable expansion and closing #4704/#4702; CRAFT_* setup was linked to canonical/craft-application#320.
81%
#4702 [craft-application/core24] $SNAPCRAFT_PROJECT_VERSION and other fields not replaced snapcraft closed Core24 project-variable replacement was fixed by merged PR #4757 (commit 27957515c). Remaining CRAFT_PROJECT_NAME and CRAFT_PROJECT_VERSION handling was tracked in craft-application#320.
79%
#4770 Wrong arch being used in core24 project variables snapcraft closed Fixed by merged PR #4779 (commit 3e3428ec1): craft-application 2.6.3 supplied the build-for architecture fix, with regression coverage added.
74%