canonical / snapcraft

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

Support `kernel.yaml` similar to `gadget.yaml` #4982

Open dilyn-corner opened 3 weeks ago

dilyn-corner commented 3 weeks ago

What needs to get done

The kernel.yaml file in kernel snaps should be a supported metadata file similar to snapcraft.yaml, hooks/*, etc. It should be moved by Snapcraft to the meta/ directory.

Why it needs to get done

The kernel.yaml file integrates the kernel snap with the gadget snap, allowing kernel assets to be leveraged by the gadget snap during image creation time. A primary use-case for this is sharing things like DTB files. For instance, see the pi-gadget.

Supporting kernel.yaml will make supporting assumes: [kernel-assets] more meaningful, as that is a stated purpose of the assumes. kernel-assets has been an existent feature for three years and is not marked as experimental. https://github.com/canonical/snapd/blame/d1ab1252636424044a97e596659c296441fdcfb4/overlord/snapstate/check_snap.go#L53

Tangentially related to this request is supporting the gadget.yaml similar to other metadata files (see https://github.com/canonical/snapcraft/issues/4344), and I think that if this feature request is accepted both the gadget.yaml and kernel.yaml should be supported in similar ways.

syncronize-issues-to-jira[bot] commented 3 weeks ago

Thank you for reporting us your feedback!

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

This message was autogenerated

mr-cal commented 3 weeks ago

This is a good idea. We can start with the same design as a snapcraft.yaml file where snapcraft first looks for snapcraft.yaml then looks for snap/snapcraft.yaml.

Do you want to deprecate gadget.yaml in favor of snap/gadget.yaml? Or allow it to exist in either location?

dilyn-corner commented 3 weeks ago

I think the safest (shudder) choice is to allow both but offer a notice -- for legacy purposes it should be treated the same as how snapcraft treats the snapcraft.yaml.

dilyn-corner commented 2 days ago

Curiouser and curiouser.

Can't make heads or tails of why I have to manually intervene.

ETA: I just checked. You don't have to manually move it, the code path works as expected. I guess I never tested it without the intervention...? Either way, this issue is now basically identical to #4344.