Skip to contentSkip to conversation

netns update and runc fixes

PATCH In review Paul Barker 2 participants 6 messages Oct 5, 2017

lore
Share & tools
lore
#0 lore raw

cover netns update and runc fixes

* Update netns to the latest release.

* Fix runc compilation problems when targeting qemux86-64. Both runc-docker and runc-opencontainers have been build tested with these changes.

* Drop an old patch which is no longer used.

Paul Barker (4):
netns: Update to v0.2.1
runc: Drop obsolete patch
runc: Use correct go cross-compiler
runc: Don't override GOARCH or GOROOT

 .../0001-Use-correct-go-cross-compiler.patch       | 85 ++++++++++++++++++++++
 recipes-containers/runc/runc-docker_git.bb         |  3 +
 .../0001-Use-correct-go-cross-compiler.patch       | 85 ++++++++++++++++++++++
 recipes-containers/runc/runc-opencontainers_git.bb |  5 +-
 recipes-containers/runc/runc.inc                   |  3 -
 .../0001-nsexec-fix-build-against-musl-libc.patch  | 48 ------------
 recipes-networking/netns/netns_git.bb              |  9 ++-
 7 files changed, 182 insertions(+), 56 deletions(-)
 create mode 100644 recipes-containers/runc/runc-docker/0001-Use-correct-go-cross-compiler.patch
 create mode 100644 recipes-containers/runc/runc-opencontainers/0001-Use-correct-go-cross-compiler.patch
 delete mode 100644 recipes-containers/runc/runc/0001-nsexec-fix-build-against-musl-libc.patch
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 netns: Update to v0.2.1

---
 recipes-networking/netns/netns_git.bb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
recipes-networking/netns/netns_git.bb +5 -4
index 8e771f5..4437764 100644
@@ -4,8 +4,8 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
 
 SRC_URI = "git://github.com/jessfraz/netns;branch=master"
-SRCREV = "85b1ab9fcccbaa404a2636b52a48bbde02437cf7"
-PV = "0.1.0+git${SRCPV}"
+SRCREV = "74e23a0e5c4e7ac011aafcc4623586c196f1b3ef"
+PV = "0.2.1"
 GO_IMPORT = "import"
 
 S = "${WORKDIR}/git"
