app-emulation/containerd: Add an ebuild for Docker 17.11

The Makefile insanely requires to be run inside a Git repository,
therefore this attempts to bypass that by providing the equivalent
values as arguments.

The command arguments were removed in favor of a config file.  This
packages the file in /usr and points the service at it directly by
giving the path in an environment variable (for easier drop-in
replacement).  Due to it being impossible to set an environment
variable containing another variable's value, torcx path variables
are hard-coded as a prefix, but they'll be empty in non-torcx
installations of this ebuild.
This commit is contained in:
David Michael 2017-11-22 14:27:43 -05:00
parent 830ea4122a
commit 23b45ac7dd
6 changed files with 112 additions and 6 deletions

View File

@ -1,3 +1,4 @@
DIST containerd-0.2.5.tar.gz 1003500 SHA256 88e099af66b50abe7f2159f13bdab793fa5199d8d5b9a9ef7a68171abb4359be SHA512 ba1e074bb7556a7c4be4d68dc62aa2fa4b823682c209d1609c1f11518a7b7167139ea159d31e0b21ba190d83115a67e5e45b54b6a4770742d49e9e561309551f WHIRLPOOL eb3622ba99c4d4806bda9a45853422a5b0b884869ed3be4c3caec4c20f49027e8db78b9885eca7bc83a0f3b08e9a66eca950390f0eda1ef2535fd3ab41623bf4
DIST containerd-0.2.6.tar.gz 1020572 SHA256 a67c4153ac5ae26b9d11daac133b90cba059ba16de7579e39c3e82bcda856493 SHA512 41018bda556a3ddfb1bd3a16e642548ba06f413b13fd1488e731896e277ba6c84a393ebd5de067ecaeccc695297a2b74edf22e5a3fe8f2e3eadf78d080bdeff6 WHIRLPOOL 98f64c888ea580074e51b91311ab186291cb2d3ecc9f178d828687dbb60b35104237041699b6125cf026edd245459a052fda1801ac3cd7e1efe34606c3d9a4eb
DIST containerd-0.2.9_p27.tar.gz 1140788 SHA256 4d2b6e30bcc6c4bb901d6b9f19b5ac1d4a2d9b17075a9b1f110102920d01f64a SHA512 c749bda691197ec8a7603db9ad92f2800a3f065143430a660333b7862518deb4c158a1c1fd01671dff438b40988d4a64d8f06bab05496b8728c6e2f57cd7da0a WHIRLPOOL 75cb3467a94af50bef52377f309d7c85386475789fab3d2758679f022b516735728a1ac2c54307954a14100c4f84059d8fd5e8376270fdd69e572cff43453fa0
DIST containerd-1.0.0_beta2_p53.tar.gz 3682585 SHA256 2c3ffd4306fbb7dc843832e7d4876bc9400ea4bb52d4bb3d86fc61f223ee114d SHA512 290dcc97c47dccc6af424f5bcdfa2b59ae29eda135f71fb68a456245017a7ce5262150088f91b9edcaa19886d8919e5b6246f2816d6947c0a9b33ec6b58185e9 WHIRLPOOL 11006ce534180ab80c337df08de6ecd58bfea2829e0b5ba5c32531214033dd767bd897e982066c43d4d024705040b998f258fa7facda5bbbbedd5a1f009ed13b

View File

@ -0,0 +1,55 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
GITHUB_URI="github.com/containerd/containerd"
COREOS_GO_PACKAGE="${GITHUB_URI}"
COREOS_GO_VERSION="go1.8"
if [[ ${PV} == *9999 ]]; then
EGIT_REPO_URI="https://${GITHUB_URI}.git"
inherit git-r3
else
# Update the patch number when setting commit.
# The patch number is arbitrarily chosen as the number of commits since the
# tagged version.
# e.g. git log --oneline v0.2.9..${EGIT_COMMIT} | wc -l
EGIT_COMMIT="06b9cb35161009dcb7123345749fef02f7cea8e0"
SRC_URI="https://${GITHUB_URI}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 arm64"
inherit vcs-snapshot
fi
inherit coreos-go systemd
DESCRIPTION="A daemon to control runC"
HOMEPAGE="https://containerd.tools"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="hardened +seccomp"
DEPEND=""
RDEPEND=">=app-emulation/docker-runc-1.0.0_rc4
seccomp? ( sys-libs/libseccomp )"
S=${WORKDIR}/${P}/src/${COREOS_GO_PACKAGE}
RESTRICT="test"
src_unpack() {
mkdir -p "${S}"
tar --strip-components=1 -C "${S}" -xf "${DISTDIR}/${A}"
}
src_compile() {
local options=( $(usex seccomp "seccomp" '') )
export GOPATH="${WORKDIR}/${P}" # ${PWD}/vendor
LDFLAGS=$(usex hardened '-extldflags -fno-PIC' '') emake GIT_COMMIT="$EGIT_COMMIT" BUILDTAGS="${options[@]}"
}
src_install() {
dobin bin/containerd* bin/ctr
systemd_dounit "${FILESDIR}/containerd.service"
}

