Skip to contentSkip to conversation

netns fix and runc recipe simplification

PATCH In review Paul Barker 2 participants 7 messages Oct 13, 2017 – Oct 16, 2017

lore
Share & tools
lore
#0 lore raw

cover netns fix and runc recipe simplification

Here's another round of changes. The first patch fixes netns cross-compilation. The rest replace "[PATCH 4/4] runc: Simplify recipes" from the previous series, splitting it into separate commits and dropping churn where it adds no value.

I've left the merging of common metadata as the last patch incase that still isn't wanted.

Paul Barker (5):
netns: Use correct go cross-compiler
runc-opencontainers: Drop unnecessary do_compile_prepend
runc-docker: Drop unused EXTRA_FLAGS
runc: Drop inherit goarch
runc: Merge common metadata into inc file

 recipes-containers/runc/runc-docker_git.bb         |  6 --
 recipes-containers/runc/runc-opencontainers_git.bb | 11 ----
 recipes-containers/runc/runc.inc                   |  6 +-
 .../files/0001-Use-correct-go-cross-compiler.patch | 77 ++++++++++++++++++++++
 recipes-networking/netns/netns_git.bb              |  4 +-
 5 files changed, 84 insertions(+), 20 deletions(-)
 create mode 100644 recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 netns: Use correct go cross-compiler

The makefile for netns needs to be patched to ensure that we use the binaries from go-cross and not go-native.

---
 .../files/0001-Use-correct-go-cross-compiler.patch | 77 ++++++++++++++++++++++
 recipes-networking/netns/netns_git.bb              |  4 +-
 2 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch
recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch new file +77 -0
new file mode 100644
index 0000000..ed66e11
@@ -0,0 +1,77 @@
+From d5c319bb61155d94bef2571a095d82983d786b94 Mon Sep 17 00:00:00 2001
+From: Paul Barker <[email protected]>
+Date: Fri, 13 Oct 2017 17:58:11 +0000
+Subject: [PATCH] Use correct go cross-compiler
+
+Signed-off-by: Paul Barker <[email protected]>
+Upstream-status: Pending
+---
+ Makefile | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index cb9a46d..633f884 100644
+--- a/src/import/Makefile
++++ b/src/import/Makefile
+@@ -33,12 +33,12 @@ build: $(NAME) ## Builds a dynamic executable or package
+ 
+ $(NAME): *.go VERSION
+ 	@echo "+ $@"
+-	go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) .
++	$(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) .
+ 
+ .PHONY: static
+ static: ## Builds a static executable
+ 	@echo "+ $@"
+-	CGO_ENABLED=0 go build \
++	CGO_ENABLED=0 $(GO) build \
+ 				-tags "$(BUILDTAGS) static_build" \
+ 				${GO_LDFLAGS_STATIC} -o $(NAME) .
+ 
+@@ -55,21 +55,21 @@ lint: ## Verifies `golint` passes
+ .PHONY: test
+ test: ## Runs the go tests
+ 	@echo "+ $@"
+-	@go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor)
++	@$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor)
+ 
+ .PHONY: vet
+ vet: ## Verifies `go vet` passes
+ 	@echo "+ $@"
+-	@go vet $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr
++	@$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr
+ 
+ .PHONY: install
+ install: ## Installs the executable or package
+ 	@echo "+ $@"
+-	@go install .
++	@$(GO) install .
+ 
+ define buildpretty
+ mkdir -p $(BUILDDIR)/$(1)/$(2);
+-GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \
++GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \
+ 	 -o $(BUILDDIR)/$(1)/$(2)/$(NAME) \
+ 	 -a -tags "$(BUILDTAGS) static_build netgo" \
+ 	 -installsuffix netgo ${GO_LDFLAGS_STATIC} .;
+@@ -83,7 +83,7 @@ cross: *.go VERSION ## Builds the cross-compiled binaries, creating a clean dire
+ 	$(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH))))
+ 
+ define buildrelease
+-GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \
++GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \
+ 	 -o $(BUILDDIR)/$(NAME)-$(1)-$(2) \
+ 	 -a -tags "$(BUILDTAGS) static_build netgo" \
+ 	 -installsuffix netgo ${GO_LDFLAGS_STATIC} .;
+@@ -99,7 +99,7 @@ release: *.go VERSION ## Builds the cross-compiled binaries, naming them in such
+ .PHONY: bump-version
+ BUMP := patch
+ bump-version: ## Bump the version in the version file. Set KIND to [ patch | major | minor ]
+-	@go get -u github.com/jessfraz/junk/sembump # update sembump tool
++	@$(GO) get -u github.com/jessfraz/junk/sembump # update sembump tool
+ 	$(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION)))
+ 	@echo "Bumping VERSION from $(VERSION) to $(NEW_VERSION)"
+ 	echo $(NEW_VERSION) > VERSION
+-- 
+2.7.4
+
recipes-networking/netns/netns_git.bb +3 -1
index 4437764..d35836e 100644
@@ -3,7 +3,9 @@ SUMMARY = "Runc hook for setting up default bridge networking."
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
 
-SRC_URI = "git://github.com/jessfraz/netns;branch=master"
+SRC_URI = "git://github.com/jessfraz/netns;branch=master \
+           file://0001-Use-correct-go-cross-compiler.patch \
+          "
 SRCREV = "74e23a0e5c4e7ac011aafcc4623586c196f1b3ef"
 PV = "0.2.1"
 GO_IMPORT = "import"
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 runc-opencontainers: Drop unnecessary do_compile_prepend