@@ -21,11 +21,12 @@ do_compile() {
 	# Go looks in a src directory under any directory in GOPATH but netns
 	# uses 'vendor' instead of 'vendor/src'. We can fix this with a symlink.
 	#
-	# We also need to link in the ipallocator directory as that is not under
-	# a src directory.
+	# We also need to link in the ipallocator and version directories as
+	# they are not under the src directory.
 	ln -sfn . "${S}/src/import/vendor/src"
 	mkdir -p "${S}/src/import/vendor/src/github.com/jessfraz/netns"
 	ln -sfn "${S}/src/import/ipallocator" "${S}/src/import/vendor/src/github.com/jessfraz/netns/ipallocator"
+	ln -sfn "${S}/src/import/version" "${S}/src/import/vendor/src/github.com/jessfraz/netns/version"
 	export GOPATH="${S}/src/import/vendor"
 
 	# Pass the needed cflags/ldflags so that cgo
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 runc: Drop obsolete patch

In reply to Paul Barker

This patch hasn't been used in a long time.

---
 .../0001-nsexec-fix-build-against-musl-libc.patch  | 48 ----------------------
 1 file changed, 48 deletions(-)
 delete mode 100644 recipes-containers/runc/runc/0001-nsexec-fix-build-against-musl-libc.patch
recipes-containers/runc/runc/0001-nsexec-fix-build-against-musl-libc.patch deleted +0 -48
deleted file mode 100644
index aa57636..0000000
@@ -1,48 +0,0 @@
-From ac6bd953192fa6752a07be7501f69f7cffe33e8e Mon Sep 17 00:00:00 2001
-From: Natanael Copa <[email protected]>
-Date: Tue, 19 Apr 2016 10:43:00 +0200
-Subject: [PATCH] nsexec: fix build against musl libc
-
-Remove a wrongly added include which was added in commit 3c2e77ee (Add a
-compatibility header for CentOS/RHEL 6, 2016-01-29) apparently to
-fix this compile error on centos 6:
-
-> In file included from
-> Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c:20:
-> /usr/include/linux/netlink.h:35: error: expected specifier-qualifier-list before 'sa_family_t'
-
-The glibc bits/sockaddr.h says that this header should never be included
-directly[1]. Instead, sys/socket.h should be used.
-
-The problem was correctly fixed later, in commit 394fb55 (Fix build
-error on centos6, 2016-03-02) so the incorrect bits/sockaddr.h can
-safely be removed.
-
-This is needed to build musl libc.
-
-Fixes #761
-
-[1]: https://github.molgen.mpg.de/git-mirror/glibc/blob/20003c49884422da7ffbc459cdeee768a6fee07b/bits/sockaddr.h#L20
-
-Signed-off-by: Natanael Copa <[email protected]>
-Signed-off-by: Paul Barker <[email protected]>
-Upstream-status: Backport
----
- libcontainer/nsenter/nsexec.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/libcontainer/nsenter/nsexec.c b/libcontainer/nsenter/nsexec.c
-index 8f37d6c..40a8f89 100644
---- a/libcontainer/nsenter/nsexec.c
-+++ b/libcontainer/nsenter/nsexec.c
-@@ -18,7 +18,6 @@
- #include <unistd.h>
- #include <grp.h>
- 
--#include <bits/sockaddr.h>
- #include <linux/types.h>
- 
- // All arguments should be above the stack because it grows down
--- 
-2.1.4
-
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 runc: Use correct go cross-compiler

In reply to Paul Barker

The makefiles for both providers of runc need to be patched in similar ways to ensure that we use the binaries from go-cross and not go-native.

---
 .../0001-Use-correct-go-cross-compiler.patch       | 85 ++++++++++++++++++++++
 recipes-containers/runc/runc-docker_git.bb         |  3 +
 .../0001-Use-correct-go-cross-compiler.patch       | 85 ++++++++++++++++++++++
 recipes-containers/runc/runc-opencontainers_git.bb |  5 +-
 4 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 recipes-containers/runc/runc-docker/0001-Use-correct-go-cross-compiler.patch
 create mode 100644 recipes-containers/runc/runc-opencontainers/0001-Use-correct-go-cross-compiler.patch
recipes-containers/runc/runc-docker/0001-Use-correct-go-cross-compiler.patch new file +85 -0
new file mode 100644
index 0000000..8f5171a
@@ -0,0 +1,85 @@
+From 037c20b3b3ef5e9ead0282aa64f9b88c0c18934d Mon Sep 17 00:00:00 2001
+From: Paul Barker <[email protected]>
+Date: Thu, 5 Oct 2017 13:14:40 +0000
+Subject: [PATCH] Use correct go cross-compiler
+
+We need to use '${GO}' as set by OpenEmbedded instead of just 'go'. Just using
+'go' will invoke go-native.
+
+Signed-off-by: Paul Barker <[email protected]>
+Upstream-status: Inappropriate
+---
+ Makefile | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 8117892..0fcf508 100644
+--- a/src/import/Makefile
++++ b/src/import/Makefile
+@@ -27,18 +27,18 @@ SHELL := $(shell command -v bash 2>/dev/null)
+ .DEFAULT: runc
+ 
+ runc: $(SOURCES)
+-	go build -i $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o runc .
++	$(GO) build -i $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o runc .
+ 
+ all: runc recvtty
+ 
+ recvtty: contrib/cmd/recvtty/recvtty
+ 
+ contrib/cmd/recvtty/recvtty: $(SOURCES)
+-	go build -i $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
++	$(GO) build -i $(EXTRA_FLAGS) -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -tags "$(BUILDTAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
+ 
+ static: $(SOURCES)
+-	CGO_ENABLED=1 go build -i $(EXTRA_FLAGS) -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o runc .
+-	CGO_ENABLED=1 go build -i $(EXTRA_FLAGS) -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
++	CGO_ENABLED=1 $(GO) build -i $(EXTRA_FLAGS) -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o runc .
++	CGO_ENABLED=1 $(GO) build -i $(EXTRA_FLAGS) -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT} -X main.version=${VERSION} $(EXTRA_LDFLAGS)" -o contrib/cmd/recvtty/recvtty ./contrib/cmd/recvtty
+ 
+ release:
+ 	@flag_list=(seccomp selinux apparmor static); \
+@@ -62,15 +62,15 @@ release:
+ 			CGO_ENABLED=1; \
+ 		}; \
+ 		echo "Building target: $$output"; \
+-		go build -i $(EXTRA_FLAGS) -ldflags "$$ldflags $(EXTRA_LDFLAGS)" -tags "$$tags" -o "$$output" .; \
++		$(GO) build -i $(EXTRA_FLAGS) -ldflags "$$ldflags $(EXTRA_LDFLAGS)" -tags "$$tags" -o "$$output" .; \
+ 	done
+ 
+ dbuild: runcimage
+ 	docker run --rm -v $(CURDIR):/go/src/$(PROJECT) --privileged $(RUNC_IMAGE) make clean all
+ 
+ lint:
+-	go vet $(allpackages)
+-	go fmt $(allpackages)
++	$(GO) vet $(allpackages)
++	$(GO) fmt $(allpackages)
+ 
+ man:
+ 	man/md2man-all.sh
+@@ -88,7 +88,7 @@ unittest: runcimage
+ 	docker run -e TESTFLAGS -t --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_IMAGE) make localunittest
+ 
+ localunittest: all
+-	go test -timeout 3m -tags "$(BUILDTAGS)" ${TESTFLAGS} -v $(allpackages)
++	$(GO) test -timeout 3m -tags "$(BUILDTAGS)" ${TESTFLAGS} -v $(allpackages)
+ 
+ integration: runcimage
+ 	docker run -e TESTFLAGS -t --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_IMAGE) make localintegration
+@@ -134,10 +134,10 @@ clean:
+ validate:
+ 	script/validate-gofmt
+ 	script/validate-shfmt
+-	go vet $(allpackages)
++	$(GO) vet $(allpackages)
+ 
+ ci: validate localtest
+ 
+ # memoize allpackages, so that it's executed only once and only if used
+-_allpackages = $(shell go list ./... | grep -v vendor)
++_allpackages = $(shell $(GO) list ./... | grep -v vendor)
+ allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)
+-- 
+2.7.4
+
recipes-containers/runc/runc-docker_git.bb +3 -0
index 9735325..0198652 100644
@@ -8,10 +8,13 @@ SRC_URI = "git://github.com/docker/runc.git;nobranch=1;name=runc-docker \
            file://0002-Remove-Platform-as-no-longer-in-OCI-spec.patch \
            file://0003-Update-memory-specs-to-use-int64-not-uint64.patch \
            file://0001-runc-Add-console-socket-dev-null.patch \
+           file://0001-Use-correct-go-cross-compiler.patch \
           "
 
 GO_IMPORT = "import"
 
