← Back to issue list

pluginhandler: fix stage-snaps for v2 plugins

View original Github issue

Metadata

Project
snapcraft
Number
#3211
Type
pull request
State
merged
Author
jhenstridge
Labels
—
Created
Updated
Closed

Current evaluation

Merged in canonical/snapcraft#3211 (0870f1738), fixing v2 stage-snaps handling and preventing prepare_build from discarding unpacked snaps.

Resolution: closed resolved

Reason: The merged PR corrected stage-snap unpacking for v2 plugins and retained unpacked snaps when prepare_build cleared the install directory. It landed as commit 0870f1738.

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 `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh tests/unit`? ----- The `PluginHandler._unpack_stage_snaps` method makes use of an attribute on the plugin object that does not seem to exist on v2 plugins, leading to errors like: ``` ... File "/snap/snapcraft/5143/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 247, in _run_pull self._run_step(step=steps.PULL, part=part, progress="Pulling") File "/snap/snapcraft/5143/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 322, in _run_step self._prepare_step(step=step, part=part) File "/snap/snapcraft/5143/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 313, in _prepare_step preparation_function() File "/snap/snapcraft/5143/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 469, in prepare_pull self._unpack_stage_snaps() File "/snap/snapcraft/5143/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 434, in _unpack_stage_snaps logger.debug("Unpacking stage-snaps to {!r}".format(self.plugin.stage_snaps)) AttributeError: 'NilPlugin' object has no attribute 'stage_snaps' ``` The value being substituted into the log message doesn't really match the text of the log message, so I switched it to use `self.part_install_dir` instead.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#3211 (0870f1738), fixing v2 stage-snaps handling and preventing prepare_build from discarding unpacked snaps.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#3211 (0870f1738), fixing v2 stage-snaps handling and preventing prepare_build from discarding unpacked snaps.
qwen/qwen3.6-35b-a3b — — Merged fix for v2 plugin AttributeError caused by missing stage_snaps attribute. Updated logging to use part_install_dir and resolved prepare_build clearing the install directory. Approved and passed CI.
qwen3.6-35b-a3b-mtp-q6 — — Merged fix for AttributeError in _unpack_stage_snaps with v2 plugins. prepare_build() cleared the install directory, deleting unpacked stage snaps. Updated logic preserves and re-unpacks stage snaps during build preparation.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#3317 plugin handler: properly handle snapcraftctl errors snapcraft merged Merged PR #3317 in commit 9c622ecda, making snapcraftctl exit nonzero on build/pull failures and stop override scripts after parent operation errors.
74%
#3077 pluginhandler: skip plugin clean_pull for PluginV2 snapcraft merged Merged in snapcraft#3077 (commit 167cc98ec), skipping PluginV2 clean_pull calls and updating unit tests because the method no longer exists; fixes SNAPCRAFT-1JS.
73%
#1805214 stage-snaps snapcraft (launchpad) closed Feature request for a stage-snaps keyword (unpack a snap's content into the snap being built, like stage-packages) was implemented and merged in canonical/snapcraft#2468 (commit 0983e4063), then shipped in the 3.2 release; follow-up fixes in #2525 and #3211.
71%
#1611827 dump plugin with stage-packages fails snapcraft (launchpad) closed Resolved by merged snapcore/snapcraft PR #729, commit 26ae9a507: the dump plugin no longer removes the install directory, fixing stage-packages builds.
71%
#2942 pluginhandler: do not search installdir or stagedir for dependencies snapcraft merged Merged in snapcraft#2942 (commit 80ff1935), restricting plugin dependency checks to primedir so files filtered from the final snap are not used.
71%
#1873349 snapcraft sometimes generates invalid stage-packages entries in manifest.yaml snapcraft (launchpad) closed Fixed by snapcraft#3047 (commit 2e6549953), correcting install_stage_packages() output so manifest stage-packages entries are valid. The fix landed on edge; no release was affected.
70%