Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pluginhandler: fix stage-snaps for v2 plugins #3211

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion snapcraft/internal/pluginhandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def _unpack_stage_snaps(self):
if not stage_snaps:
return

logger.debug("Unpacking stage-snaps to {!r}".format(self.plugin.stage_snaps))
logger.debug("Unpacking stage-snaps to {!r}".format(self.part_install_dir))
snap_files = iglob(os.path.join(self.part_snaps_dir, "*.snap"))
snap_sources = (
sources.Snap(source=s, source_dir=self.part_snaps_dir) for s in snap_files
Expand Down Expand Up @@ -571,6 +571,7 @@ def prepare_build(self, force=False):
# Stage packages are fetched and unpacked in the pull step, but we'll
# unpack again here just in case the build step has been cleaned.
self._unpack_stage_packages()
self._unpack_stage_snaps()

def build(self, force=False):
self.makedirs()
Expand Down
10 changes: 6 additions & 4 deletions tests/spread/general/stage_snaps/task.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
summary: stage-snaps

# We currently only have core18 on a stable channel
systems:
- ubuntu-18.04-64
- ubuntu-18.04-amd64
- ubuntu-18.04-i386
- ubuntu-20.04*
- ubuntu-18.04*

environment:
STAGE_SNAPS/default: "hello"
STAGE_SNAPS/channel: "hello/latest/stable"
STAGE_SNAPS/n_snaps: "hello, black/latest/edge"

prepare: |
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh
. "$TOOLS_DIR/snapcraft-yaml.sh"

mkdir test-snap
cd test-snap
snapcraft init
set_base "snap/snapcraft.yaml"

echo " stage-snaps: [$STAGE_SNAPS]" >> snap/snapcraft.yaml

Expand Down