View File

@ -0,0 +1 @@
containerd-9999.ebuild

View File

@ -5,7 +5,7 @@ EAPI=6
GITHUB_URI="github.com/containerd/containerd"
COREOS_GO_PACKAGE="${GITHUB_URI}"
COREOS_GO_VERSION="go1.8"
COREOS_GO_VERSION="go1.9"
if [[ ${PV} == *9999 ]]; then
EGIT_REPO_URI="https://${GITHUB_URI}.git"
@ -14,11 +14,12 @@ else
# Update the patch number when setting commit.
# The patch number is arbitrarily chosen as the number of commits since the
# tagged version.
# e.g. git log --oneline v0.2.9..${EGIT_COMMIT} | wc -l
EGIT_COMMIT="06b9cb35161009dcb7123345749fef02f7cea8e0"
# e.g. git log --oneline v1.0.0-beta.2..${EGIT_COMMIT} | wc -l
EGIT_COMMIT="992280e8e265f491f7a624ab82f3e238be086e49"
SRC_URI="https://${GITHUB_URI}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
KEYWORDS="amd64 arm64"
inherit vcs-snapshot
MAKE_VERSION_ARGS="REVISION=${EGIT_COMMIT} VERSION=v1.0.0-beta.2-53-g992280e8"
fi
inherit coreos-go systemd
@ -46,10 +47,12 @@ src_unpack() {
src_compile() {
local options=( $(usex seccomp "seccomp" '') )
export GOPATH="${WORKDIR}/${P}" # ${PWD}/vendor
LDFLAGS=$(usex hardened '-extldflags -fno-PIC' '') emake GIT_COMMIT="$EGIT_COMMIT" BUILDTAGS="${options[@]}"
LDFLAGS=$(usex hardened '-extldflags -fno-PIC' '') emake ${MAKE_VERSION_ARGS} BUILDTAGS="${options[@]}"
}
src_install() {
dobin bin/containerd* bin/ctr
systemd_dounit "${FILESDIR}/containerd.service"
systemd_newunit "${FILESDIR}/${PN}-1.0.0.service" "${PN}.service"
insinto /usr/share/containerd
doins "${FILESDIR}/config.toml"
}

View File

@ -0,0 +1,27 @@
# persistent data location
root = "/var/lib/containerd"
# runtime state information
state = "/run/docker/libcontainerd/containerd"
# set containerd as a subreaper on linux when it is not running as PID 1
subreaper = true
# set containerd's OOM score
oom_score = -999
# grpc configuration
[grpc]
address = "/run/docker/libcontainerd/docker-containerd.sock"
# socket uid
uid = 0
# socket gid
gid = 0
[plugins.linux]
# shim binary name/path
shim = "containerd-shim"
# runtime binary name/path
runtime = "runc"
# do not use a shim when starting containers, saves on memory but
# live restore is not supported
no_shim = false
# display shim logs in the containerd daemon's log output
shim_debug = true

View File

@ -0,0 +1,20 @@
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target
[Service]
Delegate=yes
Environment=CONTAINERD_CONFIG=/usr/share/containerd/config.toml
ExecStart=/usr/bin/containerd --config ${TORCX_UNPACKDIR}${TORCX_IMAGEDIR}${CONTAINERD_CONFIG}
KillMode=process
Restart=always
# (lack of) limits from the upstream docker service unit
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
[Install]
WantedBy=multi-user.target