← Back to issue list

component does not take snap version when no version provided

View original Github issue

Metadata

Project
snapcraft
Number
#5115
Type
issue
State
open
Author
stephensp
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed

Current evaluation

Component version not inherited from snap when no explicit version is set. Triaged as enhancement; fix planned via component-level adopt-info support, scheduled for 25.10 cycle. Component adopt-info now appears in docs and code.

Suggested action: keep open

Reason: The issue is triaged (Status: Triaged, Type: Enhancement) and a maintainer (mr-cal) confirmed on 2025-04-25 that the fix strategy is to rely on adopt-info for components, scheduled for the 25.10 cycle. The codebase now shows component-level adopt_info in the Component model (project.py:1818) and docs describe it, suggesting the feature may already be partially or fully implemented — worth verifying before closing.

Impact: 50 Quick Win: 22.5 Staleness: 25 Complexity: 55 Confidence: 72 Support Request: 5

Issue body

### Bug Description component does not take snap version when no version provided as is defined by the spec "A component might have an optionally set version. Snapcraft will have mechanisms to set this." ### To Reproduce 1. Build a snap + component when no component version is provided. Component version can be deleted from: https://git.launchpad.net/~portias/+git/kernel-snaps-u24.04/tree/snapcraft.yaml?h=portias/pc-components 2. The version of the component is <comp_name>_.comp instead of <comp_name>_.comp ### Environment This reproduces on any environment. ### snapcraft.yaml ```yaml name: pc-kernel adopt-info: kernel grade: stable summary: Ubuntu generic kernel description: The Ubuntu generic kernel package as a snap source-code: https://git.launchpad.net/~canonical-kernel-snaps/canonical-kernel-snaps/+git/kernel-snaps-u24.04 issues: https://bugs.launchpad.net/canonical-kernel-snaps/+filebug?field.tags=pc-kernel contact: https://answers.launchpad.net/canonical-kernel-snaps/+addquestion type: kernel confinement: strict build-base: core24 platforms: amd64: arm64: components: nvidia-550-ko: type: test summary: nvidia 550 kernel objects description: nvidia 550 kernel objects nouveau: type: test summary: nouveau kernel module description: nouveau kernel module parts: kernel: source: https://git.launchpad.net/canonical-kernel-snaps source-type: git source-branch: main plugin: nil build-packages: - kmod stage-packages: - linux-image-uc-generic override-build: | echo BULID # Determine version and 'uname -r' unamer=$(basename "$CRAFT_PART_INSTALL"/lib/modules/*) version="$(apt show linux-image-uc-"$unamer" 2>/dev/null | sed -n 's/^Version: //p' | head -n1)" # Set the snap package version craftctl set version=$version # Update depmod /usr/sbin/depmod -b "$CRAFT_PART_INSTALL" "$unamer" craftctl default # Move nouveau out of the file tree find "$CRAFT_PART_INSTALL" -name nouveau.ko.zst -exec mv '{}' "$CRAFT_PART_INSTALL" \; # Move nouveau into a dedicated component organize: nouveau.ko.zst: (component/nouveau)/ override-stage: | echo STAGE # Determine 'uname -r' unamer=$(basename "$CRAFT_PART_INSTALL"/lib/modules/*) # Move modules mv "$CRAFT_PART_INSTALL"/lib/modules "$CRAFT_PART_INSTALL"/ # Copy firmware "$CRAFT_PART_SRC"/copy-firmware -m "$CRAFT_PART_INSTALL"/modules/"$unamer" -f "$CRAFT_PART_INSTALL"/lib/firmware \ "$CRAFT_PART_INSTALL"/_tmp # Move the dtbs if [ -d "$CRAFT_PART_INSTALL"/lib/firmware/"$unamer" ] ; then mv "$CRAFT_PART_INSTALL"/lib/firmware/"$unamer" "$CRAFT_PART_INSTALL"/_tmp/lib/firmware/ fi mv "$CRAFT_PART_INSTALL"/_tmp/lib/firmware "$CRAFT_PART_INSTALL"/ # Move boot files mv "$CRAFT_PART_INSTALL"/boot/System.map-"$unamer" "$CRAFT_PART_INSTALL"/ mv "$CRAFT_PART_INSTALL"/boot/config-"$unamer" "$CRAFT_PART_INSTALL"/ mv "$CRAFT_PART_INSTALL"/boot/kernel.efi-"$unamer" "$CRAFT_PART_INSTALL"/kernel.efi # Move docs mv "$CRAFT_PART_INSTALL"/usr/share/doc "$CRAFT_PART_INSTALL"/ # Clean up remaining stage package files rm -rf "$CRAFT_PART_INSTALL"/{_tmp,boot,lib,usr} # Create compat symlink for installing headers on classic ln -s /usr/src/linux-headers-"$unamer" "$CRAFT_PART_INSTALL"/modules/"$unamer"/build # Create a mountpoint for firmware updates (LP: #2051144) mkdir "$CRAFT_PART_INSTALL"/firmware/updates craftctl default #TODO temporary workaround for nouveau hooks not being in canonical-kernel-snaps repo nouveau-scripts: source: ./component-hooks plugin: nil override-build: | craftctl default cp install.sh remove.sh $CRAFT_PART_INSTALL #duplicate install.sh as a post refres hook cp install.sh $CRAFT_PART_INSTALL/post-refresh.sh organize: install.sh: (component/nouveau)/snap/hooks/install post-refresh.sh: (component/nouveau)/snap/hooks/post-refresh remove.sh: (component/nouveau)/snap/hooks/remove files: plugin: dump source: files nvidia-550-ko-comp: source: ./component-hooks plugin: nil stage-packages: - binutils - make override-build: | craftctl default version="$(craftctl get version)" #clean up unnecessary libs rm -f -- $CRAFT_PART_INSTALL/usr/lib/$(uname -m)-linux-gnu/libc.so.6 apt-get download linux-objects-nvidia-550-server-${version%.*}-generic \ linux-signatures-nvidia-${version%.*}-generic for i in `find . -name '*.deb'` ; do dpkg-deb -x $i nvidia-objects ; done mkdir -p $CRAFT_PART_INSTALL/bits mv nvidia-objects/lib/modules/*/kernel/nvidia-550srv/bits/* $CRAFT_PART_INSTALL/bits # Reuse the install hook as the post-refresh hook cp link-and-install.sh $CRAFT_PART_INSTALL/post-refresh.sh cp link-and-install.sh $CRAFT_PART_INSTALL/install.sh cp remove.sh $CRAFT_PART_INSTALL/remove.sh organize: bits/: (component/nvidia-550-ko)/bits usr/bin: (component/nvidia-550-ko)/bin usr/lib: (component/nvidia-550-ko)/lib install.sh: (component/nvidia-550-ko)/snap/hooks/install post-refresh.sh: (component/nvidia-550-ko)/snap/hooks/post-refresh remove.sh: (component/nvidia-550-ko)/snap/hooks/remove ``` ### Relevant log output ```shell None. ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22.5
Staleness: 25
Complexity: 55
Confidence: 72
Support Request: 5
keep open Component version not inherited from snap when no explicit version is set. Triaged as enhancement; fix planned via component-level adopt-info support, scheduled for 25.10 cycle. Component adopt-info now appears in docs and code.
qwen/qwen3.6-35b-a3b
Staleness: 45
Complexity: 60
Confidence: 90
Support Request: 10
keep open Component version inheritance from snap version when not explicitly set. Issue is triaged with a planned implementation strategy relying on `adopt-info` support for components in a future release cycle.
qwen3.6-35b-a3b-mtp-q6
Staleness: 50
Complexity: 60
Confidence: 90
Support Request: 5
keep open Enhancement to make components inherit the snap version when unspecified. Triaged and acknowledged; maintainers plan to implement via adopt-info support in a future release cycle.
qwen3.6-35b-a3b-mtp-q6
Staleness: 35
Complexity: 65
Confidence: 90
Support Request: 5
keep open Components lack automatic version inheritance from the parent snap when unspecified. Triaged enhancement. Resolution strategy relies on adopt-info support for components, targeting the 25.10 cycle with possible delays.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#5240 (confidence 55%)

    Referenced in mr-cal's 2025-04-25 comment as the adopt-info-for-components work scheduled for 25.10; component adopt_info field now present in Component model and docs.

Related issues

No related issues found above the similarity threshold.