summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2022-09-14 22:01:22 -0400
committerBruce Ashfield <bruce.ashfield@gmail.com>2022-09-14 22:01:22 -0400
commit79ff2a5b00900b95076ca838a79d90ede59abdad (patch)
tree646543be406565d59dd12bdd6d39c3176227c12f
parent1242b97f7f488180554dabc65a1d5c5e140a5876 (diff)
downloadmeta-virtualization-79ff2a5b00900b95076ca838a79d90ede59abdad.tar.gz
oci-image-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-image-tools/files/0001-config-make-Config.User-mapping-errors-a-warning.patch6
-rw-r--r--recipes-containers/oci-image-tools/files/0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch6
-rw-r--r--recipes-containers/oci-image-tools/oci-image-tools_git.bb23
3 files changed, 13 insertions, 22 deletions
diff --git a/recipes-containers/oci-image-tools/files/0001-config-make-Config.User-mapping-errors-a-warning.patch b/recipes-containers/oci-image-tools/files/0001-config-make-Config.User-mapping-errors-a-warning.patch
index 78d2b9d0..b61d4f49 100644
--- a/recipes-containers/oci-image-tools/files/0001-config-make-Config.User-mapping-errors-a-warning.patch
+++ b/recipes-containers/oci-image-tools/files/0001-config-make-Config.User-mapping-errors-a-warning.patch
@@ -12,10 +12,10 @@ Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
12 image/config.go | 2 +- 12 image/config.go | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-) 13 1 file changed, 1 insertion(+), 1 deletion(-)
14 14
15diff --git a/src/import/image/config.go b/src/import/image/config.go 15diff --git a/image/config.go b/image/config.go
16index d28b1bc4fe5f..37dfd1f14ef7 100644 16index d28b1bc4fe5f..37dfd1f14ef7 100644
17--- a/src/import/image/config.go 17--- a/image/config.go
18+++ b/src/import/image/config.go 18+++ b/image/config.go
19@@ -106,7 +106,7 @@ func (c *config) runtimeSpec(rootfs string) (*specs.Spec, error) { 19@@ -106,7 +106,7 @@ func (c *config) runtimeSpec(rootfs string) (*specs.Spec, error) {
20 s.Process.User.UID = uint32(uid) 20 s.Process.User.UID = uint32(uid)
21 s.Process.User.GID = uint32(gid) 21 s.Process.User.GID = uint32(gid)
diff --git a/recipes-containers/oci-image-tools/files/0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch b/recipes-containers/oci-image-tools/files/0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch
index 7e0b2a11..65c2929a 100644
--- a/recipes-containers/oci-image-tools/files/0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch
+++ b/recipes-containers/oci-image-tools/files/0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch
@@ -13,10 +13,10 @@ Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
13 Makefile | 2 +- 13 Makefile | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-) 14 1 file changed, 1 insertion(+), 1 deletion(-)
15 15
16diff --git a/src/import/Makefile b/src/import/Makefile 16diff --git a/Makefile b/Makefile
17index bacb341..1bfe021 100644 17index bacb341..1bfe021 100644
18--- a/src/import/Makefile 18--- a/Makefile
19+++ b/src/import/Makefile 19+++ b/Makefile
20@@ -27,7 +27,7 @@ check-license: 20@@ -27,7 +27,7 @@ check-license:
21 21
22 .PHONY: tool 22 .PHONY: tool
diff --git a/recipes-containers/oci-image-tools/oci-image-tools_git.bb b/recipes-containers/oci-image-tools/oci-image-tools_git.bb
index e0b27163..4beb3a63 100644
--- a/recipes-containers/oci-image-tools/oci-image-tools_git.bb
+++ b/recipes-containers/oci-image-tools/oci-image-tools_git.bb
@@ -1,7 +1,7 @@
1HOMEPAGE = "https://github.com/opencontainers/image-tools" 1HOMEPAGE = "https://github.com/opencontainers/image-tools"
2SUMMARY = "A collection of tools for working with the OCI image format specification" 2SUMMARY = "A collection of tools for working with the OCI image format specification"
3LICENSE = "Apache-2.0" 3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
5 5
6DEPENDS = "\ 6DEPENDS = "\
7 oci-image-spec \ 7 oci-image-spec \
@@ -12,7 +12,7 @@ DEPENDS = "\
12 spf13-pflag \ 12 spf13-pflag \
13 " 13 "
14 14
15SRC_URI = "git://github.com/opencontainers/image-tools.git;branch=master;protocol=https \ 15SRC_URI = "git://github.com/opencontainers/image-tools.git;branch=master;protocol=https;destsuffix=git/src/github.com/opencontainers/image-tools \
16 file://0001-config-make-Config.User-mapping-errors-a-warning.patch \ 16 file://0001-config-make-Config.User-mapping-errors-a-warning.patch \
17 file://0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch" 17 file://0001-tool-respect-GO-and-GOBUILDFLAGS-when-building.patch"
18 18
@@ -27,21 +27,12 @@ inherit go
27# go package. 27# go package.
28EXTRA_OEMAKE="BUILDTAGS=''" 28EXTRA_OEMAKE="BUILDTAGS=''"
29 29
30S = "${WORKDIR}/git/src/github.com/opencontainers/image-tools"
31
30do_compile() { 32do_compile() {
31 export GOARCH="${TARGET_GOARCH}" 33 export GOARCH="${TARGET_GOARCH}"
32 export GOROOT="${STAGING_LIBDIR}/go" 34 export GOROOT="${STAGING_LIBDIR}/go"
33 # Setup vendor directory so that it can be used in GOPATH. 35 export GOPATH="${WORKDIR}/git/"
34 #
35 # Go looks in a src directory under any directory in GOPATH but riddler
36 # uses 'vendor' instead of 'vendor/src'. We can fix this with a symlink.
37 #
38 # We also need to link in the ipallocator directory as that is not under
39 # a src directory.
40 ln -sfn . "${S}/src/import/vendor/src"
41 mkdir -p "${S}/src/import/vendor/src/github.com/opencontainers/image-tools/"
42 ln -sfn "${S}/src/import/image" "${S}/src/import/vendor/src/github.com/opencontainers/image-tools/image"
43 ln -sfn "${S}/src/import/version" "${S}/src/import/vendor/src/github.com/opencontainers/image-tools/version"
44 export GOPATH="${S}/src/import/vendor"
45 36
46 # Pass the needed cflags/ldflags so that cgo 37 # Pass the needed cflags/ldflags so that cgo
47 # can find the needed headers files and libraries 38 # can find the needed headers files and libraries
@@ -54,14 +45,14 @@ do_compile() {
54 45
55 export GOBUILDFLAGS="-trimpath" 46 export GOBUILDFLAGS="-trimpath"
56 47
57 cd ${S}/src/import 48 cd ${S}
58 49
59 oe_runmake tool 50 oe_runmake tool
60} 51}
61 52
62do_install() { 53do_install() {
63 install -d ${D}/${sbindir} 54 install -d ${D}/${sbindir}
64 install ${S}/src/import/oci-image-tool ${D}/${sbindir}/ 55 install ${S}/oci-image-tool ${D}/${sbindir}/
65} 56}
66 57
67INSANE_SKIP:${PN} += "ldflags textrel" 58INSANE_SKIP:${PN} += "ldflags textrel"