snapcraft icon indicating copy to clipboard operation
snapcraft copied to clipboard

Treat the gadget.yaml like other snap meta files

Open dilyn-corner opened this issue 2 years ago • 3 comments

What needs to get done

The gadget.yaml should be required to be located in snap/gadget.yaml of the snap project directory instead of in the root of the project directory. This should not interfere with the gadget.yaml being migrated to its final location in ${SNAP}/meta/gadget.yaml.

Why it needs to get done

Currently, the gadget.yaml for a gadget snap must be located in the root of the project directory.

The snapcraft.yaml was previously also located in the root of the project directory, but was migrated to snap/snapcraft.yaml. Likewise, hooks are in snap/hooks/, and are moved (in some relevant way) to ${SNAP}/meta/hooks/ at the end of the build.

For continuity, it would be make sense to require that the gadget.yaml be located in snap/gadget.yaml. This would ensure uniformity in the way snapcraft treats all snap-related meta information.

dilyn-corner avatar Sep 01 '23 15:09 dilyn-corner

Thank you for reporting us your feedback!

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

This message was autogenerated

When we implement #4892, we should implement this as well.

mr-cal avatar Aug 19 '24 14:08 mr-cal

it would be Very Nice™️ if we also supported multi-arch snaps in a neat way. For instance, Canonical reference gadgets for core2{2,4} build for either amd64 or arm64, and copy the correct gadget yaml to the $CRAFT_PROJECT_DIR -- snapcraft shouldn't really dirty the project directory (even with --use-lxd the host is dirtied as project/ is actually the $CRAFT_PROJECT_DIR on the host, so you touch the host even without --destructive-mode) and while this behaviour is intended by the maintainer, it's only to work around a lacking feature in snapcraft.

Something like if snap/gadget-a{md,rm}64.yaml exist, check $CRAFT_ARCH_BUILD_FOR against gadget-$CRAFT_ARCH_BUILD_FOR.yaml and copy the right one to meta/gadget.yaml.

dilyn-corner avatar Sep 10 '24 13:09 dilyn-corner