-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
245 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- | ||
# | ||
# Copyright 2023 Canonical Ltd. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Legacy support for local plugins.""" | ||
|
||
import sys as _sys | ||
|
||
if _sys.platform == "linux": | ||
from snapcraft_legacy.sources import get | ||
|
||
__all__ = [ | ||
"get", | ||
] |
24 changes: 24 additions & 0 deletions
24
tests/spread/core22/set-version-twice/modified-snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: test-set-version-twice | ||
base: core22 | ||
version: '0.1' | ||
summary: Test fix for set version and out of order step execution | ||
description: | | ||
As described in https://bugs.launchpad.net/snapcraft/+bug/1831135/comments/10, | ||
a bug in craft-parts caused unexpected double setting of project variables | ||
such as `version`. Make sure this scenario builds correctly. | ||
adopt-info: part1 | ||
|
||
grade: devel | ||
confinement: devmode | ||
|
||
parts: | ||
part1: | ||
plugin: nil | ||
override-pull: | | ||
craftctl default | ||
craftctl set version=xx | ||
echo | ||
part2: | ||
plugin: nil | ||
after: [part1] |
23 changes: 23 additions & 0 deletions
23
tests/spread/core22/set-version-twice/original-snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: test-set-version-twice | ||
base: core22 | ||
version: '0.1' | ||
summary: Test fix for set version and out of order step execution | ||
description: | | ||
As described in https://bugs.launchpad.net/snapcraft/+bug/1831135/comments/10, | ||
a bug in craft-parts caused unexpected double setting of project variables | ||
such as `version`. Make sure this scenario builds correctly. | ||
adopt-info: part1 | ||
|
||
grade: devel | ||
confinement: devmode | ||
|
||
parts: | ||
part1: | ||
plugin: nil | ||
override-pull: | | ||
craftctl default | ||
craftctl set version=xx | ||
part2: | ||
plugin: nil | ||
after: [part1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
summary: Test fix for version setting corner case | ||
|
||
prepare: | | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
restore: | | ||
snapcraft clean | ||
rm -Rf subdir ./*.snap | ||
rm -f snap/*.yaml | ||
#shellcheck source=tests/spread/tools/snapcraft-yaml.sh | ||
. "$TOOLS_DIR/snapcraft-yaml.sh" | ||
execute: | | ||
mkdir -p snap | ||
cp original-snapcraft.yaml snap/snapcraft.yaml | ||
snapcraft prime | ||
cp modified-snapcraft.yaml snap/snapcraft.yaml | ||
snapcraft build part2 | ||
snapcraft prime | ||
cp original-snapcraft.yaml snap/snapcraft.yaml | ||
snapcraft build part2 | ||
snapcraft prime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/spread/plugins/v1/x-local/snaps/source-get/snap/plugins/x_local_plugin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- | ||
# | ||
# Copyright 2023 Canonical Ltd. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import snapcraft | ||
from snapcraft.plugins.v1 import PluginV1 | ||
|
||
|
||
class LocalPlugin(PluginV1): | ||
@classmethod | ||
def schema(cls): | ||
schema = super().schema() | ||
|
||
schema["properties"]["foo"] = {"type": "string"} | ||
|
||
return schema | ||
|
||
@classmethod | ||
def get_pull_properties(cls): | ||
return ["foo", "stage-packages"] | ||
|
||
@classmethod | ||
def get_build_properties(cls): | ||
return ["foo", "stage-packages"] | ||
|
||
def pull(self): | ||
super().pull() | ||
print(snapcraft.sources.get) | ||
|
||
def build(self): | ||
return self.run(["touch", "build-stamp"], self.installdir) |
12 changes: 12 additions & 0 deletions
12
tests/spread/plugins/v1/x-local/snaps/source-get/snap/snapcraft.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: test-local-plugins | ||
base: core18 | ||
version: "0.1" | ||
summary: local plugin using snapcraft.sources.get | ||
description: Tests if local plugins load and can build | ||
confinement: strict | ||
grade: devel | ||
|
||
parts: | ||
x-local-plugin: | ||
plugin: x-local-plugin | ||
source: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters