diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2022-09-14 20:34:11 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2022-09-14 20:34:11 -0400 |
commit | 1242b97f7f488180554dabc65a1d5c5e140a5876 (patch) | |
tree | 7bc64eba969610691fcab8546e86d20ff5435322 | |
parent | 26f698cdb8881bc395ef679776d7987c7db1c0e8 (diff) | |
download | meta-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>
-rw-r--r-- | recipes-containers/oci-runtime-tools/files/0001-build-use-for-cross-compiler.patch | 8 | ||||
-rw-r--r-- | recipes-containers/oci-runtime-tools/oci-runtime-tools_git.bb | 27 |
2 files changed, 13 insertions, 22 deletions
diff --git a/recipes-containers/oci-runtime-tools/files/0001-build-use-for-cross-compiler.patch b/recipes-containers/oci-runtime-tools/files/0001-build-use-for-cross-compiler.patch index 98194265..1c4addab 100644 --- a/recipes-containers/oci-runtime-tools/files/0001-build-use-for-cross-compiler.patch +++ b/recipes-containers/oci-runtime-tools/files/0001-build-use-for-cross-compiler.patch | |||
@@ -5,13 +5,13 @@ Subject: [PATCH] build: use for cross compiler | |||
5 | 5 | ||
6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | 6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> |
7 | --- | 7 | --- |
8 | a/src/import/Makefile | 4 ++-- | 8 | a/Makefile | 4 ++-- |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 9 | 1 file changed, 2 insertions(+), 2 deletions(-) |
10 | 10 | ||
11 | Index: oci-runtime-tools-0.9.0+gitAUTOINC+0105384f68/src/import/Makefile | 11 | Index: oci-runtime-tools-0.9.0+gitAUTOINC+0105384f68/Makefile |
12 | =================================================================== | 12 | =================================================================== |
13 | --- oci-runtime-tools-0.9.0+gitAUTOINC+0105384f68.orig/src/import/Makefile | 13 | --- oci-runtime-tools-0.9.0+gitAUTOINC+0105384f68.orig/Makefile |
14 | +++ oci-runtime-tools-0.9.0+gitAUTOINC+0105384f68/src/import/Makefile | 14 | +++ oci-runtime-tools-0.9.0+gitAUTOINC+0105384f68/Makefile |
15 | @@ -13,11 +13,11 @@ | 15 | @@ -13,11 +13,11 @@ |
16 | all: tool runtimetest validation-executables | 16 | all: tool runtimetest validation-executables |
17 | 17 | ||
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 @@ | |||
1 | HOMEPAGE = "https://github.com/opencontainers/runtime-tools" | 1 | HOMEPAGE = "https://github.com/opencontainers/runtime-tools" |
2 | SUMMARY = "oci-runtime-tool is a collection of tools for working with the OCI runtime specification" | 2 | SUMMARY = "oci-runtime-tool is a collection of tools for working with the OCI runtime specification" |
3 | LICENSE = "GPL-2.0-only" | 3 | LICENSE = "GPL-2.0-only" |
4 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=b355a61a394a504dacde901c958f662c" | 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b355a61a394a504dacde901c958f662c" |
5 | 5 | ||
6 | SRC_URI = "git://github.com/opencontainers/runtime-tools.git;branch=master;protocol=https \ | 6 | SRC_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" | |||
16 | inherit goarch | 16 | inherit goarch |
17 | inherit go | 17 | inherit go |
18 | 18 | ||
19 | S = "${WORKDIR}/git/src/github.com/opencontainers/runtime-tools" | ||
20 | |||
19 | do_compile() { | 21 | do_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 | ||
57 | do_install() { | 48 | do_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 | ||
62 | deltask compile_ptest_base | 53 | deltask compile_ptest_base |