+EXTRA_FLAGS = "-v -x -work"
+
 RUNC_VERSION = "1.0.0-rc3"
 PROVIDES += "virtual/runc"
 RPROVIDES_${PN} = "virtual/runc"
recipes-containers/runc/runc-opencontainers/0001-Use-correct-go-cross-compiler.patch new file +85 -0

85 lines not on this page · raw message

recipes-containers/runc/runc-opencontainers_git.bb +4 -1
index 902a93d..2cfceea 100644
@@ -1,7 +1,10 @@
 include runc.inc
 
 SRCREV = "2e7cfe036e2c6dc51ccca6eb7fa3ee6b63976dcd"
-SRC_URI = "git://github.com/opencontainers/runc;branch=master"
+SRC_URI = " \
+    git://github.com/opencontainers/runc;branch=master \
+    file://0001-Use-correct-go-cross-compiler.patch \
+    "
 RUNC_VERSION = "1.0.0-rc4"
 PROVIDES += "virtual/runc"
 RPROVIDES_${PN} = "virtual/runc"
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/4 runc: Don't override GOARCH or GOROOT

In reply to Paul Barker

These variables are now set correctly by go.bbclass in oe-core. Changing them to point at the native sysroot just leads to build errors in some cases, for example when the target and host have matching GOARCH but not matching c libraries.

---
 recipes-containers/runc/runc.inc | 3 ---
 1 file changed, 3 deletions(-)
recipes-containers/runc/runc.inc +0 -3
index 83d5f86..b1f2ba8 100644
@@ -21,8 +21,6 @@ EXTRA_OEMAKE="BUILDTAGS=''"
 inherit goarch
 
 do_compile() {
-	export GOARCH="${TARGET_GOARCH}"
-	export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
 	# Set GOPATH. See 'PACKAGERS.md'. Don't rely on
 	# docker to download its dependencies but rather
 	# use dependencies packaged independently.
@@ -34,7 +32,6 @@ do_compile() {
 
 	(cd .gopath/src/${dname}; ln -sf ../../../../../${bname} ${bname})
 	export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
-	export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
 
 	# Fix up symlink for go-cross compiler
 	rm -f ${S}/src/import/vendor/src
Signature · 1 line
2.7.4
#5 lore raw
In reply to Paul Barker
Quoted 6 lines · Paul Barker

* Update netns to the latest release.

* Fix runc compilation problems when targeting qemux86-64. Both runc-docker and runc-opencontainers have been build tested with these changes.

* Drop an old patch which is no longer used.

tested and merged.

Thanks Paul!

Bruce

Quoted 27 lines

Paul Barker (4):
netns: Update to v0.2.1
runc: Drop obsolete patch
runc: Use correct go cross-compiler
runc: Don't override GOARCH or GOROOT

 .../0001-Use-correct-go-cross-compiler.patch       | 85 ++++++++++++++++++++++
 recipes-containers/runc/runc-docker_git.bb         |  3 +
 .../0001-Use-correct-go-cross-compiler.patch       | 85 ++++++++++++++++++++++
 recipes-containers/runc/runc-opencontainers_git.bb |  5 +-
 recipes-containers/runc/runc.inc                   |  3 -
 .../0001-nsexec-fix-build-against-musl-libc.patch  | 48 ------------
 recipes-networking/netns/netns_git.bb              |  9 ++-
 7 files changed, 182 insertions(+), 56 deletions(-)
 create mode 100644 recipes-containers/runc/runc-docker/0001-Use-correct-go-cross-compiler.patch
 create mode 100644 recipes-containers/runc/runc-opencontainers/0001-Use-correct-go-cross-compiler.patch
 delete mode 100644 recipes-containers/runc/runc/0001-nsexec-fix-build-against-musl-libc.patch

--
2.7.4

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"