fix: make the -p and -o arguments work correctly
Metadata
Current evaluation
Merged fix for charmcraft pack CLI arguments. Corrects -o to function outside the container and -p to properly set the project directory, resolving issue #1930. Approved by reviewers and merged after CI validation.
Suggested action: —
No scores available.
Issue body
For the `-o` output directory option, ensure that this applies outside of the container (where it likely does not exist and is not the point of the option). For the `-p` option, ensure the requested path is used.
Together, this allows running `charmcraft pack -p /some/other/place -o /another/different/place` so that the packing can point to a project location not in the pwd and the charm(s) written to a third place.
Fixes #1930
---
- [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/).
- [x] I've successfully run `make lint && make test`. (`lint` and `test_uv` fail but also on main)
- [x] I've added or updated any relevant documentation.
- [x] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for charmcraft pack CLI arguments. Corrects -o to function outside the container and -p to properly set the project directory, resolving issue #1930. Approved by reviewers and merged after CI validation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for charmcraft pack CLI arguments. The -o output directory option now correctly applies outside the container, and the -p project directory option properly uses the specified path. Resolves #1930. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for charmcraft pack -p and -o arguments. The -o output flag now works outside the container, and -p correctly applies the specified project path. This enables separate project and output locations, resolving #1930. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2361 charmcraft errors out when mixing -p and -o flags | charmcraft | closed | Resolved in PR #2600. charmcraft pack no longer fails with a FileNotFoundError when combining -p and -o flags. Regression tests were added in PR #2735. | |
| #2498 fix: `charmcraft pack --project-dir` with metadata.yaml | charmcraft | closed | Merged fix for charmcraft pack --project-dir failing with legacy metadata.yaml. Resolved by changing the working directory to the project directory before loading and preprocessing configuration files. Resolves issue #2493. |