← Back to issue list

many: add override-pull scriptlet

View original Github issue

Metadata

Project
snapcraft
Number
#2045
Type
pull request
State
merged
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Merged as commit 56c16cbc5: added override-pull and snapcraftctl pull; Local sources now merge into the existing directory to preserve pre-pull changes.

Resolution: closed resolved

Reason: PR #2045 was merged as commit 56c16cbc5, implementing the override-pull scriptlet and snapcraftctl pull command while adjusting source handling to preserve pre-pull work.

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] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- Currently Snapcraft supports the `override-build` scriptlet, which doesn't cover all use-cases, such as patching sources. This PR resolves #1672 by adding a new scriptlet called `override-pull` which, if specified, overrides the plugin's pull step. This PR also adds a `pull` subcommand to `snapcraftctl` to ensure developers can still complete the default pull action. Note that `override-pull` runs after `stage-packages` are fetched, but before any sources are fetched. However, the `Local` source currently toasts the destination directory before copying (since it's using `shutil.copytree`), which blows away anything one does before calling `snapcraftctl pull`. This logic has been migrated into the pluginhandler to ensure failed pulls are cleared before running again, and the `Local` source is now using `file_utils.link_or_copy_tree` to merge the source into the existing source directory.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged as commit 56c16cbc5: added override-pull and snapcraftctl pull; Local sources now merge into the existing directory to preserve pre-pull changes.
stealth/space-bunny-alpha — closed resolved Merged in #2045 (commit 56c16cbc5), adding override-pull and snapcraftctl pull; Local sources now merge into the existing directory, preserving pre-pull changes.
stealth/space-bunny-alpha — closed resolved Merged in #2045 (56c16cbc5), adding override-pull and snapcraftctl pull; Local sources now merge into existing trees, preserving pre-pull changes.
qwen/qwen3.6-35b-a3b — — Merged: added override-pull scriptlet and snapcraftctl pull subcommand to Snapcraft. Enables overriding the plugin pull step for source patching. Fixed Local source handling to preserve pre-pull changes.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Introduces an override-pull scriptlet and snapcraftctl pull subcommand to customize the plugin pull step. Updates the Local source to merge directories rather than overwrite them, preserving pre-pull changes. Resolves #1672.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: snapcraft#1672 (confidence 100%)

    Merged PR #2045 implemented the requested pull lifecycle hook and default pull command.

  • Related To: snapcraft#2113 (confidence 98%)

    Follow-up PR #2113 extended non-destructive source handling to other FileBase sources.

  • Related To: snapcraft#2653 (confidence 96%)

    Follow-up PR #2653 ensured override-pull runs when pulling repeats.

  • Related To: snapcraft#2103 (confidence 95%)

    PR #2103 packaged the override-pull functionality in Snapcraft 2.42.

Related issues

Issue Project State Summary Similarity
#2653 scriplets: run override-pull on update_pull snapcraft merged Merged in snapcraft#2653 (commit ae7ab338e), re-running override-pull scriptlets when pull repeats so snapcraftctl-generated metadata is preserved.
82%
#2049 many: add override-stage scriptlet snapcraft merged Merged in PR #2049 (commit c5ca9ef8), adding override-stage and snapcraftctl stage so overridden parts can invoke the default stage action, completing #1673.
73%
#2103 package: make use of snapcraftctl snapcraft features snapcraft merged Merged in #2103 as commit 60d505347 and shipped in 2.42, replacing prepare/build/install hooks with override-pull/override-build.
72%
#1672 Add pre-pull/pull/post-pull snapcraft closed Roadmap item delivered: override-pull (#2045), override-stage (#2049), and override-prime (#2052) scriptlets were added, completing lifecycle hooks around pull/build/stage/prime.
71%
#2278 snap: pull early snapcraft merged Merged #2278 (commit 7386bed80) reordered snapcraftctl execution so pull runs before set-version.
71%
#2002 many: add snapcraftctl command for scriptlets snapcraft merged Merged PR #2002 (commit bbca282fa) added the snapcraftctl CLI for scriptlets to talk to the parent Snapcraft process, including `snapcraftctl build` and the override-build scriptlet. Resolved #1675 and LP #1751749.
70%