From: Chen Qi <[email protected]>

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 <[email protected]>
---
 recipes-containers/cri-o/cri-o_git.bb         |  8 ++--
 .../0001-Add-trimpath-to-build-nri.test.patch | 31 --------------
 ...ce-GO_TEST-for-more-flexible-configu.patch | 41 +++++++++++++++++++
 3 files changed, 46 insertions(+), 34 deletions(-)
 delete mode 100644 
recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch
 create mode 100644 
recipes-containers/cri-o/files/0001-Makefile-introduce-GO_TEST-for-more-flexible-configu.patch

diff --git a/recipes-containers/cri-o/cri-o_git.bb 
b/recipes-containers/cri-o/cri-o_git.bb
index 10c811fe..1ef32ab0 100644
--- a/recipes-containers/cri-o/cri-o_git.bb
+++ b/recipes-containers/cri-o/cri-o_git.bb
@@ -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;patchdir=src/import \
+        
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 \
diff --git 
a/recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch 
b/recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch
deleted file mode 100644
index bf73250a..00000000
--- a/recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From a1eafac8256fbff81b72c82213eb5a37858d2e6a Mon Sep 17 00:00:00 2001
-From: Peng Zhang <[email protected]>
-Date: Fri, 25 Oct 2024 10:42:02 +0800
-Subject: [PATCH] Add --trimpath to build nri.test
-
-when build test-binary, TMPDIR[buildpaths] error found in nri.test
-to fix this error, add "--trimpath" option to build nri.test.
-
-Upstream-Status: Inappropriate [oe specific]
-
-Signed-off-by: Peng Zhang <[email protected]>
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 34f9d429d..f5a033023 100644
---- a/Makefile
-+++ b/Makefile
-@@ -213,7 +213,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 --tags "test $(BUILDTAGS)" -c ./test/nri -o $@ ${TRIMPATH}
- 
- bin/crio: $(GO_FILES) ## Build the CRI-O main binary.
-       $(GO_BUILD) $(GCFLAGS) $(GO_LDFLAGS) -tags "$(BUILDTAGS)" -o $@ 
./cmd/crio
--- 
-2.25.1
-
diff --git 
a/recipes-containers/cri-o/files/0001-Makefile-introduce-GO_TEST-for-more-flexible-configu.patch
 
b/recipes-containers/cri-o/files/0001-Makefile-introduce-GO_TEST-for-more-flexible-configu.patch
new file mode 100644
index 00000000..33c65b5a
--- /dev/null
+++ 
b/recipes-containers/cri-o/files/0001-Makefile-introduce-GO_TEST-for-more-flexible-configu.patch
@@ -0,0 +1,41 @@
+From 656cb24b07b1e5b63939c15dc31d8c9839ecce75 Mon Sep 17 00:00:00 2001
+From: Chen Qi <[email protected]>
+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 <[email protected]>
+---
+ 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
+
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9083): 
https://lists.yoctoproject.org/g/meta-virtualization/message/9083
Mute This Topic: https://lists.yoctoproject.org/mt/110623152/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to