diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2021-04-29 17:09:31 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2021-04-29 17:09:31 -0400 |
commit | 9d98a04b2646cfc1db9dc36e628ebdced7cff2d9 (patch) | |
tree | b2ea2fd19c84870856af33d504402f99345108cf | |
parent | cd5eead051128154bf8efa88c15b18b4e29340e2 (diff) | |
download | meta-virtualization-9d98a04b2646cfc1db9dc36e628ebdced7cff2d9.tar.gz |
docker: unify common parts of docker-ce and docker-moby recipes
Now that docker-ce is being built from the same repos as docker-moby,
the only unique things in the recipes are the SRCREVs.
We move the common packaging, compile/install routines and configuration
to the .inc files.
We also move the patches to the generic 'files' directory, so they
can be shared.
If we there are SRCREV bumps in the future that diverge moby and
docker, we'll hold patches in their named directorys and tweak
the compile/install routines as necessary.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
11 files changed, 95 insertions, 349 deletions
diff --git a/recipes-containers/docker/docker-ce/0001-build-use-build-script-without-docker.patch b/recipes-containers/docker/docker-ce/0001-build-use-build-script-without-docker.patch deleted file mode 100644 index 070ebd63..00000000 --- a/recipes-containers/docker/docker-ce/0001-build-use-build-script-without-docker.patch +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | From 45d03c7b04353d2e5955e573bc1063fcb0647a0c Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Thu, 15 Apr 2021 16:30:37 -0400 | ||
4 | Subject: [PATCH] build: use build script without docker | ||
5 | |||
6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
7 | --- | ||
8 | git/src/import/components/cli/Makefile | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git git/src/import/components/cli/Makefile git/src/import/components/cli/Makefile | ||
12 | index 9e62210c33..9c7631f674 100644 | ||
13 | --- git/src/import/components/cli/Makefile | ||
14 | +++ git/src/import/components/cli/Makefile | ||
15 | @@ -51,7 +51,7 @@ plugins-osx: ## build example CLI plugins for macOS | ||
16 | |||
17 | .PHONY: dynbinary | ||
18 | dynbinary: ## build dynamically linked binary | ||
19 | - USE_GLIBC=1 docker buildx bake dynbinary | ||
20 | + GO_LINKMODE=dynamic ./scripts/build/binary | ||
21 | |||
22 | vendor: vendor.conf ## check that vendor matches vendor.conf | ||
23 | rm -rf vendor | ||
24 | -- | ||
25 | 2.19.1 | ||
26 | |||
diff --git a/recipes-containers/docker/docker-ce/0001-cli-use-go-cross-compiler.patch b/recipes-containers/docker/docker-ce/0001-cli-use-go-cross-compiler.patch deleted file mode 100644 index d9924112..00000000 --- a/recipes-containers/docker/docker-ce/0001-cli-use-go-cross-compiler.patch +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | From ae6f4a1e685394fb7b9539f134b66ca84ddc91c2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Tue, 30 Jun 2020 22:19:56 -0400 | ||
4 | Subject: [PATCH] cli: use go cross compiler | ||
5 | |||
6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
7 | --- | ||
8 | git/cli/scripts/build/dynbinary | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git git/src/import/components/cli/scripts/build/dynbinary git/src/import/components/cli/scripts/build/dynbinary | ||
12 | index 4feb7e71d8..f990d0e040 100755 | ||
13 | --- git/src/import/components/cli/scripts/build/dynbinary | ||
14 | +++ git/src/import/components/cli/scripts/build/dynbinary | ||
15 | @@ -9,6 +9,6 @@ source ./scripts/build/.variables | ||
16 | |||
17 | echo "Building dynamically linked $TARGET" | ||
18 | export CGO_ENABLED=1 | ||
19 | -go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" -buildmode=pie "${SOURCE}" | ||
20 | +${GO} build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" -buildmode=pie "${SOURCE}" | ||
21 | |||
22 | ln -sf "$(basename "${TARGET}")" build/docker | ||
23 | -- | ||
24 | 2.19.1 | ||
25 | |||
diff --git a/recipes-containers/docker/docker-ce_git.bb b/recipes-containers/docker/docker-ce_git.bb index 54cfa5d8..42e97a18 100644 --- a/recipes-containers/docker/docker-ce_git.bb +++ b/recipes-containers/docker/docker-ce_git.bb | |||
@@ -50,100 +50,5 @@ require docker.inc | |||
50 | LICENSE = "Apache-2.0" | 50 | LICENSE = "Apache-2.0" |
51 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28" | 51 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28" |
52 | 52 | ||
53 | GO_IMPORT = "import" | ||
54 | |||
55 | S = "${WORKDIR}/git" | ||
56 | |||
57 | DOCKER_VERSION = "20.10.6-ce" | 53 | DOCKER_VERSION = "20.10.6-ce" |
58 | PV = "${DOCKER_VERSION}+git${SRCREV_docker}" | 54 | PV = "${DOCKER_VERSION}+git${SRCREV_docker}" |
59 | |||
60 | PACKAGES =+ "${PN}-contrib" | ||
61 | |||
62 | DOCKER_PKG="github.com/docker/docker" | ||
63 | # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 | ||
64 | BUILD_TAGS = "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" | ||
65 | |||
66 | inherit go | ||
67 | inherit goarch | ||
68 | inherit pkgconfig | ||
69 | |||
70 | do_configure[noexec] = "1" | ||
71 | |||
72 | do_compile() { | ||
73 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
74 | # docker to download its dependencies but rather | ||
75 | # use dependencies packaged independently. | ||
76 | cd ${S}/src/import | ||
77 | rm -rf .gopath | ||
78 | mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" | ||
79 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" | ||
80 | |||
81 | ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork | ||
82 | ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli | ||
83 | |||
84 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
85 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
86 | |||
87 | # Pass the needed cflags/ldflags so that cgo | ||
88 | # can find the needed headers files and libraries | ||
89 | export GOARCH=${TARGET_GOARCH} | ||
90 | export CGO_ENABLED="1" | ||
91 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
92 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
93 | export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}' | ||
94 | |||
95 | export DISABLE_WARN_OUTSIDE_CONTAINER=1 | ||
96 | export GO111MODULE=off | ||
97 | |||
98 | cd ${S}/src/import/ | ||
99 | |||
100 | # this is the unsupported build structure that doesn't rely on an | ||
101 | # existing docker to build this: | ||
102 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary | ||
103 | |||
104 | # build the proxy | ||
105 | cd ${S}/src/import | ||
106 | ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork | ||
107 | cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork | ||
108 | oe_runmake cross-local | ||
109 | |||
110 | # build the cli | ||
111 | cd ${S}/src/import/.gopath/src/github.com/docker/cli | ||
112 | export CFLAGS="" | ||
113 | export LDFLAGS="" | ||
114 | export DOCKER_VERSION=${DOCKER_VERSION} | ||
115 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary | ||
116 | } | ||
117 | |||
118 | do_install() { | ||
119 | mkdir -p ${D}/${bindir} | ||
120 | cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker | ||
121 | cp ${S}/src/import/bundles/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd | ||
122 | cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy | ||
123 | |||
124 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
125 | install -d ${D}${systemd_unitdir}/system | ||
126 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | ||
127 | # replaces one copied from above with one that uses the local registry for a mirror | ||
128 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system | ||
129 | rm -f ${D}/${systemd_unitdir}/system/docker.service.rpm | ||
130 | else | ||
131 | install -d ${D}${sysconfdir}/init.d | ||
132 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | ||
133 | fi | ||
134 | # TLS key that docker creates at run-time if not found is what resides here | ||
135 | if ${@bb.utils.contains('PACKAGECONFIG','transient-config','true','false',d)}; then | ||
136 | install -d ${D}${sysconfdir} | ||
137 | ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker | ||
138 | else | ||
139 | install -d ${D}${sysconfdir}/docker | ||
140 | fi | ||
141 | |||
142 | mkdir -p ${D}${datadir}/docker/ | ||
143 | install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/ | ||
144 | } | ||
145 | |||
146 | FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker" | ||
147 | |||
148 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" | ||
149 | RDEPENDS_${PN}-contrib += "bash" | ||
diff --git a/recipes-containers/docker/docker-moby/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch b/recipes-containers/docker/docker-moby/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch deleted file mode 100644 index dc322612..00000000 --- a/recipes-containers/docker/docker-moby/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | From 650c882d3c53db118b01dd5e15fa1bc0ddaa36f1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Thu, 15 Apr 2021 11:28:05 -0400 | ||
4 | Subject: [PATCH] cli: use external GO111MODULE and cross compiler | ||
5 | |||
6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
7 | --- | ||
8 | git/cli/scripts/build/binary | 3 +-- | ||
9 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
10 | |||
11 | diff --git git/cli/scripts/build/binary git/cli/scripts/build/binary | ||
12 | index e4c5e12a6b..7c47b75c2f 100755 | ||
13 | --- git/cli/scripts/build/binary | ||
14 | +++ git/cli/scripts/build/binary | ||
15 | @@ -73,8 +73,7 @@ fi | ||
16 | |||
17 | echo "Building $GO_LINKMODE $(basename "${TARGET}")" | ||
18 | |||
19 | -export GO111MODULE=auto | ||
20 | |||
21 | -go build -o "${TARGET}" -tags "${GO_BUILDTAGS}" --ldflags "${LDFLAGS}" ${GO_BUILDMODE} "${SOURCE}" | ||
22 | +${GO} build -o "${TARGET}" -tags "${GO_BUILDTAGS}" --ldflags "${LDFLAGS}" ${GO_BUILDMODE} "${SOURCE}" | ||
23 | |||
24 | ln -sf "$(basename "${TARGET}")" "$(dirname "${TARGET}")/docker" | ||
25 | -- | ||
26 | 2.19.1 | ||
27 | |||
diff --git a/recipes-containers/docker/docker-moby/0001-dynbinary-use-go-cross-compiler.patch b/recipes-containers/docker/docker-moby/0001-dynbinary-use-go-cross-compiler.patch deleted file mode 100644 index 971c60d7..00000000 --- a/recipes-containers/docker/docker-moby/0001-dynbinary-use-go-cross-compiler.patch +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | From bbf600cc4d46c3f7ec0c1b486790a2402d41f550 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
3 | Date: Tue, 30 Jun 2020 22:23:33 -0400 | ||
4 | Subject: [PATCH] dynbinary: use go cross compiler | ||
5 | |||
6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
7 | --- | ||
8 | hack/make/.binary | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | Index: git/src/import/hack/make/.binary | ||
12 | =================================================================== | ||
13 | --- git.orig/src/import/hack/make/.binary | ||
14 | +++ git/src/import/hack/make/.binary | ||
15 | @@ -81,7 +81,7 @@ | ||
16 | |||
17 | echo "Building: $DEST/$BINARY_FULLNAME" | ||
18 | echo "GOOS=\"${GOOS}\" GOARCH=\"${GOARCH}\" GOARM=\"${GOARM}\"" | ||
19 | - go build \ | ||
20 | + ${GO} build \ | ||
21 | -o "$DEST/$BINARY_FULLNAME" \ | ||
22 | "${BUILDFLAGS[@]}" \ | ||
23 | -ldflags " | ||
diff --git a/recipes-containers/docker/docker-moby/0001-libnetwork-use-GO-instead-of-go.patch b/recipes-containers/docker/docker-moby/0001-libnetwork-use-GO-instead-of-go.patch deleted file mode 100644 index c623b260..00000000 --- a/recipes-containers/docker/docker-moby/0001-libnetwork-use-GO-instead-of-go.patch +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
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 | Index: git/libnetwork/Makefile | ||
15 | =================================================================== | ||
16 | --- git.orig/libnetwork/Makefile | ||
17 | +++ git/libnetwork/Makefile | ||
18 | @@ -45,9 +45,9 @@ | ||
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 | - CGO_ENABLED=0 go build -o "bin/diagnosticClient" ./cmd/diagnostic | ||
25 | + $(GO) build -tags experimental -o "bin/dnet" ./cmd/dnet | ||
26 | + $(GO) build -o "bin/proxy" ./cmd/proxy | ||
27 | + CGO_ENABLED=0 $(GO) build -o "bin/diagnosticClient" ./cmd/diagnostic | ||
28 | CGO_ENABLED=0 go build -o "bin/testMain" ./cmd/networkdb-test/testMain.go | ||
29 | |||
30 | build-images: | ||
31 | @@ -82,8 +82,8 @@ | ||
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 | # Rebuild protocol buffers. | ||
41 | # These may need to be rebuilt after vendoring updates, so .proto files are declared .PHONY so they are always rebuilt. | ||
42 | @@ -130,7 +130,7 @@ | ||
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 | @@ -145,7 +145,7 @@ | ||
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 "🐳 $@" | ||
diff --git a/recipes-containers/docker/docker-moby_git.bb b/recipes-containers/docker/docker-moby_git.bb index 9f5be5c6..1d76dff8 100644 --- a/recipes-containers/docker/docker-moby_git.bb +++ b/recipes-containers/docker/docker-moby_git.bb | |||
@@ -34,7 +34,6 @@ DESCRIPTION = "Linux container runtime \ | |||
34 | # - The common components of this recipe and docker-ce do need to be moved | 34 | # - The common components of this recipe and docker-ce do need to be moved |
35 | # to a docker.inc recipe | 35 | # to a docker.inc recipe |
36 | 36 | ||
37 | # moby commit matches the docker-engine bump on the 19.03 branch' | ||
38 | SRCREV_moby = "ce826938232fbee567c8805460a8b2c82dc2e493" | 37 | SRCREV_moby = "ce826938232fbee567c8805460a8b2c82dc2e493" |
39 | SRCREV_libnetwork = "b3507428be5b458cb0e2b4086b13531fb0706e46" | 38 | SRCREV_libnetwork = "b3507428be5b458cb0e2b4086b13531fb0706e46" |
40 | SRCREV_cli = "370c28948e3c12dce3d1df60b6f184990618553f" | 39 | SRCREV_cli = "370c28948e3c12dce3d1df60b6f184990618553f" |
@@ -54,99 +53,6 @@ require docker.inc | |||
54 | LICENSE = "Apache-2.0" | 53 | LICENSE = "Apache-2.0" |
55 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28" | 54 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28" |
56 | 55 | ||
57 | GO_IMPORT = "import" | ||
58 | |||
59 | S = "${WORKDIR}/git" | ||
60 | |||
61 | DOCKER_VERSION = "20.10.6" | 56 | DOCKER_VERSION = "20.10.6" |
62 | PV = "${DOCKER_VERSION}+git${SRCREV_moby}" | 57 | PV = "${DOCKER_VERSION}+git${SRCREV_moby}" |
63 | 58 | ||
64 | PACKAGES =+ "${PN}-contrib" | ||
65 | |||
66 | DOCKER_PKG="github.com/docker/docker" | ||
67 | # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 | ||
68 | BUILD_TAGS = "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" | ||
69 | |||
70 | inherit go | ||
71 | inherit goarch | ||
72 | |||
73 | do_configure[noexec] = "1" | ||
74 | |||
75 | do_compile() { | ||
76 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
77 | # docker to download its dependencies but rather | ||
78 | # use dependencies packaged independently. | ||
79 | cd ${S}/src/import | ||
80 | rm -rf .gopath | ||
81 | mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" | ||
82 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" | ||
83 | |||
84 | mkdir -p .gopath/src/github.com/docker | ||
85 | ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork | ||
86 | ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli | ||
87 | |||
88 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
89 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
90 | |||
91 | # Pass the needed cflags/ldflags so that cgo | ||
92 | # can find the needed headers files and libraries | ||
93 | export GOARCH=${TARGET_GOARCH} | ||
94 | export CGO_ENABLED="1" | ||
95 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
96 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
97 | export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}' | ||
98 | export GO111MODULE=off | ||
99 | |||
100 | export DISABLE_WARN_OUTSIDE_CONTAINER=1 | ||
101 | |||
102 | cd ${S}/src/import/ | ||
103 | |||
104 | # this is the unsupported built structure | ||
105 | # that doesn't rely on an existing docker | ||
106 | # to build this: | ||
107 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" ./hack/make.sh dynbinary | ||
108 | |||
109 | # build the cli | ||
110 | cd ${S}/src/import/.gopath/src/github.com/docker/cli | ||
111 | export CFLAGS="" | ||
112 | export LDFLAGS="" | ||
113 | export DOCKER_VERSION=${DOCKER_VERSION} | ||
114 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" make dynbinary | ||
115 | |||
116 | # build the proxy | ||
117 | cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork | ||
118 | oe_runmake cross-local | ||
119 | } | ||
120 | |||
121 | do_install() { | ||
122 | mkdir -p ${D}/${bindir} | ||
123 | cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker | ||
124 | cp ${S}/src/import/bundles/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd | ||
125 | cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy | ||
126 | |||
127 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
128 | install -d ${D}${systemd_unitdir}/system | ||
129 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | ||
130 | # replaces one copied from above with one that uses the local registry for a mirror | ||
131 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system | ||
132 | rm -f ${D}/${systemd_unitdir}/system/docker.service.rpm | ||
133 | else | ||
134 | install -d ${D}${sysconfdir}/init.d | ||
135 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | ||
136 | fi | ||
137 | # TLS key that docker creates at run-time if not found is what resides here | ||
138 | if ${@bb.utils.contains('PACKAGECONFIG','transient-config','true','false',d)}; then | ||
139 | install -d ${D}${sysconfdir} | ||
140 | ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker | ||
141 | else | ||
142 | install -d ${D}${sysconfdir}/docker | ||
143 | fi | ||
144 | |||
145 | mkdir -p ${D}${datadir}/docker/ | ||
146 | install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/ | ||
147 | } | ||
148 | |||
149 | FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker" | ||
150 | |||
151 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" | ||
152 | RDEPENDS_${PN}-contrib += "bash" | ||
diff --git a/recipes-containers/docker/docker.inc b/recipes-containers/docker/docker.inc index 65b7368d..a011366f 100644 --- a/recipes-containers/docker/docker.inc +++ b/recipes-containers/docker/docker.inc | |||
@@ -46,7 +46,96 @@ PACKAGECONFIG[seccomp] = "seccomp,,libseccomp" | |||
46 | PACKAGECONFIG[docker-init] = ",,,docker-init" | 46 | PACKAGECONFIG[docker-init] = ",,,docker-init" |
47 | PACKAGECONFIG[transient-config] = "transient-config" | 47 | PACKAGECONFIG[transient-config] = "transient-config" |
48 | 48 | ||
49 | |||
50 | GO_IMPORT = "import" | ||
51 | S = "${WORKDIR}/git" | ||
52 | |||
53 | |||
49 | inherit systemd update-rc.d | 54 | inherit systemd update-rc.d |
55 | inherit go | ||
56 | inherit goarch | ||
57 | inherit pkgconfig | ||
58 | |||
59 | do_configure[noexec] = "1" | ||
60 | |||
61 | DOCKER_PKG="github.com/docker/docker" | ||
62 | # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 | ||
63 | BUILD_TAGS ?= "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" | ||
64 | |||
65 | do_compile() { | ||
66 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
67 | # docker to download its dependencies but rather | ||
68 | # use dependencies packaged independently. | ||
69 | cd ${S}/src/import | ||
70 | rm -rf .gopath | ||
71 | mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" | ||
72 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" | ||
73 | |||
74 | mkdir -p .gopath/src/github.com/docker | ||
75 | ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork | ||
76 | ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli | ||
77 | |||
78 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
79 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
80 | |||
81 | # Pass the needed cflags/ldflags so that cgo | ||
82 | # can find the needed headers files and libraries | ||
83 | export GOARCH=${TARGET_GOARCH} | ||
84 | export CGO_ENABLED="1" | ||
85 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
86 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
87 | export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}' | ||
88 | export GO111MODULE=off | ||
89 | |||
90 | export DISABLE_WARN_OUTSIDE_CONTAINER=1 | ||
91 | |||
92 | cd ${S}/src/import/ | ||
93 | |||
94 | # this is the unsupported built structure | ||
95 | # that doesn't rely on an existing docker | ||
96 | # to build this: | ||
97 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" ./hack/make.sh dynbinary | ||
98 | |||
99 | # build the cli | ||
100 | cd ${S}/src/import/.gopath/src/github.com/docker/cli | ||
101 | export CFLAGS="" | ||
102 | export LDFLAGS="" | ||
103 | export DOCKER_VERSION=${DOCKER_VERSION} | ||
104 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" make dynbinary | ||
105 | |||
106 | # build the proxy | ||
107 | cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork | ||
108 | oe_runmake cross-local | ||
109 | } | ||
110 | |||
111 | do_install() { | ||
112 | mkdir -p ${D}/${bindir} | ||
113 | cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker | ||
114 | cp ${S}/src/import/bundles/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd | ||
115 | cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy | ||
116 | |||
117 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
118 | install -d ${D}${systemd_unitdir}/system | ||
119 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | ||
120 | # replaces one copied from above with one that uses the local registry for a mirror | ||
121 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system | ||
122 | rm -f ${D}/${systemd_unitdir}/system/docker.service.rpm | ||
123 | else | ||
124 | install -d ${D}${sysconfdir}/init.d | ||
125 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | ||
126 | fi | ||
127 | # TLS key that docker creates at run-time if not found is what resides here | ||
128 | if ${@bb.utils.contains('PACKAGECONFIG','transient-config','true','false',d)}; then | ||
129 | install -d ${D}${sysconfdir} | ||
130 | ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker | ||
131 | else | ||
132 | install -d ${D}${sysconfdir}/docker | ||
133 | fi | ||
134 | |||
135 | mkdir -p ${D}${datadir}/docker/ | ||
136 | install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/ | ||
137 | } | ||
138 | |||
50 | 139 | ||
51 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | 140 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" |
52 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}" | 141 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}" |
@@ -63,3 +152,9 @@ GROUPADD_PARAM_${PN} = "-r docker" | |||
63 | COMPATIBLE_HOST = "^(?!(qemu)?mips).*" | 152 | COMPATIBLE_HOST = "^(?!(qemu)?mips).*" |
64 | 153 | ||
65 | INSANE_SKIP_${PN} += "ldflags textrel" | 154 | INSANE_SKIP_${PN} += "ldflags textrel" |
155 | |||
156 | FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker" | ||
157 | |||
158 | PACKAGES =+ "${PN}-contrib" | ||
159 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" | ||
160 | RDEPENDS_${PN}-contrib += "bash" | ||
diff --git a/recipes-containers/docker/docker-ce/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch b/recipes-containers/docker/files/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch index dc322612..dc322612 100644 --- a/recipes-containers/docker/docker-ce/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch +++ b/recipes-containers/docker/files/0001-cli-use-external-GO111MODULE-and-cross-compiler.patch | |||
diff --git a/recipes-containers/docker/docker-ce/0001-dynbinary-use-go-cross-compiler.patch b/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch index 971c60d7..971c60d7 100644 --- a/recipes-containers/docker/docker-ce/0001-dynbinary-use-go-cross-compiler.patch +++ b/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch | |||
diff --git a/recipes-containers/docker/docker-ce/0001-libnetwork-use-GO-instead-of-go.patch b/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch index c623b260..c623b260 100644 --- a/recipes-containers/docker/docker-ce/0001-libnetwork-use-GO-instead-of-go.patch +++ b/recipes-containers/docker/files/0001-libnetwork-use-GO-instead-of-go.patch | |||