From 164408a170b074017c7bad1a90316a5de0c2dd88 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 24 Sep 2019 02:09:54 -0400 Subject: docker: rename docker -> docker-moby and introduce virtual/docker The recipe which was providing the default "docker" package was aligned with the moby repositories. In order to make that alignment clear, we rename that recipe docker-moby. To allow easier switching between the docker providing recipes, we introduce a virtual/docker PROVIDES to the common .inc file (and hence each recipe). This allows users to chose what they want via the standard PREFERRED_PROVIDER mechanism. Also to allow existing package lists and image installs to continue to work without changes, we make sure that the implementation specific docker- packages RPROVIDE docker. If any packages are missed, we'll add them to this list in future updates. Signed-off-by: Bruce Ashfield --- recipes-containers/docker/docker-moby.bb | 145 +++++++++++++++++++++++++++++++ recipes-containers/docker/docker.inc | 9 ++ recipes-containers/docker/docker_git.bb | 145 ------------------------------- 3 files changed, 154 insertions(+), 145 deletions(-) create mode 100644 recipes-containers/docker/docker-moby.bb delete mode 100644 recipes-containers/docker/docker_git.bb diff --git a/recipes-containers/docker/docker-moby.bb b/recipes-containers/docker/docker-moby.bb new file mode 100644 index 00000000..e45f87e0 --- /dev/null +++ b/recipes-containers/docker/docker-moby.bb @@ -0,0 +1,145 @@ +HOMEPAGE = "http://www.docker.com" +SUMMARY = "Linux container runtime" +DESCRIPTION = "Linux container runtime \ + Docker complements kernel namespacing with a high-level API which \ + operates at the process level. It runs unix processes with strong \ + guarantees of isolation and repeatability across servers. \ + . \ + Docker is a great building block for automating distributed systems: \ + large-scale web deployments, database clusters, continuous deployment \ + systems, private PaaS, service-oriented architectures, etc. \ + . \ + This package contains the daemon and client, which are \ + officially supported on x86_64 and arm hosts. \ + Other architectures are considered experimental. \ + . \ + Also, note that kernel version 3.10 or above is required for proper \ + operation of the daemon process, and that any lower versions may have \ + subtle and/or glaring issues. \ + " + +# Notes: +# - This docker variant uses moby and the other individually maintained +# upstream variants for SRCREVs +# - It is a true community / upstream tracking build, and is not a +# docker curated set of commits or additions +# - The version number on this package tracks the versions assigned to +# the curated docker-ce repository. This allows compatibility and +# functional equivalence, while allowing new features to be more +# easily added. +# - This could be called "docker-moby" or just "moby" in the future, but +# that would require the creation of a virtual/docker dependency, which +# is possible, but overkill at the moment (while we wait for the upstream +# to stop changing). +# - The common components of this recipe and docker-ce do need to be moved +# to a docker.inc recipe + +# moby commit matches the docker-ce swarmkit bump on the 18.09 branch +SRCREV_moby = "344b093258fcb2195fa393081e5224a6c766c798" +SRCREV_libnetwork = "5ac07abef4eee176423fdc1b870d435258e2d381" +SRCREV_cli = "2f1931f9eb2d6bac2efd48d94739f2e9919d4d7d" +SRC_URI = "\ + git://github.com/moby/moby.git;nobranch=1;name=moby \ + git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \ + git://github.com/docker/cli;branch=19.03;name=cli;destsuffix=git/cli \ + file://docker.init \ + file://0001-libnetwork-use-GO-instead-of-go.patch \ + file://0001-imporve-hardcoded-CC-on-cross-compile.patch \ + " + +require docker.inc + +# Apache-2.0 for docker +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28" + +GO_IMPORT = "import" + +S = "${WORKDIR}/git" + +DOCKER_VERSION = "19.03.0-rc3" +PV = "${DOCKER_VERSION}+git${SRCREV_moby}" + +PACKAGES =+ "${PN}-contrib" + +DOCKER_PKG="github.com/docker/docker" +# in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 +BUILD_TAGS = "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" + +inherit go +inherit goarch + +do_configure[noexec] = "1" + +do_compile() { + # Set GOPATH. See 'PACKAGERS.md'. Don't rely on + # docker to download its dependencies but rather + # use dependencies packaged independently. + cd ${S}/src/import + rm -rf .gopath + mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" + ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" + + mkdir -p .gopath/src/github.com/docker + ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork + ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli + + export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" + export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" + + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export GOARCH=${TARGET_GOARCH} + export CGO_ENABLED="1" + export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}' + + export DISABLE_WARN_OUTSIDE_CONTAINER=1 + + cd ${S}/src/import/ + + # this is the unsupported built structure + # that doesn't rely on an existing docker + # to build this: + VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary + + # build the cli + cd ${S}/src/import/.gopath/src/github.com/docker/cli + export CFLAGS="" + export LDFLAGS="" + export DOCKER_VERSION=${DOCKER_VERSION} + VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary + + # build the proxy + cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork + oe_runmake cross-local +} + +do_install() { + mkdir -p ${D}/${bindir} + cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker + cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd + cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy + + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install -d ${D}${systemd_unitdir}/system + install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system + # replaces one copied from above with one that uses the local registry for a mirror + install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system + else + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init + fi + # TLS key that docker creates at run-time if not found is what resides here + install -d ${D}${sysconfdir} + ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker + + mkdir -p ${D}${datadir}/docker/ + install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/ +} + +FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker" + +FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" +RDEPENDS_${PN}-contrib += "bash" diff --git a/recipes-containers/docker/docker.inc b/recipes-containers/docker/docker.inc index 149ca824..8b1b123c 100644 --- a/recipes-containers/docker/docker.inc +++ b/recipes-containers/docker/docker.inc @@ -31,6 +31,15 @@ RDEPENDS_${PN} += "virtual/containerd virtual/runc" RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat" +PROVIDES += "virtual/docker" + +# we want all the docker variant recpes to be installable via "docker" +PACKAGE_NAME = "docker" +RPROVIDES_${PN} += "docker" +RPROVIDES_${PN}-dbg += "docker-dbg" +RPROVIDES_${PN}-dev += "docker-dev" +RPROVIDES_${PN}-contrip += "docker-dev" + inherit pkgconfig PACKAGECONFIG ??= "docker-init" PACKAGECONFIG[seccomp] = "seccomp,,libseccomp" diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb deleted file mode 100644 index e45f87e0..00000000 --- a/recipes-containers/docker/docker_git.bb +++ /dev/null @@ -1,145 +0,0 @@ -HOMEPAGE = "http://www.docker.com" -SUMMARY = "Linux container runtime" -DESCRIPTION = "Linux container runtime \ - Docker complements kernel namespacing with a high-level API which \ - operates at the process level. It runs unix processes with strong \ - guarantees of isolation and repeatability across servers. \ - . \ - Docker is a great building block for automating distributed systems: \ - large-scale web deployments, database clusters, continuous deployment \ - systems, private PaaS, service-oriented architectures, etc. \ - . \ - This package contains the daemon and client, which are \ - officially supported on x86_64 and arm hosts. \ - Other architectures are considered experimental. \ - . \ - Also, note that kernel version 3.10 or above is required for proper \ - operation of the daemon process, and that any lower versions may have \ - subtle and/or glaring issues. \ - " - -# Notes: -# - This docker variant uses moby and the other individually maintained -# upstream variants for SRCREVs -# - It is a true community / upstream tracking build, and is not a -# docker curated set of commits or additions -# - The version number on this package tracks the versions assigned to -# the curated docker-ce repository. This allows compatibility and -# functional equivalence, while allowing new features to be more -# easily added. -# - This could be called "docker-moby" or just "moby" in the future, but -# that would require the creation of a virtual/docker dependency, which -# is possible, but overkill at the moment (while we wait for the upstream -# to stop changing). -# - The common components of this recipe and docker-ce do need to be moved -# to a docker.inc recipe - -# moby commit matches the docker-ce swarmkit bump on the 18.09 branch -SRCREV_moby = "344b093258fcb2195fa393081e5224a6c766c798" -SRCREV_libnetwork = "5ac07abef4eee176423fdc1b870d435258e2d381" -SRCREV_cli = "2f1931f9eb2d6bac2efd48d94739f2e9919d4d7d" -SRC_URI = "\ - git://github.com/moby/moby.git;nobranch=1;name=moby \ - git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \ - git://github.com/docker/cli;branch=19.03;name=cli;destsuffix=git/cli \ - file://docker.init \ - file://0001-libnetwork-use-GO-instead-of-go.patch \ - file://0001-imporve-hardcoded-CC-on-cross-compile.patch \ - " - -require docker.inc - -# Apache-2.0 for docker -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=4859e97a9c7780e77972d989f0823f28" - -GO_IMPORT = "import" - -S = "${WORKDIR}/git" - -DOCKER_VERSION = "19.03.0-rc3" -PV = "${DOCKER_VERSION}+git${SRCREV_moby}" - -PACKAGES =+ "${PN}-contrib" - -DOCKER_PKG="github.com/docker/docker" -# in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 -BUILD_TAGS = "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" - -inherit go -inherit goarch - -do_configure[noexec] = "1" - -do_compile() { - # Set GOPATH. See 'PACKAGERS.md'. Don't rely on - # docker to download its dependencies but rather - # use dependencies packaged independently. - cd ${S}/src/import - rm -rf .gopath - mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" - ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" - - mkdir -p .gopath/src/github.com/docker - ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork - ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli - - export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" - export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" - - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export GOARCH=${TARGET_GOARCH} - export CGO_ENABLED="1" - export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}' - - export DISABLE_WARN_OUTSIDE_CONTAINER=1 - - cd ${S}/src/import/ - - # this is the unsupported built structure - # that doesn't rely on an existing docker - # to build this: - VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary - - # build the cli - cd ${S}/src/import/.gopath/src/github.com/docker/cli - export CFLAGS="" - export LDFLAGS="" - export DOCKER_VERSION=${DOCKER_VERSION} - VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary - - # build the proxy - cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork - oe_runmake cross-local -} - -do_install() { - mkdir -p ${D}/${bindir} - cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker - cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd - cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy - - if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then - install -d ${D}${systemd_unitdir}/system - install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system - # replaces one copied from above with one that uses the local registry for a mirror - install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system - else - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init - fi - # TLS key that docker creates at run-time if not found is what resides here - install -d ${D}${sysconfdir} - ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker - - mkdir -p ${D}${datadir}/docker/ - install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/ -} - -FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker" - -FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" -RDEPENDS_${PN}-contrib += "bash" -- cgit v1.2.3-54-g00ecf