summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-05-16 17:32:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-05-21 12:08:04 +0100
commit8e071ad43fd70fcdac409f7d544f6749e9ad32a8 (patch)
tree12789fa1bef24841c13c8859d3335fd820ccc7e7
parent510daf16bcb353f3c582c35fff9aac771542382b (diff)
downloadpoky-8e071ad43fd70fcdac409f7d544f6749e9ad32a8.tar.gz
go: Drop fork of unpack code, mandate GO_SRCURI_DESTSUFFIX
The go class has its own fork of the base unpack code. At the time I was told this was fine, it now isn't as that code is changing. Rather than have a fork, put the path magic into a variable and then go recipes can just set SRC_URI appropriately, e.g.: git://go.googlesource.com/example;branch=master;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX} This avoids having special case hacks in the class and makes everything a little more obvious. (From OE-Core rev: cc4ec43a2b657fb4c58429ab14f1edc2473c1327) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-recipe/go.bbclass16
-rw-r--r--meta/recipes-extended/go-examples/go-helloworld_0.1.bb2
2 files changed, 3 insertions, 15 deletions
diff --git a/meta/classes-recipe/go.bbclass b/meta/classes-recipe/go.bbclass
index d32509aa6d..9146dd611e 100644
--- a/meta/classes-recipe/go.bbclass
+++ b/meta/classes-recipe/go.bbclass
@@ -80,19 +80,7 @@ export GOPROXY ??= "https://proxy.golang.org,direct"
80export GOTMPDIR ?= "${WORKDIR}/build-tmp" 80export GOTMPDIR ?= "${WORKDIR}/build-tmp"
81GOTMPDIR[vardepvalue] = "" 81GOTMPDIR[vardepvalue] = ""
82 82
83python go_do_unpack() { 83GO_SRCURI_DESTSUFFIX = "${@os.path.join(os.path.basename(d.getVar('S')), 'src', d.getVar('GO_IMPORT')) + '/'}"
84 src_uri = (d.getVar('SRC_URI') or "").split()
85 if len(src_uri) == 0:
86 return
87
88 fetcher = bb.fetch2.Fetch(src_uri, d)
89 for url in fetcher.urls:
90 if fetcher.ud[url].type == 'git':
91 if fetcher.ud[url].parm.get('destsuffix') is None:
92 s_dirname = os.path.basename(d.getVar('S'))
93 fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src', d.getVar('GO_IMPORT')) + '/'
94 fetcher.unpack(d.getVar('WORKDIR'))
95}
96 84
97go_list_packages() { 85go_list_packages() {
98 ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \ 86 ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
@@ -151,7 +139,7 @@ go_stage_testdata() {
151 cd "$oldwd" 139 cd "$oldwd"
152} 140}
153 141
154EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install 142EXPORT_FUNCTIONS do_configure do_compile do_install
155 143
156FILES:${PN}-dev = "${libdir}/go/src" 144FILES:${PN}-dev = "${libdir}/go/src"
157FILES:${PN}-staticdev = "${libdir}/go/pkg" 145FILES:${PN}-staticdev = "${libdir}/go/pkg"
diff --git a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
index 74f3520eae..575ee81b50 100644
--- a/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
+++ b/meta/recipes-extended/go-examples/go-helloworld_0.1.bb
@@ -5,7 +5,7 @@ HOMEPAGE = "https://golang.org/"
5LICENSE = "MIT" 5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
7 7
8SRC_URI = "git://go.googlesource.com/example;branch=master;protocol=https" 8SRC_URI = "git://go.googlesource.com/example;branch=master;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX}"
9SRCREV = "32022caedd6a177a7717aa8680cbe179e1045935" 9SRCREV = "32022caedd6a177a7717aa8680cbe179e1045935"
10UPSTREAM_CHECK_COMMITS = "1" 10UPSTREAM_CHECK_COMMITS = "1"
11 11