[meta-virtualization] [PATCH 2/2] netns: Update to v0.4.0

Paul Barker pbarker at toganlabs.com
Tue May 8 13:14:12 PDT 2018


The netns project has been moved into the 'genuinetools' organisation and so
URLs have been updated. The copyright line in the license file has been updated
to reference "The Genuinetools Authors".

The patch name has been updated to make it more suitable for submission
upstream.

Signed-off-by: Paul Barker <paul at toganlabs.com>
---
 .../0001-Allow-selection-of-go-compiler.patch      | 107 +++++++++++++++++++++
 recipes-networking/netns/netns_git.bb              |  16 +--
 2 files changed, 115 insertions(+), 8 deletions(-)
 create mode 100644 recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch

diff --git a/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch b/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch
new file mode 100644
index 0000000..84fb9a4
--- /dev/null
+++ b/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch
@@ -0,0 +1,107 @@
+From 6576f228339b7931e05a8e861f085f483817806b Mon Sep 17 00:00:00 2001
+From: Paul Barker <pbarker at toganlabs.com>
+Date: Tue, 8 May 2018 11:01:14 +0000
+Subject: [PATCH] Allow selection of go compiler
+
+By running `make GO=/path/to/go` we can now select the appropriate go compiler
+to use. This also makes it possible to cross compile netns more easily.
+
+Signed-off-by: Paul Barker <pbarker at toganlabs.com>
+Upstream-status: Pending
+---
+ Makefile | 25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 3a22f3e..476cb9b 100644
+--- a/src/import/Makefile
++++ b/src/import/Makefile
+@@ -23,6 +23,9 @@ CTIMEVAR=-X $(PKG)/version.GITCOMMIT=$(GITCOMMIT) -X $(PKG)/version.VERSION=$(VE
+ GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)"
+ GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static"
+ 
++# Set our default go compiler
++GO := go
++
+ # List the GOOS and GOARCH to build
+ GOOSARCHES = linux/arm linux/arm64 linux/amd64 linux/386
+ 
+@@ -33,12 +36,12 @@ build: $(NAME) ## Builds a dynamic executable or package
+ 
+ $(NAME): *.go VERSION.txt
+ 	@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,23 +58,23 @@ 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: staticcheck
+ staticcheck: ## Verifies `staticcheck` passes
+ 	@echo "+ $@"
+-	@staticcheck $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr
++	@staticcheck $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr
+ 
+ .PHONY: cover
+ cover: ## Runs go test with coverage
+ 	@echo "" > coverage.txt
+-	@for d in $(shell go list ./... | grep -v vendor); do \
+-		go test -race -coverprofile=profile.out -covermode=atomic "$$d"; \
++	@for d in $(shell $(GO) list ./... | grep -v vendor); do \
++		$(GO) test -race -coverprofile=profile.out -covermode=atomic "$$d"; \
+ 		if [ -f profile.out ]; then \
+ 			cat profile.out >> coverage.txt; \
+ 			rm profile.out; \
+@@ -81,11 +84,11 @@ cover: ## Runs go test with coverage
+ .PHONY: install
+ install: ## Installs the executable or package
+ 	@echo "+ $@"
+-	go install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} .
++	$(GO) install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} .
+ 
+ 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} .;
+@@ -99,7 +102,7 @@ cross: *.go VERSION.txt ## Builds the cross-compiled binaries, creating a clean
+ 	$(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} .;
+@@ -115,7 +118,7 @@ release: *.go VERSION.txt ## Builds the cross-compiled binaries, naming them in
+ .PHONY: bump-version
+ BUMP := patch
+ bump-version: ## Bump the version in the version file. Set BUMP 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.txt from $(VERSION) to $(NEW_VERSION)"
+ 	echo $(NEW_VERSION) > VERSION.txt
+-- 
+2.7.4
+
diff --git a/recipes-networking/netns/netns_git.bb b/recipes-networking/netns/netns_git.bb
index d35836e..82a961b 100644
--- a/recipes-networking/netns/netns_git.bb
+++ b/recipes-networking/netns/netns_git.bb
@@ -1,13 +1,13 @@
 HOMEPAGE = "https://github.com/jfrazelle/netns"
 SUMMARY = "Runc hook for setting up default bridge networking."
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
+LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=48ef0979a2bcc3fae14ff30b8a7f5dbf"
 
-SRC_URI = "git://github.com/jessfraz/netns;branch=master \
-           file://0001-Use-correct-go-cross-compiler.patch \
+SRC_URI = "git://github.com/genuinetools/netns;branch=master \
+           file://0001-Allow-selection-of-go-compiler.patch \
           "
-SRCREV = "74e23a0e5c4e7ac011aafcc4623586c196f1b3ef"
-PV = "0.2.1"
+SRCREV = "0da6ab0997707024debe68c91e940c9168041bf8"
+PV = "0.4.0"
 GO_IMPORT = "import"
 
 S = "${WORKDIR}/git"
@@ -26,9 +26,9 @@ do_compile() {
 	# 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"
+	mkdir -p "${S}/src/import/vendor/src/github.com/genuinetools/netns"
+	ln -sfn "${S}/src/import/ipallocator" "${S}/src/import/vendor/src/github.com/genuinetools/netns/ipallocator"
+	ln -sfn "${S}/src/import/version" "${S}/src/import/vendor/src/github.com/genuinetools/netns/version"
 	export GOPATH="${S}/src/import/vendor"
 
 	# Pass the needed cflags/ldflags so that cgo
-- 
2.7.4



More information about the meta-virtualization mailing list