feat: mediate creation of gadget.yaml and kernel.yaml - #6369
Open
cmatsuoka wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Snapcraft’s core24+ (“craft-application”) packaging path to mediate creation of meta/gadget.yaml, meta/kernel.yaml, and meta/component.yaml contents, aiming to avoid unnecessary repacks when those files’ contents have not changed.
Changes:
- Add mediated generators in the Package service for
meta/component.yaml,meta/gadget.yaml, andmeta/kernel.yaml, and materialize gadget/kernel YAML into the primemeta/directory duringwrite_metadata(). - Adjust
setup_assets()to only copy gadget/kernel YAML via the legacy path (core22), and add/extend unit tests for these behaviors. - Refactor component metadata generation to support rendering
component.yamlas a string (get_str) and bumpcraft-applicationdependency.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Bumps craft-application dependency constraint to support new packaging behavior. |
| tests/unit/services/test_package.py | Adds coverage for gadget/kernel mediation behavior and write_metadata() output. |
| tests/unit/services/test_package_components.py | Adds coverage for component mediation partition naming/registry behavior. |
| tests/unit/parts/test_setup_assets.py | Ensures core24 no longer copies gadget/kernel YAML in legacy asset setup path. |
| tests/unit/models/test_assertions.py | Removes ty: ignore around ValidationAssertion construction. |
| tests/unit/meta/test_component_yaml.py | Adds coverage for component_yaml.get_str(). |
| snapcraft/services/package.py | Introduces mediated generators and writes gadget/kernel YAML into prime/meta/. |
| snapcraft/parts/setup_assets.py | Adds legacy gating helper and conditionalizes gadget/kernel YAML copying. |
| snapcraft/meta/component_yaml.py | Refactors component metadata generation into get_metadata() + get_str() and updates write(). |
| snapcraft/commands/validations.py | Removes ty: ignore around ValidationAssertion construction. |
cmatsuoka
force-pushed
the
work/SNAPCRAFT-1373-Mediate-metadata-creation-for-gadget-and-kernel-snaps
branch
2 times, most recently
from
July 23, 2026 19:39
be69149 to
6b88cf5
Compare
Create the gadget.yaml and kernel.yaml metadata files using the new packaging API to skip repacking when contents were not changed. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
cmatsuoka
force-pushed
the
work/SNAPCRAFT-1373-Mediate-metadata-creation-for-gadget-and-kernel-snaps
branch
from
July 23, 2026 19:58
6b88cf5 to
f393f10
Compare
cmatsuoka
marked this pull request as ready for review
July 23, 2026 22:14
mr-cal
approved these changes
Jul 24, 2026
Comment on lines
+37
to
+39
| return project.base == "core22" or ( | ||
| project.base is None and project.build_base == "core22" | ||
| ) |
Collaborator
There was a problem hiding this comment.
This should simplify it:
Suggested change
| return project.base == "core22" or ( | |
| project.base is None and project.build_base == "core22" | |
| ) | |
| return project.get_effective_base() == "core22" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Create the gadget.yaml and kernel.yaml metadata files using the new
packaging API to skip repacking when contents were not changed.
make lint && make test.