summaryrefslogtreecommitdiffstats
path: root/recipes-containers
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei.gherzan@huawei.com>2022-07-05 12:17:49 +0200
committerBruce Ashfield <bruce.ashfield@gmail.com>2022-07-05 16:25:25 -0400
commita33188fab89bc16a82742b0cc865dda239c225dc (patch)
treedd4d64652a61862836b0b6ba01600b8ce0ace148 /recipes-containers
parent320f44c6e9af463a85b58e0d87ca70273c6b87f6 (diff)
downloadmeta-virtualization-a33188fab89bc16a82742b0cc865dda239c225dc.tar.gz
podman: Fix host contamination
The project's internal Makefile uses BUILDFLAGS variable to pass arguments to `go build` while Yocto/OE defines it as GOBUILDFLAGS. Add a patch to align this and avoid using host headers in which case, a musl build will fail similarly to: | [...]ld: /tmp/go-link-3172010154/000015.o: in function `vfprintf': | /usr/include/x86_64-linux-gnu/bits/stdio2.h:130: undefined reference to `__vfprintf_chk' | [...]ld: /tmp/go-link-3172010154/000016.o: in function `fprintf': | /usr/include/x86_64-linux-gnu/bits/stdio2.h:100: undefined reference to `__fprintf_chk' | collect2: error: ld returned 1 exit status Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-containers')
-rw-r--r--recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch125
-rw-r--r--recipes-containers/podman/podman_git.bb1
2 files changed, 126 insertions, 0 deletions
diff --git a/recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch b/recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch
new file mode 100644
index 00000000..13a736e4
--- /dev/null
+++ b/recipes-containers/podman/podman/0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch
@@ -0,0 +1,125 @@
1From 3e18f3a4db638a3df48f49aa0a539f8bb048afc9 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei.gherzan@huawei.com>
3Date: Tue, 5 Jul 2022 11:51:56 +0200
4Subject: [PATCH] Rename BUILDFLAGS to GOBUILDFLAGS
5
6Yocto uses GOBUILDFLAGS to pass the right build flags while the Makefile
7uses BUILDFLAGS. Align them accordingly.
8
9See go.bbclass for more information.
10
11Upstream-Status: Inappropriate [OE specific]
12Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
13---
14 Makefile | 24 ++++++++++++------------
15 1 file changed, 12 insertions(+), 12 deletions(-)
16
17diff --git a/Makefile b/Makefile
18index cb230d8e9..538b28d41 100644
19--- a/Makefile
20+++ b/Makefile
21@@ -69,7 +69,7 @@ PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit
22 # triggered.
23 SOURCES = $(shell find . -path './.*' -prune -o \( \( -name '*.go' -o -name '*.c' \) -a ! -name '*_test.go' \) -print)
24
25-BUILDFLAGS := -mod=vendor $(BUILDFLAGS)
26+GOBUILDFLAGS := -mod=vendor $(GOBUILDFLAGS)
27
28 BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
29 CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
30@@ -264,11 +264,11 @@ gofmt: ## Verify the source code gofmt
31
32 .PHONY: test/checkseccomp/checkseccomp
33 test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
34- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp
35+ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp
36
37 .PHONY: test/testvol/testvol
38 test/testvol/testvol: .gopathok $(wildcard test/testvol/*.go)
39- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol
40+ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/testvol
41
42 .PHONY: volume-plugin-test-image
43 volume-plugin-test-img:
44@@ -276,7 +276,7 @@ volume-plugin-test-img:
45
46 .PHONY: test/goecho/goecho
47 test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go)
48- $(GOCMD) build $(BUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho
49+ $(GOCMD) build $(GOBUILDFLAGS) $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho
50
51 test/version/version: .gopathok version/version.go
52 $(GO) build -o $@ ./test/version/
53@@ -318,7 +318,7 @@ ifeq (,$(findstring systemd,$(BUILDTAGS)))
54 distro for journald support."
55 endif
56 $(GOCMD) build \
57- $(BUILDFLAGS) \
58+ $(GOBUILDFLAGS) \
59 $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
60 -tags "$(BUILDTAGS)" \
61 -o $@ ./cmd/podman
62@@ -329,14 +329,14 @@ $(SRCBINDIR):
63
64 $(SRCBINDIR)/podman$(BINSFX): $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum
65 $(GOCMD) build \
66- $(BUILDFLAGS) \
67+ $(GOBUILDFLAGS) \
68 $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
69 -tags "${REMOTETAGS}" \
70 -o $@ ./cmd/podman
71
72 $(SRCBINDIR)/podman-remote-static: $(SRCBINDIR) .gopathok $(SOURCES) go.mod go.sum
73 $(GOCMD) build \
74- $(BUILDFLAGS) \
75+ $(GOBUILDFLAGS) \
76 $(GO_LDFLAGS) '$(LDFLAGS_PODMAN_STATIC)' \
77 -tags "${REMOTETAGS}" \
78 -o $@ ./cmd/podman
79@@ -371,7 +371,7 @@ podman-winpath: .gopathok $(SOURCES) go.mod go.sum
80 CGO_ENABLED=0 \
81 GOOS=windows \
82 $(GO) build \
83- $(BUILDFLAGS) \
84+ $(GOBUILDFLAGS) \
85 -ldflags -H=windowsgui \
86 -o bin/windows/winpath.exe \
87 ./cmd/winpath
88@@ -390,14 +390,14 @@ podman-mac-helper: ## Build podman-mac-helper for macOS
89 GOOS=darwin \
90 GOARCH=$(GOARCH) \
91 $(GO) build \
92- $(BUILDFLAGS) \
93+ $(GOBUILDFLAGS) \
94 -o bin/darwin/podman-mac-helper \
95 ./cmd/podman-mac-helper
96
97 bin/rootlessport: .gopathok $(SOURCES) go.mod go.sum
98 CGO_ENABLED=$(CGO_ENABLED) \
99 $(GO) build \
100- $(BUILDFLAGS) \
101+ $(GOBUILDFLAGS) \
102 -o $@ ./cmd/rootlessport
103
104 .PHONY: rootlessport
105@@ -420,7 +420,7 @@ bin/podman.cross.%: .gopathok
106 GOARCH="$${TARGET##*.}"; \
107 CGO_ENABLED=0 \
108 $(GO) build \
109- $(BUILDFLAGS) \
110+ $(GOBUILDFLAGS) \
111 $(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
112 -tags '$(BUILDTAGS_CROSS)' \
113 -o "$@" ./cmd/podman
114@@ -864,7 +864,7 @@ install.tools: .install.goimports .install.gitvalidation .install.md2man .instal
115 .PHONY: .install.ginkgo
116 .install.ginkgo: .gopathok
117 if [ ! -x "$(GOBIN)/ginkgo" ]; then \
118- $(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \
119+ $(GO) install $(GOBUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \
120 fi
121
122 .PHONY: .install.gitvalidation
123--
1242.25.1
125
diff --git a/recipes-containers/podman/podman_git.bb b/recipes-containers/podman/podman_git.bb
index 913aea84..547bc4e7 100644
--- a/recipes-containers/podman/podman_git.bb
+++ b/recipes-containers/podman/podman_git.bb
@@ -20,6 +20,7 @@ DEPENDS = " \
20SRCREV = "cedbbfa543651a13055a1fe093a4d0a2a28ccdfd" 20SRCREV = "cedbbfa543651a13055a1fe093a4d0a2a28ccdfd"
21SRC_URI = " \ 21SRC_URI = " \
22 git://github.com/containers/libpod.git;branch=v4.1;protocol=https \ 22 git://github.com/containers/libpod.git;branch=v4.1;protocol=https \
23 file://0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch;patchdir=src/import \
23" 24"
24 25
25LICENSE = "Apache-2.0" 26LICENSE = "Apache-2.0"