summaryrefslogtreecommitdiffstats
path: root/recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2022-09-14 20:34:11 -0400
committerBruce Ashfield <bruce.ashfield@gmail.com>2022-09-14 20:34:11 -0400
commit1242b97f7f488180554dabc65a1d5c5e140a5876 (patch)
tree7bc64eba969610691fcab8546e86d20ff5435322 /recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb
parent26f698cdb8881bc395ef679776d7987c7db1c0e8 (diff)
downloadmeta-virtualization-1242b97f7f488180554dabc65a1d5c5e140a5876.tar.gz
oci-runtime-tools: fix TMPDIR references
The structure of the source code layout that was used by this recipe required symlinking subirectories of the source into a location that would be searched by go. While this fixes the build, and produces a working binary, go stores the location into the binary itself. Those stored paths reference the build directory, making the result not reproducible. With this change, we create an alternate structure that doesn't require symlinking and allows go to find the components during build. This results in a simpler recipe and binaries without TMPDIR references. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb')
-rw-r--r--recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb27
1 files changed, 9 insertions, 18 deletions
diff --git a/recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb b/recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb
index 0ba0b56c..8eb272ae 100644
--- a/recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb
+++ b/recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb
@@ -1,9 +1,9 @@
1HOMEPAGE = "https://github.com/opencontainers/runtime-tools" 1HOMEPAGE = "https://github.com/opencontainers/runtime-tools"
2SUMMARY = "oci-runtime-tool is a collection of tools for working with the OCI runtime specification" 2SUMMARY = "oci-runtime-tool is a collection of tools for working with the OCI runtime specification"
3LICENSE = "GPL-2.0-only" 3LICENSE = "GPL-2.0-only"
4LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=b355a61a394a504dacde901c958f662c" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=b355a61a394a504dacde901c958f662c"
5 5
6SRC_URI = "git://github.com/opencontainers/runtime-tools.git;branch=master;protocol=https \ 6SRC_URI = "git://github.com/opencontainers/runtime-tools.git;branch=master;protocol=https;destsuffix=git/src/github.com/opencontainers/runtime-tools \
7 file://0001-build-use-for-cross-compiler.patch \ 7 file://0001-build-use-for-cross-compiler.patch \
8 " 8 "
9 9
@@ -16,10 +16,12 @@ INSANE_SKIP:${PN} += "ldflags textrel"
16inherit goarch 16inherit goarch
17inherit go 17inherit go
18 18
19S = "${WORKDIR}/git/src/github.com/opencontainers/runtime-tools"
20
19do_compile() { 21do_compile() {
20 export GOARCH="${TARGET_GOARCH}" 22 export GOARCH="${TARGET_GOARCH}"
23 export GOPATH="${WORKDIR}/git/"
21 export GOROOT="${STAGING_LIBDIR}/go" 24 export GOROOT="${STAGING_LIBDIR}/go"
22 export GOPATH="${S}/src/import:${S}/src/import/vendor"
23 25
24 # Pass the needed cflags/ldflags so that cgo 26 # Pass the needed cflags/ldflags so that cgo
25 # can find the needed headers files and libraries 27 # can find the needed headers files and libraries
@@ -29,34 +31,23 @@ do_compile() {
29 export CGO_CFLAGS="${TARGET_CFLAGS}" 31 export CGO_CFLAGS="${TARGET_CFLAGS}"
30 export CGO_LDFLAGS="${TARGET_LDFLAGS}" 32 export CGO_LDFLAGS="${TARGET_LDFLAGS}"
31 export GO111MODULE=off 33 export GO111MODULE=off
34 export GOFLAGS="-mod=vendor"
32 35
33 # fixes: 36 # fixes:
34 # cannot find package runtime/cgo (using -importcfg) 37 # cannot find package runtime/cgo (using -importcfg)
35 # ... recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link: 38 # ... recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link:
36 # cannot open file : open : no such file or directory 39 # cannot open file : open : no such file or directory
37 export GO_BUILD_FLAGS="-a -pkgdir dontusecurrentpkgs" 40 # export GO_BUILD_FLAGS="-a -pkgdir dontusecurrentpkgs"
38 export EXTRA_FLAGS="-trimpath" 41 export EXTRA_FLAGS="-trimpath"
39 42
40 # link fixups for compilation 43 cd ${S}
41 rm -f ${S}/src/import/vendor/src
42 ln -sf ./ ${S}/src/import/vendor/src
43 mkdir -p ${S}/src/import/vendor/github.com/opencontainers/runtime-tools
44 ln -sf ../../../../generate ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/generate
45 ln -sf ../../../../validate ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/validate
46 ln -sf ../../../../cmd ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/cmd
47 ln -sf ../../../../error ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/error
48 ln -sf ../../../../specerror ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/specerror
49 ln -sf ../../../../cgroups ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/cgroups
50 ln -sf ../../../../filepath ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/filepath
51 ln -sf ../../../../validation ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/validation
52 cd ${S}/src/import
53 44
54 oe_runmake tool 45 oe_runmake tool
55} 46}
56 47
57do_install() { 48do_install() {
58 install -d ${D}/${sbindir} 49 install -d ${D}/${sbindir}
59 install ${S}/src/import/oci-runtime-tool ${D}/${sbindir}/oci-runtime-tool 50 install ${S}/oci-runtime-tool ${D}/${sbindir}/oci-runtime-tool
60} 51}
61 52
62deltask compile_ptest_base 53deltask compile_ptest_base