← 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: 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.

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] 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
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.
qwen3.6-35b-a3b-mtp-q6 Merged. Added the override-pull scriptlet to Snapcraft, enabling developers to override the plugin pull step. Introduced the snapcraftctl pull subcommand and fixed the Local source handler to preserve pre-pull changes. Resolves #1672.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2653 scriplets: run override-pull on update_pull snapcraft merged Merged fix for snapcraft losing script-generated metadata during re-runs. The change re-executes override-pull scriplets on pull step re-run, tracks the current step in the plugin handler, and adds a regression test. Approved and merged after passing CI.
80%
#2052 many: add override-prime scriptlet snapcraft merged Merged after approval and passing CI checks. Adds the override-prime scriptlet and prime subcommand to snapcraftctl, resolving issue #1674.
73%
#2002 many: add snapcraftctl command for scriptlets snapcraft merged Merged. Adds snapcraftctl CLI for scriptlet-to-Snapcraft communication. Introduces snapcraftctl build for override-build, resolving #1675 and LP: #1751749. Approved with passing CI across 28 files.
73%
#2049 many: add override-stage scriptlet snapcraft merged Merged override-stage scriptlet, resolving issue #1673. Introduces stage step override capability and a snapcraftctl stage subcommand for default behavior. Author fixed FakeLXD test failures prior to merge.
70%