fix: hooks: process generated hooks
Metadata
Current evaluation
Merged fix to include generated hooks in snap packages. Ports legacy behavior to snapcraft, writing wrappers to meta/hooks/ while preserving pre-existing hooks. Added spread tests for core18, core20, and core22.
Suggested action: —
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 `make lint`?
- [X] Have you successfully run `pytest tests/unit`?
-----
#### Overview
Port support for generated hooks from `snapcraft_legacy` to `snapcraft`.
#### Issue
- Hooks generated during snapcraft's lifecycle were not being included in the snap.
- https://forum.snapcraft.io/t/call-for-testing-snapcraft-7/30201/43
#### Changes
- `core22` snaps now follow same behavior as `core18` and `core20`
- Hooks generated during the lifecycle are included in the final snap package
- A wrapper for each generated hook is written to `meta/hooks/`
- Pre-existing hooks in `snap/hooks/` take priority over generated hooks
- Spread test for generated and pre-existing hooks for `core18`, `core20`, and `core22`
(CRAFT-1159)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix to include generated hooks in snap packages. Ports legacy behavior to snapcraft, writing wrappers to meta/hooks/ while preserving pre-existing hooks. Added spread tests for core18, core20, and core22. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix porting generated hook support to snapcraft. Core22 snaps now include lifecycle-generated hooks via meta/hooks/ wrappers, prioritizing pre-existing hooks. Spread tests verify behavior across core18, core20, and core22. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix porting generated hook support from legacy to snapcraft. Core22 snaps now include lifecycle-generated hooks wrapped in meta/hooks/, with pre-existing hooks taking priority. Includes spread tests. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1026 Add support for hooks. | snapcraft | merged | Merged into master to add hook support to snapcraft. Hooks are now supported via convention by placing executables in the snap/hooks directory or installing them from parts. Approved and passed CI checks. | |
| #3659 meta: add support for hooks | snapcraft | merged | Merged into snapcraft/7.0 branch after reviewer approval and passing CI checks. Adds support for hooks in snapcraft.yaml, modifying four files with 116 additions and 24 deletions while maintaining 100% diff coverage. |