Skip to content

feat: mediate creation of gadget.yaml and kernel.yaml - #6369

Open
cmatsuoka wants to merge 1 commit into
mainfrom
work/SNAPCRAFT-1373-Mediate-metadata-creation-for-gadget-and-kernel-snaps
Open

feat: mediate creation of gadget.yaml and kernel.yaml#6369
cmatsuoka wants to merge 1 commit into
mainfrom
work/SNAPCRAFT-1373-Mediate-metadata-creation-for-gadget-and-kernel-snaps

Conversation

@cmatsuoka

Copy link
Copy Markdown
Contributor

Create the gadget.yaml and kernel.yaml metadata files using the new
packaging API to skip repacking when contents were not changed.


  • I've followed the contribution guidelines.
  • I've signed the CLA.
  • I've successfully run make lint && make test.
  • I've added or updated any relevant documentation.
  • In documents I changed, I added a meta description if one was missing.
  • I've updated the relevant release notes.

Copilot AI review requested due to automatic review settings July 23, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and meta/kernel.yaml, and materialize gadget/kernel YAML into the prime meta/ directory during write_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.yaml as a string (get_str) and bump craft-application dependency.

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.

Comment thread snapcraft/parts/setup_assets.py Outdated
Comment thread snapcraft/services/package.py
Comment thread snapcraft/services/package.py
@cmatsuoka
cmatsuoka force-pushed the work/SNAPCRAFT-1373-Mediate-metadata-creation-for-gadget-and-kernel-snaps branch 2 times, most recently from be69149 to 6b88cf5 Compare July 23, 2026 19:39
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
cmatsuoka force-pushed the work/SNAPCRAFT-1373-Mediate-metadata-creation-for-gadget-and-kernel-snaps branch from 6b88cf5 to f393f10 Compare July 23, 2026 19:58
@cmatsuoka
cmatsuoka marked this pull request as ready for review July 23, 2026 22:14
@cmatsuoka
cmatsuoka requested a review from mr-cal as a code owner July 23, 2026 22:14

@mr-cal mr-cal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think you need to do a make format.

Comment on lines +37 to +39
return project.base == "core22" or (
project.base is None and project.build_base == "core22"
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

@cmatsuoka
cmatsuoka requested a review from lengau July 24, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants