diff options
author | Paul Barker <paul@betafive.co.uk> | 2019-04-29 20:40:17 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2019-05-01 15:39:29 -0400 |
commit | 0fc82d3d0b8c718ac0bbfb72922cf8c72003c646 (patch) | |
tree | b7c9ace743bfeaa0068c6ee9d3cb7ad885f73641 | |
parent | 3038a912be24f7586dba4c70ec96d01a6c9f1852 (diff) | |
download | meta-virtualization-0fc82d3d0b8c718ac0bbfb72922cf8c72003c646.tar.gz |
netns: Upgrade to v0.5.3
Drop obsolete patches and forward-port the remaining required patch. We
also need to fix up permissions after the build so that we can clean the
build directory without errors if needed.
Signed-off-by: Paul Barker <paul@betafive.co.uk>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
4 files changed, 23 insertions, 198 deletions
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 deleted file mode 100644 index 84fb9a43..00000000 --- a/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | From 6576f228339b7931e05a8e861f085f483817806b Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Barker <pbarker@toganlabs.com> | ||
3 | Date: Tue, 8 May 2018 11:01:14 +0000 | ||
4 | Subject: [PATCH] Allow selection of go compiler | ||
5 | |||
6 | By running `make GO=/path/to/go` we can now select the appropriate go compiler | ||
7 | to use. This also makes it possible to cross compile netns more easily. | ||
8 | |||
9 | Signed-off-by: Paul Barker <pbarker@toganlabs.com> | ||
10 | Upstream-status: Pending | ||
11 | --- | ||
12 | Makefile | 25 ++++++++++++++----------- | ||
13 | 1 file changed, 14 insertions(+), 11 deletions(-) | ||
14 | |||
15 | diff --git a/Makefile b/Makefile | ||
16 | index 3a22f3e..476cb9b 100644 | ||
17 | --- a/src/import/Makefile | ||
18 | +++ b/src/import/Makefile | ||
19 | @@ -23,6 +23,9 @@ CTIMEVAR=-X $(PKG)/version.GITCOMMIT=$(GITCOMMIT) -X $(PKG)/version.VERSION=$(VE | ||
20 | GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)" | ||
21 | GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static" | ||
22 | |||
23 | +# Set our default go compiler | ||
24 | +GO := go | ||
25 | + | ||
26 | # List the GOOS and GOARCH to build | ||
27 | GOOSARCHES = linux/arm linux/arm64 linux/amd64 linux/386 | ||
28 | |||
29 | @@ -33,12 +36,12 @@ build: $(NAME) ## Builds a dynamic executable or package | ||
30 | |||
31 | $(NAME): *.go VERSION.txt | ||
32 | @echo "+ $@" | ||
33 | - go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
34 | + $(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
35 | |||
36 | .PHONY: static | ||
37 | static: ## Builds a static executable | ||
38 | @echo "+ $@" | ||
39 | - CGO_ENABLED=0 go build \ | ||
40 | + CGO_ENABLED=0 $(GO) build \ | ||
41 | -tags "$(BUILDTAGS) static_build" \ | ||
42 | ${GO_LDFLAGS_STATIC} -o $(NAME) . | ||
43 | |||
44 | @@ -55,23 +58,23 @@ lint: ## Verifies `golint` passes | ||
45 | .PHONY: test | ||
46 | test: ## Runs the go tests | ||
47 | @echo "+ $@" | ||
48 | - @go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor) | ||
49 | + @$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor) | ||
50 | |||
51 | .PHONY: vet | ||
52 | vet: ## Verifies `go vet` passes | ||
53 | @echo "+ $@" | ||
54 | - @go vet $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
55 | + @$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
56 | |||
57 | .PHONY: staticcheck | ||
58 | staticcheck: ## Verifies `staticcheck` passes | ||
59 | @echo "+ $@" | ||
60 | - @staticcheck $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
61 | + @staticcheck $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
62 | |||
63 | .PHONY: cover | ||
64 | cover: ## Runs go test with coverage | ||
65 | @echo "" > coverage.txt | ||
66 | - @for d in $(shell go list ./... | grep -v vendor); do \ | ||
67 | - go test -race -coverprofile=profile.out -covermode=atomic "$$d"; \ | ||
68 | + @for d in $(shell $(GO) list ./... | grep -v vendor); do \ | ||
69 | + $(GO) test -race -coverprofile=profile.out -covermode=atomic "$$d"; \ | ||
70 | if [ -f profile.out ]; then \ | ||
71 | cat profile.out >> coverage.txt; \ | ||
72 | rm profile.out; \ | ||
73 | @@ -81,11 +84,11 @@ cover: ## Runs go test with coverage | ||
74 | .PHONY: install | ||
75 | install: ## Installs the executable or package | ||
76 | @echo "+ $@" | ||
77 | - go install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . | ||
78 | + $(GO) install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . | ||
79 | |||
80 | define buildpretty | ||
81 | mkdir -p $(BUILDDIR)/$(1)/$(2); | ||
82 | -GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
83 | +GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ | ||
84 | -o $(BUILDDIR)/$(1)/$(2)/$(NAME) \ | ||
85 | -a -tags "$(BUILDTAGS) static_build netgo" \ | ||
86 | -installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
87 | @@ -99,7 +102,7 @@ cross: *.go VERSION.txt ## Builds the cross-compiled binaries, creating a clean | ||
88 | $(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) | ||
89 | |||
90 | define buildrelease | ||
91 | -GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
92 | +GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ | ||
93 | -o $(BUILDDIR)/$(NAME)-$(1)-$(2) \ | ||
94 | -a -tags "$(BUILDTAGS) static_build netgo" \ | ||
95 | -installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
96 | @@ -115,7 +118,7 @@ release: *.go VERSION.txt ## Builds the cross-compiled binaries, naming them in | ||
97 | .PHONY: bump-version | ||
98 | BUMP := patch | ||
99 | bump-version: ## Bump the version in the version file. Set BUMP to [ patch | major | minor ] | ||
100 | - @go get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
101 | + @$(GO) get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
102 | $(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION))) | ||
103 | @echo "Bumping VERSION.txt from $(VERSION) to $(NEW_VERSION)" | ||
104 | echo $(NEW_VERSION) > VERSION.txt | ||
105 | -- | ||
106 | 2.7.4 | ||
107 | |||
diff --git a/recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch b/recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch deleted file mode 100644 index ed66e11b..00000000 --- a/recipes-networking/netns/files/0001-Use-correct-go-cross-compiler.patch +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | From d5c319bb61155d94bef2571a095d82983d786b94 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Barker <pbarker@toganlabs.com> | ||
3 | Date: Fri, 13 Oct 2017 17:58:11 +0000 | ||
4 | Subject: [PATCH] Use correct go cross-compiler | ||
5 | |||
6 | Signed-off-by: Paul Barker <pbarker@toganlabs.com> | ||
7 | Upstream-status: Pending | ||
8 | --- | ||
9 | Makefile | 16 ++++++++-------- | ||
10 | 1 file changed, 8 insertions(+), 8 deletions(-) | ||
11 | |||
12 | diff --git a/Makefile b/Makefile | ||
13 | index cb9a46d..633f884 100644 | ||
14 | --- a/src/import/Makefile | ||
15 | +++ b/src/import/Makefile | ||
16 | @@ -33,12 +33,12 @@ build: $(NAME) ## Builds a dynamic executable or package | ||
17 | |||
18 | $(NAME): *.go VERSION | ||
19 | @echo "+ $@" | ||
20 | - go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
21 | + $(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
22 | |||
23 | .PHONY: static | ||
24 | static: ## Builds a static executable | ||
25 | @echo "+ $@" | ||
26 | - CGO_ENABLED=0 go build \ | ||
27 | + CGO_ENABLED=0 $(GO) build \ | ||
28 | -tags "$(BUILDTAGS) static_build" \ | ||
29 | ${GO_LDFLAGS_STATIC} -o $(NAME) . | ||
30 | |||
31 | @@ -55,21 +55,21 @@ lint: ## Verifies `golint` passes | ||
32 | .PHONY: test | ||
33 | test: ## Runs the go tests | ||
34 | @echo "+ $@" | ||
35 | - @go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor) | ||
36 | + @$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor) | ||
37 | |||
38 | .PHONY: vet | ||
39 | vet: ## Verifies `go vet` passes | ||
40 | @echo "+ $@" | ||
41 | - @go vet $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
42 | + @$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
43 | |||
44 | .PHONY: install | ||
45 | install: ## Installs the executable or package | ||
46 | @echo "+ $@" | ||
47 | - @go install . | ||
48 | + @$(GO) install . | ||
49 | |||
50 | define buildpretty | ||
51 | mkdir -p $(BUILDDIR)/$(1)/$(2); | ||
52 | -GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
53 | +GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ | ||
54 | -o $(BUILDDIR)/$(1)/$(2)/$(NAME) \ | ||
55 | -a -tags "$(BUILDTAGS) static_build netgo" \ | ||
56 | -installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
57 | @@ -83,7 +83,7 @@ cross: *.go VERSION ## Builds the cross-compiled binaries, creating a clean dire | ||
58 | $(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) | ||
59 | |||
60 | define buildrelease | ||
61 | -GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
62 | +GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ | ||
63 | -o $(BUILDDIR)/$(NAME)-$(1)-$(2) \ | ||
64 | -a -tags "$(BUILDTAGS) static_build netgo" \ | ||
65 | -installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
66 | @@ -99,7 +99,7 @@ release: *.go VERSION ## Builds the cross-compiled binaries, naming them in such | ||
67 | .PHONY: bump-version | ||
68 | BUMP := patch | ||
69 | bump-version: ## Bump the version in the version file. Set KIND to [ patch | major | minor ] | ||
70 | - @go get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
71 | + @$(GO) get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
72 | $(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION))) | ||
73 | @echo "Bumping VERSION from $(VERSION) to $(NEW_VERSION)" | ||
74 | echo $(NEW_VERSION) > VERSION | ||
75 | -- | ||
76 | 2.7.4 | ||
77 | |||
diff --git a/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch b/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch index 3b0c0a46..3ed4c21e 100644 --- a/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch +++ b/recipes-networking/netns/files/Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 09524d187ef108784c854a0c247ac6476a10bb67 Mon Sep 17 00:00:00 2001 | 1 | From fa402247e9b24470648a366cfda1c9134660146a Mon Sep 17 00:00:00 2001 |
2 | From: Mark Asselstine <mark.asselstine@windriver.com> | 2 | From: Mark Asselstine <mark.asselstine@windriver.com> |
3 | Date: Mon, 18 Mar 2019 14:04:16 -0400 | 3 | Date: Mon, 18 Mar 2019 14:04:16 -0400 |
4 | Subject: [PATCH] Makefile: force rebuilding all packages to avoid cgo | 4 | Subject: [PATCH] Makefile: force rebuilding all packages to avoid cgo |
@@ -32,23 +32,27 @@ used. | |||
32 | Upstream-Status: Inappropriate [only an issue with our builds] | 32 | Upstream-Status: Inappropriate [only an issue with our builds] |
33 | 33 | ||
34 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> | 34 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> |
35 | |||
36 | Forward-ported to v0.5.3. | ||
37 | |||
38 | Signed-off-by: Paul Barker <paul@betafive.co.uk> | ||
35 | --- | 39 | --- |
36 | Makefile | 2 +- | 40 | basic.mk | 2 +- |
37 | 1 file changed, 1 insertion(+), 1 deletion(-) | 41 | 1 file changed, 1 insertion(+), 1 deletion(-) |
38 | 42 | ||
39 | diff --git a/Makefile b/Makefile | 43 | diff --git a/basic.mk b/basic.mk |
40 | index 476cb9b..ecd0df4 100644 | 44 | index 187dff3..fb080b7 100644 |
41 | --- a/src/import/Makefile | 45 | --- a/src/import/basic.mk |
42 | +++ b/src/import/Makefile | 46 | +++ b/src/import/basic.mk |
43 | @@ -41,7 +41,7 @@ $(NAME): *.go VERSION.txt | 47 | @@ -50,7 +50,7 @@ $(NAME): $(wildcard *.go) $(wildcard */*.go) VERSION.txt |
44 | .PHONY: static | 48 | .PHONY: static |
45 | static: ## Builds a static executable | 49 | static: prebuild ## Builds a static executable. |
46 | @echo "+ $@" | 50 | @echo "+ $@" |
47 | - CGO_ENABLED=0 $(GO) build \ | 51 | - CGO_ENABLED=$(CGO_ENABLED) $(GO) build \ |
48 | + CGO_ENABLED=0 $(GO) build -a -pkgdir dontusecurrentpkgs \ | 52 | + CGO_ENABLED=$(CGO_ENABLED) $(GO) build -a -pkgdir dontusecurrentpkgs \ |
49 | -tags "$(BUILDTAGS) static_build" \ | 53 | -tags "$(BUILDTAGS) static_build" \ |
50 | ${GO_LDFLAGS_STATIC} -o $(NAME) . | 54 | ${GO_LDFLAGS_STATIC} -o $(NAME) . |
51 | 55 | ||
52 | -- | 56 | -- |
53 | 2.7.4 | 57 | 2.17.1 |
54 | 58 | ||
diff --git a/recipes-networking/netns/netns_git.bb b/recipes-networking/netns/netns_git.bb index f5cdace0..da6aac21 100644 --- a/recipes-networking/netns/netns_git.bb +++ b/recipes-networking/netns/netns_git.bb | |||
@@ -4,11 +4,10 @@ LICENSE = "MIT" | |||
4 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=48ef0979a2bcc3fae14ff30b8a7f5dbf" | 4 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=48ef0979a2bcc3fae14ff30b8a7f5dbf" |
5 | 5 | ||
6 | SRC_URI = "git://github.com/genuinetools/netns;branch=master \ | 6 | SRC_URI = "git://github.com/genuinetools/netns;branch=master \ |
7 | file://0001-Allow-selection-of-go-compiler.patch \ | ||
8 | file://Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch \ | 7 | file://Makefile-force-rebuilding-all-packages-to-avoid-cgo.patch \ |
9 | " | 8 | " |
10 | SRCREV = "0da6ab0997707024debe68c91e940c9168041bf8" | 9 | SRCREV = "9b103a19b917cc3762a33b7d78244b1d5e45ccfd" |
11 | PV = "0.4.0" | 10 | PV = "0.5.3" |
12 | GO_IMPORT = "import" | 11 | GO_IMPORT = "import" |
13 | 12 | ||
14 | S = "${WORKDIR}/git" | 13 | S = "${WORKDIR}/git" |
@@ -46,6 +45,12 @@ do_compile() { | |||
46 | # Static builds work but are not recommended. See Makefile*cgo patch. | 45 | # Static builds work but are not recommended. See Makefile*cgo patch. |
47 | #oe_runmake static | 46 | #oe_runmake static |
48 | oe_runmake build | 47 | oe_runmake build |
48 | |||
49 | # Golang forces permissions to 0500 on directories and 0400 on files in | ||
50 | # the module cache which prevents us from easily cleaning up the build | ||
51 | # directory. Let's just fix the permissions here so we don't have to | ||
52 | # hack the clean tasks. | ||
53 | chmod -R u+w vendor/pkg/mod | ||
49 | } | 54 | } |
50 | 55 | ||
51 | do_install() { | 56 | do_install() { |