← Back to issue list

refactor: change PackCommand parent

View original Github issue

Metadata

Project
snapcraft
Number
#4797
Type
pull request
State
merged
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

PR #4797 merged as commit b6f464c78, reparenting snapcraft's PackCommand onto craft-application's PackCommand, deleting ~23 lines of duplicated code enabled by craft-application#340/#341.

Resolution: closed resolved

Reason: The pull request itself was merged (approved by 2 reviewers) as commit b6f464c78 "refactor: change PackCommand parent (#4797)" in canonical/snapcraft. snapcraft/commands/lifecycle.py now defines PackCommand(craft_application.commands.lifecycle.PackCommand) with only Snapcraft-specific overrides, per the upstream craft-application PRs #340 and #341 cited in the description.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] Have you successfully run `tox run -m lint`? - [x] Have you successfully run `tox run -e test-py310`? (supported versions: `py39`, `py310`, `py311`, `py312`) ----- Upstream simplifications (https://github.com/canonical/craft-application/pull/340 and https://github.com/canonical/craft-application/pull/341) allow us to remove some duplicated code.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved PR #4797 merged as commit b6f464c78, reparenting snapcraft's PackCommand onto craft-application's PackCommand, deleting ~23 lines of duplicated code enabled by craft-application#340/#341.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#4797, changing PackCommand's parent to remove 23 net lines of duplicated code following craft-application#340 and #341.
qwen/qwen3.6-35b-a3b — — Merged a refactor updating the PackCommand parent class to eliminate duplicated code via upstream simplifications. Approved by two reviewers, passed CI, and reduced the codebase by 23 lines across one file.
qwen3.6-35b-a3b-mtp-q6 — — Merged a refactor to change the PackCommand parent class, removing duplicated code via upstream craft-application simplifications. The change passed lint and tests, and was merged despite a minor Codecov coverage warning.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-application#340 (confidence 85%)

    Upstream simplification (removal of duplicated parser/run code) that made this reparenting possible.

  • Related To: canonical/craft-application#341 (confidence 80%)

    Second upstream simplification cited as a prerequisite for the refactor.

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

    Preceding commit48483c4e3 'fix: allow packing a directory' added the directory argument PackCommand still overrides.

Related issues

Issue Project State Summary Similarity
#1704 craft-application migration cleanup: pack command charmcraft merged Merged #1704 (commit cfc37020), removing the obsolete craft-application migration pack command missed during earlier cleanup.
74%
#4682 refactor(app): use more code from craft-app snapcraft merged Merged as c9b6941d4, replacing Snapcraft-specific application logic with craft-app functionality (36 additions and 49 deletions across three files).
73%
#5239 refactor: use craft-application's remote-build snapcraft merged Merged PR #5239 as f31d99498, replacing Snapcraft’s legacy remote-build path with craft-application’s command for CRAFT-4044.
73%
#2861 meta: remove Application's `prepend_command_chain` snapcraft merged PR #2861 merged as commit 61bd3ab5d: dropped Application.prepend_command_chain and renamed snap packaging's _generate_command_chain to _generate_snapcraft_runner. Follow-up fix #2864 also merged.
72%
#1532 Use craft-application lifecycle commands charmcraft closed Most bespoke lifecycle commands were replaced with craft-application's upstream commands by merged PR #1538 (commit 5e3b927c); pack cleanup followed in #1704 (cfc37020).
72%
#3639 commands: add pack command and set it as default (CRAFT-762) snapcraft merged Merged PR #3639 added the pack command and made it the default for creating a snap package. Landed via merge commit 2cdb81ed4.
71%
#6145 refactor: migrate gated command snapcraft merged Merged PR #6145 as commit 21091b932, migrating the gated command from snapcraft_legacy and resolving SNAPCRAFT-1314.
71%
#100 feat(snapcraft/pack): node-based rewrite craft-actions merged Merged #100 (CRAFT-5204): rewrote the snapcraft/pack action in Node, fixing Snapcraft 7 default-command handling, adding .comp output support and unit tests. Approved by 2 reviewers, all CI jobs green.
71%
#1275 feat: use craft-application for pack command charmcraft closed Closed unmerged as superseded after a get_build_plan error. The broader craft-application migration landed in #1538 (5e3b927c), followed by pack-command cleanup in #1704 (cfc37020).
71%
#478 refactor(pack): use craft-application YAML helpers in pack service imagecraft merged Merged PR #478 refactors ImagecraftPackService to use craft-application safe_yaml_load and dump_yaml instead of direct yaml.safe_load/safe_dump.
70%