diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-04-06 10:52:23 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-04-09 10:25:48 -0400 |
commit | ab3965109ba1c85e367db2930eee4025eb3dc5ce (patch) | |
tree | 73adb4028d775c08e9d94b9c917b6e6b3defe66a | |
parent | b51b71e57791bb7d7604b13ff30ca712569183ff (diff) | |
download | meta-virtualization-ab3965109ba1c85e367db2930eee4025eb3dc5ce.tar.gz |
docker: restructure to build docker-proxy using provided Makefile
Rather than invoking go directly to build docker-proxy, we can use
the libnetwork Make infrastructure. This picks up our exported go
enviroment variables, and other sysroot flags.
We also apply one patch to ensure that the cross-go toolchain is
used, and that the proper build flags are used.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r-- | recipes-containers/docker/docker_git.bb | 20 | ||||
-rw-r--r-- | recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch | 62 |
2 files changed, 73 insertions, 9 deletions
diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb index 13c27313..e055a4f6 100644 --- a/recipes-containers/docker/docker_git.bb +++ b/recipes-containers/docker/docker_git.bb | |||
@@ -23,10 +23,11 @@ SRCREV_libnetwork = "4cb38c2987c236dce03c868d99b57b1e28a4b81c" | |||
23 | SRCREV_cli = "0f1bb353423e45e02315e985bd9ddebe6da18457" | 23 | SRCREV_cli = "0f1bb353423e45e02315e985bd9ddebe6da18457" |
24 | SRC_URI = "\ | 24 | SRC_URI = "\ |
25 | git://github.com/moby/moby.git;nobranch=1;name=docker \ | 25 | git://github.com/moby/moby.git;nobranch=1;name=docker \ |
26 | git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=libnetwork \ | 26 | git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \ |
27 | git://github.com/docker/cli;branch=master;name=cli;destsuffix=cli \ | 27 | git://github.com/docker/cli;branch=master;name=cli;destsuffix=git/cli \ |
28 | file://docker.init \ | 28 | file://docker.init \ |
29 | file://hi.Dockerfile \ | 29 | file://hi.Dockerfile \ |
30 | file://0001-libnetwork-use-GO-instead-of-go.patch \ | ||
30 | " | 31 | " |
31 | 32 | ||
32 | # Apache-2.0 for docker | 33 | # Apache-2.0 for docker |
@@ -91,8 +92,8 @@ do_compile() { | |||
91 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" | 92 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" |
92 | 93 | ||
93 | mkdir -p .gopath/src/github.com/docker | 94 | mkdir -p .gopath/src/github.com/docker |
94 | ln -sf ${WORKDIR}/libnetwork .gopath/src/github.com/docker/libnetwork | 95 | ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork |
95 | ln -sf ${WORKDIR}/cli .gopath/src/github.com/docker/cli | 96 | ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli |
96 | 97 | ||
97 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | 98 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" |
98 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | 99 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" |
@@ -115,15 +116,16 @@ do_compile() { | |||
115 | # to build this: | 116 | # to build this: |
116 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary | 117 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary |
117 | 118 | ||
118 | # build the proxy | ||
119 | go build -o ${S}/src/import/docker-proxy github.com/docker/libnetwork/cmd/proxy | ||
120 | |||
121 | # build the cli | 119 | # build the cli |
122 | cd ${S}/src/import/.gopath/src/github.com/docker/cli | 120 | cd ${S}/src/import/.gopath/src/github.com/docker/cli |
123 | export CFLAGS="" | 121 | export CFLAGS="" |
124 | export LDFLAGS="" | 122 | export LDFLAGS="" |
125 | export DOCKER_VERSION=${DOCKER_VERSION} | 123 | export DOCKER_VERSION=${DOCKER_VERSION} |
126 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary | 124 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary |
125 | |||
126 | # build the proxy | ||
127 | cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork | ||
128 | oe_runmake cross-local | ||
127 | } | 129 | } |
128 | 130 | ||
129 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | 131 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" |
@@ -137,9 +139,9 @@ INITSCRIPT_PARAMS_${PN} = "defaults" | |||
137 | 139 | ||
138 | do_install() { | 140 | do_install() { |
139 | mkdir -p ${D}/${bindir} | 141 | mkdir -p ${D}/${bindir} |
140 | cp ${WORKDIR}/cli/build/docker ${D}/${bindir}/docker | 142 | cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker |
141 | cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd | 143 | cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd |
142 | cp ${S}/src/import/docker-proxy ${D}/${bindir}/docker-proxy | 144 | cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy |
143 | 145 | ||
144 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | 146 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
145 | install -d ${D}${systemd_unitdir}/system | 147 | install -d ${D}${systemd_unitdir}/system |
diff --git a/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch b/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch new file mode 100644 index 00000000..61ddd26d --- /dev/null +++ b/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 04c07804930faad708218a3134c81de06a9c742a Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
3 | Date: Fri, 6 Apr 2018 23:58:22 -0400 | ||
4 | Subject: [PATCH] libnetwork: use $(GO) instead of go | ||
5 | |||
6 | Ensure that the libnetwork makefile uses the go cross flags and | ||
7 | utilities. | ||
8 | |||
9 | Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
10 | --- | ||
11 | Makefile | 14 +++++++------- | ||
12 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
13 | |||
14 | diff --git a/libnetwork/Makefile b/libnetwork/Makefile | ||
15 | index 17060bc212c7..90cc7a72ef45 100644 | ||
16 | --- a/libnetwork/Makefile | ||
17 | +++ b/libnetwork/Makefile | ||
18 | @@ -26,9 +26,9 @@ build: ${build_image}.created | ||
19 | build-local: | ||
20 | @echo "🐳 $@" | ||
21 | @mkdir -p "bin" | ||
22 | - go build -tags experimental -o "bin/dnet" ./cmd/dnet | ||
23 | - go build -o "bin/docker-proxy" ./cmd/proxy | ||
24 | - GOOS=linux go build -o "./cmd/diagnostic/diagnosticClient" ./cmd/diagnostic | ||
25 | + $(GO) build -tags experimental -o "bin/dnet" ./cmd/dnet | ||
26 | + $(GO) build -o "bin/proxy" ./cmd/proxy | ||
27 | + GOOS=linux $(GO) build -o "./cmd/diagnostic/diagnosticClient" ./cmd/diagnostic | ||
28 | |||
29 | clean: | ||
30 | @echo "🐳 $@" | ||
31 | @@ -51,8 +51,8 @@ cross: ${build_image}.created | ||
32 | |||
33 | cross-local: | ||
34 | @echo "🐳 $@" | ||
35 | - go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet | ||
36 | - go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy | ||
37 | + @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy | ||
38 | + @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet | ||
39 | |||
40 | check: ${build_image}.created | ||
41 | @${docker} ./wrapmake.sh check-local | ||
42 | @@ -68,7 +68,7 @@ run-tests: | ||
43 | if ls $$dir/*.go &> /dev/null; then \ | ||
44 | pushd . &> /dev/null ; \ | ||
45 | cd $$dir ; \ | ||
46 | - go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \ | ||
47 | + $(GO) test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \ | ||
48 | ret=$$? ;\ | ||
49 | if [ $$ret -ne 0 ]; then exit $$ret; fi ;\ | ||
50 | popd &> /dev/null; \ | ||
51 | @@ -94,7 +94,7 @@ coveralls: | ||
52 | # Depends on binaries because vet will silently fail if it can not load compiled imports | ||
53 | vet: ## run go vet | ||
54 | @echo "🐳 $@" | ||
55 | - @test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)" | ||
56 | + @test -z "$$($(GO) vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)" | ||
57 | |||
58 | misspell: | ||
59 | @echo "🐳 $@" | ||
60 | -- | ||
61 | 2.4.0.53.g8440f74 | ||
62 | |||