In reply to Paul Barker

The "vendor/src" symlink is already created in do_compile in runc.inc.

---
 recipes-containers/runc/runc-opencontainers_git.bb | 7 -------
 1 file changed, 7 deletions(-)
recipes-containers/runc/runc-opencontainers_git.bb +0 -7
index 2cfceea..78488e0 100644
@@ -10,10 +10,3 @@ PROVIDES += "virtual/runc"
 RPROVIDES_${PN} = "virtual/runc"
 
 GO_IMPORT = "import"
-
-do_compile_prepend() {
-	# Go looks in a src directory under any directory in GOPATH but
-	# runc-opencontainers uses 'vendor' instead of 'vendor/src'. We can fix
-	# this with a symlink.
-	ln -sfn . "${S}/src/import/vendor/src"
-}
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 runc-docker: Drop unused EXTRA_FLAGS

In reply to Paul Barker

This variable isn't picked up by the runc Makefile anyway as it isn't exported.

---
 recipes-containers/runc/runc-docker_git.bb | 2 --
 1 file changed, 2 deletions(-)
recipes-containers/runc/runc-docker_git.bb +0 -2
index 28232d9..b8754bd 100644
@@ -14,8 +14,6 @@ SRC_URI = "git://github.com/docker/runc.git;nobranch=1;name=runc-docker \
 
 GO_IMPORT = "import"
 
-EXTRA_FLAGS = "-v -x -work"
-
 RUNC_VERSION = "1.0.0-rc3"
 PROVIDES += "virtual/runc"
 RPROVIDES_${PN} = "virtual/runc"
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 runc: Drop inherit goarch

In reply to Paul Barker

The go bbclass already inherits goarch.

---
 recipes-containers/runc/runc.inc | 2 --
 1 file changed, 2 deletions(-)
recipes-containers/runc/runc.inc +0 -2
index b1f2ba8..c1ff08f 100644
@@ -18,8 +18,6 @@ LIBCONTAINER_PACKAGE="github.com/opencontainers/runc/libcontainer"
 do_configure[noexec] = "1"
 EXTRA_OEMAKE="BUILDTAGS=''"
 
-inherit goarch
-
 do_compile() {
 	# Set GOPATH. See 'PACKAGERS.md'. Don't rely on
 	# docker to download its dependencies but rather
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 runc: Merge common metadata into inc file

In reply to Paul Barker
---
 recipes-containers/runc/runc-docker_git.bb         | 4 ----
 recipes-containers/runc/runc-opencontainers_git.bb | 4 ----
 recipes-containers/runc/runc.inc                   | 4 ++++
 3 files changed, 4 insertions(+), 8 deletions(-)
recipes-containers/runc/runc-docker_git.bb +0 -4
index b8754bd..9db48ee 100644
@@ -12,8 +12,4 @@ SRC_URI = "git://github.com/docker/runc.git;nobranch=1;name=runc-docker \
            file://0001-Disable-building-recvtty.patch \
           "
 
-GO_IMPORT = "import"
-
 RUNC_VERSION = "1.0.0-rc3"
-PROVIDES += "virtual/runc"
-RPROVIDES_${PN} = "virtual/runc"
recipes-containers/runc/runc-opencontainers_git.bb +0 -4
index 78488e0..a97676b 100644
@@ -6,7 +6,3 @@ SRC_URI = " \
     file://0001-Use-correct-go-cross-compiler.patch \
     "
 RUNC_VERSION = "1.0.0-rc4"
-PROVIDES += "virtual/runc"
-RPROVIDES_${PN} = "virtual/runc"
-
-GO_IMPORT = "import"
recipes-containers/runc/runc.inc +4 -0
index c1ff08f..d2aec84 100644
@@ -12,6 +12,10 @@ PV = "${RUNC_VERSION}+git${SRCREV}"
 
 inherit go
 RRECOMMENDS_${PN} = "lxc docker"
+PROVIDES += "virtual/runc"
+RPROVIDES_${PN} = "virtual/runc"
+
+GO_IMPORT = "import"
 
 LIBCONTAINER_PACKAGE="github.com/opencontainers/runc/libcontainer"
 
Signature · 1 line
2.7.4
#6 lore raw
In reply to Paul Barker
Quoted 6 lines · Paul Barker

Here's another round of changes. The first patch fixes netns cross-compilation. The rest replace "[PATCH 4/4] runc: Simplify recipes" from the previous series, splitting it into separate commits and dropping churn where it adds no value.

I've left the merging of common metadata as the last patch incase that still isn't wanted.

This variant of the merged meta data is fine.

I've merged all 5 patches now.

Bruce

Quoted 24 lines

Paul Barker (5):
netns: Use correct go cross-compiler
runc-opencontainers: Drop unnecessary do_compile_prepend
runc-docker: Drop unused EXTRA_FLAGS
runc: Drop inherit goarch
runc: Merge common metadata into inc file

 recipes-containers/runc/runc-docker_git.bb         |  6 --
 recipes-containers/runc/runc-opencontainers_git.bb | 11 ----
 recipes-containers/runc/runc.inc                   |  6 +-
 .../files/0001-Use-correct-go-cross-compiler.patch | 77 ++++++++++++++++++++++
 recipes-networking/netns/netns_git.bb              |  4 +-
 5 files changed, 84 insertions(+), 20 deletions(-)
 create mode 100644 recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.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"