cri-o: fix textrel QA issue

Basically we pass "-buildmode=pie" to fix textrel QA issue.

A new patch is added and submitted to upstream:

  0001-Makefile-introduce-GO_TEST-for-more-flexible-configu.patch.

With this new patch, the old patch, 0001-Add-trimpath-to-build-nri.test.patch,
could be dropped.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Chen Qi 2025-01-14 21:46:39 -08:00 committed by Bruce Ashfield
parent 7834a259ad
commit 3763a3a9a6
2 changed files with 46 additions and 3 deletions

View File

@ -17,7 +17,7 @@ At a high level, we expect the scope of cri-o to be restricted to the following
SRCREV_cri-o = "33d75981bee230f791709975125d7386fe2c530a"
SRC_URI = "\
git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.31;name=cri-o;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX} \
file://0001-Add-trimpath-to-build-nri.test.patch \
file://0001-Makefile-introduce-GO_TEST-for-more-flexible-configu.patch;patchdir=src/import \
file://crio.conf \
file://run-ptest \
"
@ -61,6 +61,9 @@ inherit pkgconfig
inherit container-host
EXTRA_OEMAKE = "BUILDTAGS='' DEBUG=1 STRIP=true"
# avoid textrel QA issue
EXTRA_OEMAKE += "GO_BUILD='${GO} build -trimpath -buildmode=pie'"
EXTRA_OEMAKE += "GO_TEST='${GO} test -trimpath -buildmode=pie'"
do_compile() {
set +e
@ -121,8 +124,7 @@ FILES:${PN} += "${systemd_unitdir}/system/*"
FILES:${PN} += "/usr/local/bin/*"
FILES:${PN} += "/usr/share/containers/oci/hooks.d"
INSANE_SKIP:${PN} += "ldflags textrel"
INSANE_SKIP:${PN}-ptest += "textrel"
INSANE_SKIP:${PN}-ptest += "ldflags"
RDEPENDS:${PN}-ptest += " \
bash \

View File

@ -0,0 +1,41 @@
From 656cb24b07b1e5b63939c15dc31d8c9839ecce75 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 14 Jan 2025 20:55:50 -0800
Subject: [PATCH] Makefile: introduce GO_TEST for more flexible configuration
Introduce GO_TEST and make it similar to GO_BUILD.
Note that with this change, the default behavior changes a little bit,
that is, TRIMPATH, GCFLAGS and GO_LDFALGS all have effect on test/nri/nri.test.
Upstream-Status: Submitted [https://github.com/cri-o/cri-o/pull/8912]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 34f9d429d..f02213894 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ GO ?= go
TRIMPATH ?= -trimpath
GO_ARCH=$(shell $(GO) env GOARCH)
GO_BUILD ?= $(GO) build $(TRIMPATH)
+GO_TEST ?= $(GO) test $(TRIMPATH)
GO_RUN ?= $(GO) run
NIX_IMAGE ?= nixos/nix:2.24.3
@@ -213,7 +214,7 @@ test/checkcriu/checkcriu: $(GO_FILES) ## Build the checkcriu test binary.
$(GO_BUILD) $(GCFLAGS) $(GO_LDFLAGS) -tags "$(BUILDTAGS)" -o $@ ./test/checkcriu
test/nri/nri.test: $(wildcard test/nri/*.go) ## Build the NRI test binary.
- $(GO) test --tags "test $(BUILDTAGS)" -c ./test/nri -o $@
+ $(GO_TEST) $(GCFLAGS) $(GO_LDFLAGS) --tags "test $(BUILDTAGS)" -c ./test/nri -o $@
bin/crio: $(GO_FILES) ## Build the CRI-O main binary.
$(GO_BUILD) $(GCFLAGS) $(GO_LDFLAGS) -tags "$(BUILDTAGS)" -o $@ ./cmd/crio
--
2.25.1