[lxc-devel] [lxd-pkg-snap/latest-edge] nogogetgo: fix getting build base on snapcraft 4.0+

cjp256 on Github lxc-bot at linuxcontainers.org
Fri May 29 14:46:15 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 695 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200529/fd972ce4/attachment.bin>
-------------- next part --------------
From 05027d811a0f1fc6be266afc2507a0f7a1d10eaa Mon Sep 17 00:00:00 2001
From: LXD snap builder <noreply at linuxcontainers.org>
Date: Fri, 29 May 2020 13:41:58 +0000
Subject: [PATCH] nogogetgo: fix getting build base on snapcraft 4.0+

If available, use project._get_build_base() to get the project's
build base.

If _get_build_base() is not available (snapcraft < 4.0), then
resort to using project.info.base, which is safe to use for this
project as it specifies a base.  ProjectInfo will eventually be
removed, so this prioritizes the new interface.

Signed-off-by: LXD snap builder <noreply at linuxcontainers.org>
---
 snap/plugins/nogetgo.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/snap/plugins/nogetgo.py b/snap/plugins/nogetgo.py
index 7005580..b527ca3 100644
--- a/snap/plugins/nogetgo.py
+++ b/snap/plugins/nogetgo.py
@@ -140,7 +140,12 @@ def get_pull_properties(cls) -> List[str]:
     def __init__(self, name: str, options, project: "Project") -> None:
         super().__init__(name, options, project)
 
-        self._setup_base_tools(options.go_channel, project.info.get_build_base())
+        if hasattr(project, "_get_build_base"):
+            base = project._get_build_base()
+        else:
+            base = project.info.base
+
+        self._setup_base_tools(options.go_channel, base)
         self._is_classic = project.info.confinement == "classic"
 
         self._install_bin_dir = os.path.join(self.installdir, "bin")


More information about the lxc-devel mailing list