From f6f4f2c1c33dd9d351dc76362ac2157d7c66c5dd Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 13 Sep 2022 12:56:27 -0400 Subject: 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 --- ...akefile-add-GOBUILDFLAGS-to-go-build-call.patch | 29 ++++++++++++++++++++++ recipes-containers/skopeo/skopeo_git.bb | 5 +++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 recipes-containers/skopeo/files/0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch 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 @@ +From 7037cb27718fe23541885684fdacec9c52ee0e30 Mon Sep 17 00:00:00 2001 +From: Bruce Ashfield +Date: Tue, 13 Sep 2022 11:55:45 -0400 +Subject: [PATCH] makefile: add GOBUILDFLAGS to go build call + +We may need to specify things like -trimpath, so add $(GOBUILDFLAGS) +to allow them to be passed from the recipe to the Makefile. + +Signed-off-by: Bruce Ashfield +--- + src/import/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/import/Makefile b/src/import/Makefile +index 58ed8d3a..990edd1d 100644 +--- a/src/import/Makefile ++++ b/src/import/Makefile +@@ -136,7 +136,7 @@ binary: cmd/skopeo + # Build w/o using containers + .PHONY: bin/skopeo + bin/skopeo: +- $(GO) build $(MOD_VENDOR) ${GO_DYN_FLAGS} ${SKOPEO_LDFLAGS} -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o $@ ./cmd/skopeo ++ $(GO) build $(GOBUILDFLAGS) $(MOD_VENDOR) ${GO_DYN_FLAGS} ${SKOPEO_LDFLAGS} -gcflags "$(GOGCFLAGS)" -tags "$(BUILDTAGS)" -o $@ ./cmd/skopeo + bin/skopeo.%: + GOOS=$(word 2,$(subst ., ,$@)) GOARCH=$(word 3,$(subst ., ,$@)) $(GO) build $(MOD_VENDOR) ${SKOPEO_LDFLAGS} -tags "containers_image_openpgp $(BUILDTAGS)" -o $@ ./cmd/skopeo + local-cross: bin/skopeo.darwin.amd64 bin/skopeo.linux.arm bin/skopeo.linux.arm64 bin/skopeo.windows.386.exe bin/skopeo.windows.amd64.exe +-- +2.19.1 + 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 = " \ git://github.com/containers/skopeo;branch=main;protocol=https \ file://storage.conf \ file://registries.conf \ + file://0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch \ " SRCREV = "b95e081162382f9a28f400bee10046ce72b957fe" @@ -70,6 +71,8 @@ do_compile() { cd ${S}/src/import export GO111MODULE=off + export GOBUILDFLAGS="-trimpath" + export EXTRA_LDFLAGS="-s -w" oe_runmake bin/skopeo } @@ -98,6 +101,6 @@ do_install:append:class-nativesdk() { --policy ${sysconfdir}/containers/policy.json } -INSANE_SKIP:${PN} += "ldflags" +INSANE_SKIP:${PN} += "ldflags already-stripped" BBCLASSEXTEND = "native nativesdk" -- cgit v1.2.3-54-g00ecf