canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.
https://snapcraft.io
GNU General Public License v3.0
1.19k stars 448 forks source link

Unable to set components version using craftctl set version #5102

Open stephensp opened 1 month ago

stephensp commented 1 month ago

What needs to get done

component versions need to be settable during override-build , just like a snap. Currently it fails with the following error

RuntimeError: 'override-build' in part 'nvidia-550-ko-comp' executed an invalid control API call: variable 'version' can be set only once.

Why it needs to get done

components need to be able to dynamically set their version based on revision numbers and other system settings. This is not possible if the version has to be hardcoded into the version field.

sergiusens commented 1 month ago

This is because the part is decoupled from the component, this would need to be a new craftctl command specific to the component that takes a component name and the desired version, or overload the current set version command to use a key=value (component=version) like syntax.

sergiusens commented 1 month ago

Of course, then adopt-info would need to be considered for each component

cmatsuoka commented 1 month ago

Maybe craftctl set version(<component_name>)=<value>?

mr-cal commented 1 month ago

Or @lengau's suggestion craftctl set comp1.version=<value>.

After discussing with @sergiusens and @cmatsuoka, this is unlikely to be completed this cycle. Claudio is going to discuss this proposal with Gustavo tomorrow.