From 7d6284a079748f919e3e0b8116649cfa5ff8ee8f Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 20 Feb 2017 02:00:20 -0500 Subject: runc/containerd: create virtual/runc and virtual/containerd Since there are two implementations of runc and containerd that may not always be in sync, the docker variant, and the opencontainers variable, we create a virtual/* namespace for these components. Anything requiring runc or containerd should set a preferred provider to get the desired/tested variant. We set the default provider to the docker variants, since they are the primary use case for these components. Signed-off-by: Bruce Ashfield --- conf/layer.conf | 3 + .../containerd/containerd-docker_git.bb | 10 +++ .../containerd/containerd-opencontainers_git.bb | 9 +++ recipes-containers/containerd/containerd.inc | 86 ++++++++++++++++++++ recipes-containers/containerd/containerd_git.bb | 92 ---------------------- recipes-containers/docker/docker_git.bb | 3 +- recipes-containers/runc/runc-docker_git.bb | 11 +++ recipes-containers/runc/runc-opencontainers_git.bb | 8 ++ recipes-containers/runc/runc.inc | 59 ++++++++++++++ recipes-containers/runc/runc_git.bb | 67 ---------------- 10 files changed, 188 insertions(+), 160 deletions(-) create mode 100644 recipes-containers/containerd/containerd-docker_git.bb create mode 100644 recipes-containers/containerd/containerd-opencontainers_git.bb create mode 100644 recipes-containers/containerd/containerd.inc delete mode 100644 recipes-containers/containerd/containerd_git.bb create mode 100644 recipes-containers/runc/runc-docker_git.bb create mode 100644 recipes-containers/runc/runc-opencontainers_git.bb create mode 100644 recipes-containers/runc/runc.inc delete mode 100644 recipes-containers/runc/runc_git.bb diff --git a/conf/layer.conf b/conf/layer.conf index f5c1b1ec..be08a985 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -19,3 +19,6 @@ LAYERDEPENDS_virtualization-layer = "core networking-layer" # Override security flags require conf/distro/include/virt_security_flags.inc + +PREFERRED_PROVIDER_virtual/runc ?= "runc-docker" +PREFERRED_PROVIDER_virtual/containerd ?= "containerd-docker" diff --git a/recipes-containers/containerd/containerd-docker_git.bb b/recipes-containers/containerd/containerd-docker_git.bb new file mode 100644 index 00000000..f6dcaeca --- /dev/null +++ b/recipes-containers/containerd/containerd-docker_git.bb @@ -0,0 +1,10 @@ +include containerd.inc + +SRCREV = "03e5862ec0d8d3b3f750e19fca3ee367e13c090e" +SRC_URI = "\ + git://github.com/docker/containerd.git;branch=docker-1.13.x \ + " +CONTAINERD_VERSION = "0.2.3" + +PROVIDES += "virtual/containerd" +RPROVIDES_${PN} = "virtual/containerd" diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb new file mode 100644 index 00000000..37f85472 --- /dev/null +++ b/recipes-containers/containerd/containerd-opencontainers_git.bb @@ -0,0 +1,9 @@ +include containerd.inc + +SRCREV = "0ac3cd1be170d180b2baed755e8f0da547ceb267" +SRC_URI = "git://github.com/docker/containerd.git;nobranch=1 \ + " +CONTAINERD_VERSION = "0.2.2" + +PROVIDES += "virtual/containerd" +RPROVIDES_${PN} = "virtual/containerd" diff --git a/recipes-containers/containerd/containerd.inc b/recipes-containers/containerd/containerd.inc new file mode 100644 index 00000000..a128fbde --- /dev/null +++ b/recipes-containers/containerd/containerd.inc @@ -0,0 +1,86 @@ +HOMEPAGE = "https://github.com/docker/containerd" +SUMMARY = "containerd is a daemon to control runC" +DESCRIPTION = "containerd is a daemon to control runC, built for performance and density. \ + containerd leverages runC's advanced features such as seccomp and user namespace \ + support as well as checkpoint and restore for cloning and live migration of containers." + +# Apache-2.0 for containerd +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" + +S = "${WORKDIR}/git" + +PV = "${CONTAINERD_VERSION}+git${SRCREV}" + +DEPENDS = "go-cross-${TARGET_ARCH} \ + " + +RRECOMMENDS_${PN} = "lxc docker" +CONTAINERD_PKG="github.com/docker/containerd" + +do_configure[noexec] = "1" + +do_compile() { + export GOARCH="${TARGET_ARCH}" + # supported amd64, 386, arm arm64 + if [ "${TARGET_ARCH}" = "x86_64" ]; then + export GOARCH="amd64" + fi + if [ "${TARGET_ARCH}" = "aarch64" ]; then + export GOARCH="arm64" + fi + if [ "${TARGET_ARCH}" = "i586" ]; then + export GOARCH="386" + fi + + # Set GOPATH. See 'PACKAGERS.md'. Don't rely on + # docker to download its dependencies but rather + # use dependencies packaged independently. + cd ${S} + rm -rf .gopath + mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")" + ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}" + export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" + export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" + cd - + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CFLAGS="" + export LDFLAGS="" + export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" + export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" + + oe_runmake static +} + +# Note: disabled for now, since docker is launching containerd +# inherit systemd +# SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" +# SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}" + +do_install() { + mkdir -p ${D}/${bindir} + + cp ${S}/bin/containerd ${D}/${bindir}/containerd + cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim + cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr + + ln -sf containerd ${D}/${bindir}/docker-containerd + ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim + ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr + + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${S}/hack/containerd.service ${D}/${systemd_unitdir}/system + # adjust from /usr/local/bin to /usr/bin/ + sed -e "s:/usr/local/bin/containerd:${bindir}/docker-containerd -l \"unix\:///var/run/docker/libcontainerd/docker-containerd.sock\":g" -i ${D}/${systemd_unitdir}/system/containerd.service + fi +} + +FILES_${PN} += "${systemd_system_unitdir}/*" + +INHIBIT_PACKAGE_STRIP = "1" diff --git a/recipes-containers/containerd/containerd_git.bb b/recipes-containers/containerd/containerd_git.bb deleted file mode 100644 index 67011a35..00000000 --- a/recipes-containers/containerd/containerd_git.bb +++ /dev/null @@ -1,92 +0,0 @@ -HOMEPAGE = "https://github.com/docker/containerd" -SUMMARY = "containerd is a daemon to control runC" -DESCRIPTION = "containerd is a daemon to control runC, built for performance and density. \ - containerd leverages runC's advanced features such as seccomp and user namespace \ - support as well as checkpoint and restore for cloning and live migration of containers." - -SRCREV = "03e5862ec0d8d3b3f750e19fca3ee367e13c090e" -SRC_URI = "\ - git://github.com/docker/containerd.git;branch=docker-1.13.x \ - " - -# Apache-2.0 for containerd -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" - -S = "${WORKDIR}/git" - -CONTAINERD_VERSION = "0.2.3" -PV = "${CONTAINERD_VERSION}+git${SRCREV}" - -DEPENDS = "go-cross-${TARGET_ARCH} \ - " - -RRECOMMENDS_${PN} = "lxc docker" -CONTAINERD_PKG="github.com/docker/containerd" - -do_configure[noexec] = "1" - -do_compile() { - export GOARCH="${TARGET_ARCH}" - # supported amd64, 386, arm arm64 - if [ "${TARGET_ARCH}" = "x86_64" ]; then - export GOARCH="amd64" - fi - if [ "${TARGET_ARCH}" = "aarch64" ]; then - export GOARCH="arm64" - fi - if [ "${TARGET_ARCH}" = "i586" ]; then - export GOARCH="386" - fi - - # Set GOPATH. See 'PACKAGERS.md'. Don't rely on - # docker to download its dependencies but rather - # use dependencies packaged independently. - cd ${S} - rm -rf .gopath - mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")" - ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}" - export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" - export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" - cd - - - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CFLAGS="" - export LDFLAGS="" - export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" - export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" - - oe_runmake static -} - -# Note: disabled for now, since docker is launching containerd -# inherit systemd -# SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" -# SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}" - -do_install() { - mkdir -p ${D}/${bindir} - - cp ${S}/bin/containerd ${D}/${bindir}/containerd - cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim - cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr - - ln -sf containerd ${D}/${bindir}/docker-containerd - ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim - ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr - - if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then - install -d ${D}${systemd_unitdir}/system - install -m 644 ${S}/hack/containerd.service ${D}/${systemd_unitdir}/system - # adjust from /usr/local/bin to /usr/bin/ - sed -e "s:/usr/local/bin/containerd:${bindir}/docker-containerd -l \"unix\:///var/run/docker/libcontainerd/docker-containerd.sock\":g" -i ${D}/${systemd_unitdir}/system/containerd.service - fi -} - -FILES_${PN} += "${systemd_system_unitdir}/*" - -INHIBIT_PACKAGE_STRIP = "1" diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb index 46ad26e9..c8ab45a0 100644 --- a/recipes-containers/docker/docker_git.bb +++ b/recipes-containers/docker/docker_git.bb @@ -63,7 +63,8 @@ DEPENDS_append_class-target = "lvm2" RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \ ${@bb.utils.contains('DISTRO_FEATURES','systemd','','cgroup-lite',d)} \ " -RDEPENDS_${PN} += "containerd runc" +RDEPENDS_${PN} += "virtual/containerd virtual/runc" + RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat" RSUGGESTS_${PN} = "lxc docker-registry rt-tests" DOCKER_PKG="github.com/docker/docker" diff --git a/recipes-containers/runc/runc-docker_git.bb b/recipes-containers/runc/runc-docker_git.bb new file mode 100644 index 00000000..96d48cae --- /dev/null +++ b/recipes-containers/runc/runc-docker_git.bb @@ -0,0 +1,11 @@ +include runc.inc + +# Note: this rev is before the required protocol field, update when all components +# have been updated to match. +SRCREV = "2f7393a47307a16f8cee44a37b262e8b81021e3e" +SRC_URI = "git://github.com/docker/runc.git;nobranch=1 \ + " + +RUNC_VERSION = "1.0.0-rc2" +PROVIDES += "virtual/runc" +RPROVIDES_${PN} = "virtual/runc" diff --git a/recipes-containers/runc/runc-opencontainers_git.bb b/recipes-containers/runc/runc-opencontainers_git.bb new file mode 100644 index 00000000..a302d4b5 --- /dev/null +++ b/recipes-containers/runc/runc-opencontainers_git.bb @@ -0,0 +1,8 @@ +include runc.inc + +SRCREV = "1cdaa709f151b61cee2bdaa09d8e5d2b58a8ba72" +SRC_URI = "git://github.com/opencontainers/runc;branch=master \ + " +RUNC_VERSION = "1.0.0-rc1" +PROVIDES += "virtual/runc" +RPROVIDES_${PN} = "virtual/runc" diff --git a/recipes-containers/runc/runc.inc b/recipes-containers/runc/runc.inc new file mode 100644 index 00000000..7626dad7 --- /dev/null +++ b/recipes-containers/runc/runc.inc @@ -0,0 +1,59 @@ +HOMEPAGE = "https://github.com/opencontainers/runc" +SUMMARY = "runc container cli tools" +DESCRIPTION = "runc is a CLI tool for spawning and running containers according to the OCI specification." + +# Apache-2.0 for containerd +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=435b266b3899aa8a959f17d41c56def8" + +S = "${WORKDIR}/git" + +PV = "${RUNC_VERSION}+git${SRCREV}" + +DEPENDS = "go-cross-${TARGET_ARCH} \ + " +RRECOMMENDS_${PN} = "lxc docker" + +LIBCONTAINER_PACKAGE="github.com/opencontainers/runc/libcontainer" + +do_configure[noexec] = "1" +EXTRA_OEMAKE="BUILDTAGS=''" + +inherit go-osarchmap + +do_compile() { + export GOARCH="${TARGET_GOARCH}" + + # Set GOPATH. See 'PACKAGERS.md'. Don't rely on + # docker to download its dependencies but rather + # use dependencies packaged independently. + cd ${S} + rm -rf .gopath + dname=`dirname "${LIBCONTAINER_PACKAGE}"` + bname=`basename "${LIBCONTAINER_PACKAGE}"` + mkdir -p .gopath/src/${dname} + + (cd .gopath/src/${dname}; ln -sf ../../../../../${bname} ${bname}) + export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" + export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" + cd - + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CFLAGS="" + export LDFLAGS="" + + oe_runmake static +} + +do_install() { + mkdir -p ${D}/${bindir} + + cp ${S}/runc ${D}/${bindir}/runc + ln -sf runc ${D}/${bindir}/docker-runc +} + +INHIBIT_PACKAGE_STRIP = "1" diff --git a/recipes-containers/runc/runc_git.bb b/recipes-containers/runc/runc_git.bb deleted file mode 100644 index c5cf40be..00000000 --- a/recipes-containers/runc/runc_git.bb +++ /dev/null @@ -1,67 +0,0 @@ -HOMEPAGE = "https://github.com/opencontainers/runc" -SUMMARY = "runc container cli tools" -DESCRIPTION = "runc is a CLI tool for spawning and running containers according to the OCI specification." - -# Note: this rev is before the required protocol field, update when all components -# have been updated to match. -SRCREV = "2f7393a47307a16f8cee44a37b262e8b81021e3e" -SRC_URI = "\ - git://github.com/docker/runc.git;nobranch=1 \ - " - -# Apache-2.0 for containerd -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=435b266b3899aa8a959f17d41c56def8" - -S = "${WORKDIR}/git" - -RUNC_VERSION = "1.0.0-rc2" -PV = "${RUNC_VERSION}+git${SRCREV}" - -DEPENDS = "go-cross-${TARGET_ARCH} \ - " -RRECOMMENDS_${PN} = "lxc docker" - -LIBCONTAINER_PACKAGE="github.com/opencontainers/runc/libcontainer" - -do_configure[noexec] = "1" -EXTRA_OEMAKE="BUILDTAGS=''" - -inherit go-osarchmap - -do_compile() { - export GOARCH="${TARGET_GOARCH}" - - # Set GOPATH. See 'PACKAGERS.md'. Don't rely on - # docker to download its dependencies but rather - # use dependencies packaged independently. - cd ${S} - rm -rf .gopath - dname=`dirname "${LIBCONTAINER_PACKAGE}"` - bname=`basename "${LIBCONTAINER_PACKAGE}"` - mkdir -p .gopath/src/${dname} - - (cd .gopath/src/${dname}; ln -sf ../../../../../${bname} ${bname}) - export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" - export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" - cd - - - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CFLAGS="" - export LDFLAGS="" - - oe_runmake static -} - -do_install() { - mkdir -p ${D}/${bindir} - - cp ${S}/runc ${D}/${bindir}/runc - ln -sf runc ${D}/${bindir}/docker-runc -} - -INHIBIT_PACKAGE_STRIP = "1" -- cgit v1.2.3-54-g00ecf