canonical / snapcraft

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

Treat the gadget.yaml like other snap meta files #4344

Open dilyn-corner opened 1 year ago

dilyn-corner commented 1 year ago

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.

syncronize-issues-to-jira[bot] commented 2 months ago

Thank you for reporting us your feedback!

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

This message was autogenerated

mr-cal commented 2 months ago

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

dilyn-corner commented 1 month ago

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.