fix(package): add charmcraft.yaml fields to the packed metadata.yaml
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
Fixes #2680
With `name` in charmcraft.yaml and a separate metadata.yaml, the packed charm used metadata.yaml as is, so `name` was missing and Juju refused the charm.
Any of `name`, `summary` and `description` missing from metadata.yaml are now filled in from the project. If it already has all three, it's packed unchanged as before. Missing fields get appended to the end of the file, so its comments and ordering stay. If that doesn't parse back to the same data (a flow-style mapping, say), the file is re-dumped instead.
I updated `test_get_metadata_yaml_prefers_project_file`, which was asserting the old behaviour. I couldn't find an unreleased section for release notes, so let me know where you want an entry.
I ran ruff, ty, codespell and the full test suite in a Linux container rather than `make lint && make test`. No new failures: the tests that fail there fail on main too.
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [ ] 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](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.
- [ ] I've updated the relevant release notes.
Evaluation history
No evaluation history available.
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| created |
Related issues
No embedding available for this issue yet. Run scripts/run_llm.py evaluate to enable similarity search.