summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2022-09-13 12:56:27 -0400
committerBruce Ashfield <bruce.ashfield@gmail.com>2022-09-13 12:56:27 -0400
commitf6f4f2c1c33dd9d351dc76362ac2157d7c66c5dd (patch)
tree424407a2c8d628b21a8dd66911b7a7b9eee1cd23
parent7cea149bb0b510d2fb7fe71eee28d10399d0ceb4 (diff)
downloadmeta-virtualization-f6f4f2c1c33dd9d351dc76362ac2157d7c66c5dd.tar.gz
skopeo: reprodicibility enable trimpath and strip
Skopeo is throwing TMPDIR QA warnings due to paths being built into the binaries. We fix this by creating a new variable to pass -trimpath into the build, and also by defining the linker flags -w -s to strip source/path information from the binaries. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--recipes-containers/skopeo/files/0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch29
-rw-r--r--recipes-containers/skopeo/skopeo_git.bb5
2 files changed, 33 insertions, 1 deletions
diff --git a/recipes-containers/skopeo/files/0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch b/recipes-containers/skopeo/files/0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch
new file mode 100644
index 00000000..4129e8b6
--- /dev/null
+++ b/recipes-containers/skopeo/files/0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch
@@ -0,0 +1,29 @@
1From 7037cb27718fe23541885684fdacec9c52ee0e30 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Tue, 13 Sep 2022 11:55:45 -0400
4Subject: [PATCH] makefile: add GOBUILDFLAGS to go build call
5
6We may need to specify things like -trimpath, so add $(GOBUILDFLAGS)
7to allow them to be passed from the recipe to the Makefile.
8
9Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
10---
11 src/import/Makefile | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/src/import/Makefile b/src/import/Makefile
15index 58ed8d3a..990edd1d 100644
16--- a/src/import/Makefile
17+++ b/src/import/Makefile
18@@ -136,7 +136,7 @@ binary: cmd/skopeo
19 # Build w/o using containers
20 .PHONY: bin/skopeo
21 bin/skopeo:
22- $(GO) build $(MOD_VENDOR) ${GO_DYN_FLAGS} ${SKOPEO_LDFLAGS} -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o $@ ./cmd/skopeo
23+ $(GO) build $(GOBUILDFLAGS) $(MOD_VENDOR) ${GO_DYN_FLAGS} ${SKOPEO_LDFLAGS} -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o $@ ./cmd/skopeo
24 bin/skopeo.%:
25 GOOS=$(word 2,$(subst ., ,$@)) GOARCH=$(word 3,$(subst ., ,$@)) $(GO) build $(MOD_VENDOR) ${SKOPEO_LDFLAGS} -tags "containers_image_openpgp $(BUILDTAGS)" -o $@ ./cmd/skopeo
26 local-cross: bin/skopeo.darwin.amd64 bin/skopeo.linux.arm bin/skopeo.linux.arm64 bin/skopeo.windows.386.exe bin/skopeo.windows.amd64.exe
27--
282.19.1
29
diff --git a/recipes-containers/skopeo/skopeo_git.bb b/recipes-containers/skopeo/skopeo_git.bb
index d426b4f8..a2fff2c9 100644
--- a/recipes-containers/skopeo/skopeo_git.bb
+++ b/recipes-containers/skopeo/skopeo_git.bb
@@ -23,6 +23,7 @@ SRC_URI = " \
23 git://github.com/containers/skopeo;branch=main;protocol=https \ 23 git://github.com/containers/skopeo;branch=main;protocol=https \
24 file://storage.conf \ 24 file://storage.conf \
25 file://registries.conf \ 25 file://registries.conf \
26 file://0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch \
26" 27"
27 28
28SRCREV = "b95e081162382f9a28f400bee10046ce72b957fe" 29SRCREV = "b95e081162382f9a28f400bee10046ce72b957fe"
@@ -70,6 +71,8 @@ do_compile() {
70 cd ${S}/src/import 71 cd ${S}/src/import
71 72
72 export GO111MODULE=off 73 export GO111MODULE=off
74 export GOBUILDFLAGS="-trimpath"
75 export EXTRA_LDFLAGS="-s -w"
73 76
74 oe_runmake bin/skopeo 77 oe_runmake bin/skopeo
75} 78}
@@ -98,6 +101,6 @@ do_install:append:class-nativesdk() {
98 --policy ${sysconfdir}/containers/policy.json 101 --policy ${sysconfdir}/containers/policy.json
99} 102}
100 103
101INSANE_SKIP:${PN} += "ldflags" 104INSANE_SKIP:${PN} += "ldflags already-stripped"
102 105
103BBCLASSEXTEND = "native nativesdk" 106BBCLASSEXTEND = "native nativesdk"