summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2018-04-02 00:43:50 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-04-02 00:46:44 -0400
commit935e3d969ef1c0ce2f2a2719c31285be6114c8f9 (patch)
treec612b1127551795b4ccc7bb9ee5dd7c20af0b52b
parentf5fbfa8ac4db1bab693e8f162dcab992787f244d (diff)
downloadmeta-virtualization-935e3d969ef1c0ce2f2a2719c31285be6114c8f9.tar.gz
containerd: uprev to v1.0.2
Uprev containerd to v1.0.2 for compatibility with recent docker (18.04+) builds. With this uprev we also significantly restructure the build to use more of the latest oe-core go build infrastructure, but non-standard parts of the build remain. We also allow containerd to be build with CGO enabled to avoid linkage errors with the oe provided go build infrastructure. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--recipes-containers/containerd/containerd-opencontainers_git.bb10
-rw-r--r--recipes-containers/containerd/containerd.inc64
-rw-r--r--recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch26
3 files changed, 68 insertions, 32 deletions
diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb
index 37f85472..316eea74 100644
--- a/recipes-containers/containerd/containerd-opencontainers_git.bb
+++ b/recipes-containers/containerd/containerd-opencontainers_git.bb
@@ -1,9 +1,11 @@
1SRCREV = "cfd04396dc68220d1cecbe686a6cc3aa5ce3667c"
2SRC_URI = "git://github.com/containerd/containerd;nobranch=1 \
3 file://0001-containerd-shim-build-with-CGO.patch \
4 "
5
1include containerd.inc 6include containerd.inc
2 7
3SRCREV = "0ac3cd1be170d180b2baed755e8f0da547ceb267" 8CONTAINERD_VERSION = "v1.0.2"
4SRC_URI = "git://github.com/docker/containerd.git;nobranch=1 \
5 "
6CONTAINERD_VERSION = "0.2.2"
7 9
8PROVIDES += "virtual/containerd" 10PROVIDES += "virtual/containerd"
9RPROVIDES_${PN} = "virtual/containerd" 11RPROVIDES_${PN} = "virtual/containerd"
diff --git a/recipes-containers/containerd/containerd.inc b/recipes-containers/containerd/containerd.inc
index e7a37192..9f66e46e 100644
--- a/recipes-containers/containerd/containerd.inc
+++ b/recipes-containers/containerd/containerd.inc
@@ -6,7 +6,7 @@ DESCRIPTION = "containerd is a daemon to control runC, built for performance and
6 6
7# Apache-2.0 for containerd 7# Apache-2.0 for containerd
8LICENSE = "Apache-2.0" 8LICENSE = "Apache-2.0"
9LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" 9LIC_FILES_CHKSUM = "file://src/import/LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7"
10 10
11SRC_URI += "file://containerd.service" 11SRC_URI += "file://containerd.service"
12 12
@@ -17,6 +17,8 @@ PV = "${CONTAINERD_VERSION}+git${SRCREV}"
17inherit go 17inherit go
18inherit goarch 18inherit goarch
19 19
20GO_IMPORT = "import"
21
20RRECOMMENDS_${PN} = "lxc docker" 22RRECOMMENDS_${PN} = "lxc docker"
21CONTAINERD_PKG="github.com/containerd/containerd" 23CONTAINERD_PKG="github.com/containerd/containerd"
22 24
@@ -25,30 +27,35 @@ INSANE_SKIP_${PN} += "ldflags"
25do_configure[noexec] = "1" 27do_configure[noexec] = "1"
26 28
27do_compile() { 29do_compile() {
28 # Set GOPATH. See 'PACKAGERS.md'. Don't rely on 30 export GOARCH="${TARGET_GOARCH}"
29 # docker to download its dependencies but rather 31
30 # use dependencies packaged independently. 32 # link fixups for compilation
31 cd ${S} 33 rm -f ${S}/src/import/vendor/src
32 rm -rf .gopath 34 ln -sf ./ ${S}/src/import/vendor/src
33 mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")" 35
34 ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}" 36 mkdir -p ${S}/src/import/vendor/src/github.com/containerd/containerd/
35 37 # without this, the stress test parts of the build fail
36 export GOPATH="${WORKDIR}/git/" 38 cp ${S}/src/import/*.go ${S}/src/import/vendor/src/github.com/containerd/containerd
37 export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" 39
38 40 for c in content errdefs fs images mount snapshots linux api runtimes defaults progress \
39 # Pass the needed cflags/ldflags so that cgo 41 protobuf reference diff platforms runtime remotes version archive dialer gc metadata \
40 # can find the needed headers files and libraries 42 metrics filters identifiers labels leases plugin server services \
41 export GOARCH="${TARGET_GOARCH}" 43 cmd cio containers namespaces oci events log reaper sys rootfs; do
42 export CGO_ENABLED="1" 44 ln -sfn ${S}/src/import/${c} ${S}/src/import/vendor/github.com/containerd/containerd/${c}
43 export CFLAGS="" 45 done
44 export LDFLAGS="" 46
45 export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" 47 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
46 export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" 48 export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
47 export GO_GCFLAGS="" 49
48 export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" 50 # Pass the needed cflags/ldflags so that cgo
49 export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" 51 # can find the needed headers files and libraries
50 52 export CGO_ENABLED="1"
51 oe_runmake static 53 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
54 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
55 export BUILDTAGS="no_btrfs static_build netgo"
56
57 cd ${S}/src/import
58 oe_runmake binaries
52} 59}
53 60
54# Note: disabled for now, since docker is launching containerd 61# Note: disabled for now, since docker is launching containerd
@@ -59,9 +66,9 @@ do_compile() {
59do_install() { 66do_install() {
60 mkdir -p ${D}/${bindir} 67 mkdir -p ${D}/${bindir}
61 68
62 cp ${S}/bin/containerd ${D}/${bindir}/containerd 69 cp ${S}/src/import/bin/containerd ${D}/${bindir}/containerd
63 cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim 70 cp ${S}/src/import/bin/containerd-shim ${D}/${bindir}/containerd-shim
64 cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr 71 cp ${S}/src/import/bin/ctr ${D}/${bindir}/containerd-ctr
65 72
66 ln -sf containerd ${D}/${bindir}/docker-containerd 73 ln -sf containerd ${D}/${bindir}/docker-containerd
67 ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim 74 ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim
@@ -78,3 +85,4 @@ do_install() {
78FILES_${PN} += "${systemd_system_unitdir}/*" 85FILES_${PN} += "${systemd_system_unitdir}/*"
79 86
80INHIBIT_PACKAGE_STRIP = "1" 87INHIBIT_PACKAGE_STRIP = "1"
88INSANE_SKIP_${PN} += "ldflags already-stripped"
diff --git a/recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch b/recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch
new file mode 100644
index 00000000..3b890834
--- /dev/null
+++ b/recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch
@@ -0,0 +1,26 @@
1From a1d2db9037b1302c4ce4cfc170a4fa443f68e594 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@windriver.com>
3Date: Thu, 29 Mar 2018 15:48:41 -0400
4Subject: [PATCH] containerd-shim: build with CGO
5
6Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
7---
8 Makefile | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/src/import/Makefile b/src/import/Makefile
12index 9d8cf8a18fbc..1dff4e3c2043 100644
13--- a/src/import/Makefile
14+++ b/src/import/Makefile
15@@ -134,7 +134,7 @@ bin/%: cmd/% FORCE
16
17 bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
18 @echo "$(WHALE) bin/containerd-shim"
19- @CGO_ENABLED=0 go build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
20+ @go build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
21
22 binaries: $(BINARIES) ## build binaries
23 @echo "$(WHALE) $@"
24--
252.4.0.53.g8440f74
26