← Back to issue list

Treat the gadget.yaml like other snap meta files

View original Github issue

Metadata

Project
snapcraft
Number
#4344
Type
issue
State
open
Author
dilyn-corner
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed
—

Current evaluation

Enhancement to require gadget.yaml in snap/gadget.yaml instead of the project root. Triaged (CRAFT-3264); still unimplemented — both setup_assets.py (core22) and package.py (core24+) still read gadget.yaml from the project root.

Suggested action: keep open

Reason: The request is triaged and valid but not implemented: snapcraft/parts/setup_assets.py:99 still does `gadget_yaml = project_dir / "gadget.yaml"` for the core22 path, and the newer mediated path in snapcraft/services/package.py:539 `_read_project_metadata_file()` also resolves `project_dir / filename`. Neither `snap/gadget.yaml` nor any arch-specific variant appears anywhere in the repo (git log -S 'snap/gadget' returns no hits), so the issue is not fixed. mr-cal's comment about implementing it with #4892 has not materialized (that PR is a merged remotebuild credentials fix, unrelated), and the bot ticket CRAFT-3264 is unfulfilled, so the issue should stay open.

Evaluated by: mr-cal-bot

Impact: 38 Quick Win: 14 Complexity: 48 Confidence: 85 Actionability: 72

Issue body

### 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.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 38
Quick Win: 14
Complexity: 48
Confidence: 85
Actionability: 72
keep open Enhancement to require gadget.yaml in snap/gadget.yaml instead of the project root. Triaged (CRAFT-3264); still unimplemented — both setup_assets.py (core22) and package.py (core24+) still read gadget.yaml from the project root.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 22
Complexity: 10
Confidence: 90
Actionability: 80
keep open Enhancement to require gadget.yaml in snap/gadget.yaml instead of the project root, aligning with snap/snapcraft.yaml placement. Currently unimplemented; code still searches the project root.
qwen/qwen3.8-27b
Impact: 35
Quick Win: 16
Staleness: 55
Complexity: 55
Confidence: 72
Support Request: 10
keep open Enhancement to move gadget.yaml source location from project root to snap/gadget.yaml for consistency with other snap meta files. Triaged, acknowledged by maintainer who linked it to issue #4892 as a prerequisite. Code still reads from root; not yet implemented.
qwen/qwen3.6-35b-a3b
Staleness: 60
Complexity: 50
Confidence: 85
Support Request: 5
keep open Enhancement to relocate gadget.yaml to snap/gadget.yaml for consistency with other snap metadata. Triaged and linked to related issue #4892, awaiting implementation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 30
Confidence: 85
Support Request: 5
keep open Enhancement to require gadget.yaml in snap/gadget.yaml for consistency with other snap metadata. Triaged and linked to related work, awaiting implementation.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#6369 (confidence 80%)

    Commit 13643760e 'feat: mediate creation of gadget.yaml and kernel.yaml' moved gadget.yaml handling into PackageService but kept the project-root lookup via _read_project_metadata_file.

  • Related To: canonical/snapcraft#4892 (confidence 55%)

    mr-cal stated this should be implemented alongside #4892, but that PR is a merged remotebuild legacy-credentials change and does not touch gadget.yaml handling — the referenced dependency appears mismatched or unmet.

Related issues

Issue Project State Summary Similarity
#1640897 snapcraft doesn't validate gadget.yaml snapcraft (launchpad) open Enhancement (filed 2018 by a maintainer): gadget snaps only copy gadget.yaml into the snap without validating its contents. Still unimplemented — both setup_assets.py and services/package.py just copy/read the file. No labels or comments; needs triage.
76%
#1638824 Support gadget snaps snapcraft (launchpad) closed Gadget snap support (including gadget.yaml handling) was merged to snapcore/snapcraft via PR #886, commit 5610f0eaf 'Support for gadget snaps (#886)', after a successful PC gadget build; the launchpad issue was then closed.
73%
#3742 parts: copy kernel.yaml and gadget.yaml snapcraft merged Merged PR #3742 via c94bee075 (commit 48c34d8f0), copying gadget.yaml and optional kernel.yaml from the project root into the packaged meta directory by snap type.
71%
#303 Gadget snap extension imagecraft open Maintainer feature request: an extension that reads a local gadget snap's gadget.yaml and applies its values to imagecraft.yaml, removing duplicated partition config. Blocked on an extensions mechanism that still does not exist in the codebase.
71%