Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/docker/, app-emulation/docker/files/
Date: Mon, 27 Feb 2017 21:17:59
Message-Id: 1488230258.e09eb23b1edb18d31d26b084f4220ddc9e3e5253.williamh@gentoo
1 commit: e09eb23b1edb18d31d26b084f4220ddc9e3e5253
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 27 21:17:12 2017 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 27 21:17:38 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e09eb23b
7
8 app-emulation/docker: rev bump to allow the openrc service log to be split
9
10 https://github.com/docker/docker/pull/31314
11
12 Package-Manager: Portage-2.3.3, Repoman-2.3.1
13
14 app-emulation/docker/docker-1.13.1-r2.ebuild | 291 +++++++++++++++++++++
15 .../docker/files/1.13.1-split-openrc-log.patch | 54 ++++
16 2 files changed, 345 insertions(+)
17
18 diff --git a/app-emulation/docker/docker-1.13.1-r2.ebuild b/app-emulation/docker/docker-1.13.1-r2.ebuild
19 new file mode 100644
20 index 0000000000..2b4fec64db
21 --- /dev/null
22 +++ b/app-emulation/docker/docker-1.13.1-r2.ebuild
23 @@ -0,0 +1,291 @@
24 +# Copyright 1999-2017 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +# $Id$
27 +
28 +EAPI=6
29 +
30 +EGO_PN="github.com/docker/docker"
31 +
32 +if [[ ${PV} = *9999* ]]; then
33 + # Docker cannot be fetched via "go get", thanks to autogenerated code
34 + EGIT_REPO_URI="https://${EGO_PN}.git"
35 + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}/src/${EGO_PN}"
36 + inherit git-r3
37 +else
38 + MY_PV="${PV/_/-}"
39 + DOCKER_GITCOMMIT="092cba3"
40 + EGIT_COMMIT="v${MY_PV}"
41 + SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
42 + KEYWORDS="~amd64"
43 + [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!"
44 + inherit golang-vcs-snapshot
45 +fi
46 +inherit bash-completion-r1 golang-base linux-info systemd udev user
47 +
48 +DESCRIPTION="The core functions you need to create Docker images and run Docker containers"
49 +HOMEPAGE="https://dockerproject.org"
50 +LICENSE="Apache-2.0"
51 +SLOT="0"
52 +IUSE="apparmor aufs btrfs +container-init +device-mapper hardened overlay pkcs11 seccomp"
53 +
54 +# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
55 +CDEPEND="
56 + >=dev-db/sqlite-3.7.9:3
57 + device-mapper? (
58 + >=sys-fs/lvm2-2.02.89[thin]
59 + )
60 + seccomp? ( >=sys-libs/libseccomp-2.2.1 )
61 + apparmor? ( sys-libs/libapparmor )
62 +"
63 +
64 +DEPEND="
65 + ${CDEPEND}
66 +
67 + dev-go/go-md2man
68 +
69 + btrfs? (
70 + >=sys-fs/btrfs-progs-3.16.1
71 + )
72 +"
73 +
74 +# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
75 +# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#optional-dependencies
76 +RDEPEND="
77 + ${CDEPEND}
78 +
79 + !app-emulation/docker-bin
80 + >=net-firewall/iptables-1.4
81 + sys-process/procps
82 + >=dev-vcs/git-1.7
83 + >=app-arch/xz-utils-4.9
84 +
85 + >=app-emulation/containerd-0.2.5
86 + app-emulation/docker-runc[apparmor?,seccomp?]
87 + app-emulation/docker-proxy
88 + container-init? ( >=sys-process/tini-0.13.0[static] )
89 +"
90 +
91 +RESTRICT="installsources strip"
92 +
93 +S="${WORKDIR}/${P}/src/${EGO_PN}"
94 +
95 +# see "contrib/check-config.sh" from upstream's sources
96 +CONFIG_CHECK="
97 + ~NAMESPACES ~NET_NS ~PID_NS ~IPC_NS ~UTS_NS
98 + ~CGROUPS ~CGROUP_CPUACCT ~CGROUP_DEVICE ~CGROUP_FREEZER ~CGROUP_SCHED ~CPUSETS ~MEMCG
99 + ~KEYS
100 + ~VETH ~BRIDGE ~BRIDGE_NETFILTER
101 + ~NF_NAT_IPV4 ~IP_NF_FILTER ~IP_NF_TARGET_MASQUERADE
102 + ~NETFILTER_XT_MATCH_ADDRTYPE ~NETFILTER_XT_MATCH_CONNTRACK
103 + ~NF_NAT ~NF_NAT_NEEDED
104 + ~POSIX_MQUEUE
105 +
106 + ~USER_NS
107 + ~SECCOMP
108 + ~CGROUP_PIDS
109 + ~MEMCG_SWAP ~MEMCG_SWAP_ENABLED
110 +
111 + ~BLK_CGROUP ~BLK_DEV_THROTTLING ~IOSCHED_CFQ ~CFQ_GROUP_IOSCHED
112 + ~CGROUP_PERF
113 + ~CGROUP_HUGETLB
114 + ~NET_CLS_CGROUP
115 + ~CFS_BANDWIDTH ~FAIR_GROUP_SCHED ~RT_GROUP_SCHED
116 + ~IP_VS ~IP_VS_PROTO_TCP ~IP_VS_PROTO_UDP ~IP_VS_NFCT
117 +
118 + ~VXLAN
119 + ~XFRM_ALGO ~XFRM_USER
120 + ~IPVLAN
121 + ~MACVLAN ~DUMMY
122 +"
123 +
124 +ERROR_KEYS="CONFIG_KEYS: is mandatory"
125 +ERROR_MEMCG_SWAP="CONFIG_MEMCG_SWAP: is required if you wish to limit swap usage of containers"
126 +ERROR_RESOURCE_COUNTERS="CONFIG_RESOURCE_COUNTERS: is optional for container statistics gathering"
127 +
128 +ERROR_BLK_CGROUP="CONFIG_BLK_CGROUP: is optional for container statistics gathering"
129 +ERROR_IOSCHED_CFQ="CONFIG_IOSCHED_CFQ: is optional for container statistics gathering"
130 +ERROR_CGROUP_PERF="CONFIG_CGROUP_PERF: is optional for container statistics gathering"
131 +ERROR_CFS_BANDWIDTH="CONFIG_CFS_BANDWIDTH: is optional for container statistics gathering"
132 +ERROR_XFRM_ALGO="CONFIG_XFRM_ALGO: is optional for secure networks"
133 +ERROR_XFRM_USER="CONFIG_XFRM_USER: is optional for secure networks"
134 +
135 +PATCHES=(
136 + "${FILESDIR}"/${PV}-split-openrc-log.patch
137 +)
138 +
139 +pkg_setup() {
140 + if kernel_is lt 3 10; then
141 + ewarn ""
142 + ewarn "Using Docker with kernels older than 3.10 is unstable and unsupported."
143 + ewarn " - http://docs.docker.com/engine/installation/binaries/#check-kernel-dependencies"
144 + fi
145 +
146 + # for where these kernel versions come from, see:
147 + # https://www.google.com/search?q=945b2b2d259d1a4364a2799e80e8ff32f8c6ee6f+site%3Akernel.org%2Fpub%2Flinux%2Fkernel+file%3AChangeLog*
148 + if ! {
149 + kernel_is ge 3 16 \
150 + || { kernel_is 3 15 && kernel_is ge 3 15 5; } \
151 + || { kernel_is 3 14 && kernel_is ge 3 14 12; } \
152 + || { kernel_is 3 12 && kernel_is ge 3 12 25; }
153 + }; then
154 + ewarn ""
155 + ewarn "There is a serious Docker-related kernel panic that has been fixed in 3.16+"
156 + ewarn " (and was backported to 3.15.5+, 3.14.12+, and 3.12.25+)"
157 + ewarn ""
158 + ewarn "See also https://github.com/docker/docker/issues/2960"
159 + fi
160 +
161 + if kernel_is le 3 18; then
162 + CONFIG_CHECK+="
163 + ~RESOURCE_COUNTERS
164 + "
165 + fi
166 +
167 + if kernel_is le 3 13; then
168 + CONFIG_CHECK+="
169 + ~NETPRIO_CGROUP
170 + "
171 + else
172 + CONFIG_CHECK+="
173 + ~CGROUP_NET_PRIO
174 + "
175 + fi
176 +
177 + if kernel_is lt 4 5; then
178 + CONFIG_CHECK+="
179 + ~MEMCG_KMEM
180 + "
181 + ERROR_MEMCG_KMEM="CONFIG_MEMCG_KMEM: is optional"
182 + fi
183 +
184 + if kernel_is lt 4 7; then
185 + CONFIG_CHECK+="
186 + ~DEVPTS_MULTIPLE_INSTANCES
187 + "
188 + fi
189 +
190 + if use aufs; then
191 + CONFIG_CHECK+="
192 + ~AUFS_FS
193 + ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
194 + "
195 + ERROR_AUFS_FS="CONFIG_AUFS_FS: is required to be set if and only if aufs-sources are used instead of aufs4/aufs3"
196 + fi
197 +
198 + if use btrfs; then
199 + CONFIG_CHECK+="
200 + ~BTRFS_FS
201 + ~BTRFS_FS_POSIX_ACL
202 + "
203 + fi
204 +
205 + if use device-mapper; then
206 + CONFIG_CHECK+="
207 + ~BLK_DEV_DM ~DM_THIN_PROVISIONING ~EXT4_FS ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
208 + "
209 + fi
210 +
211 + if use overlay; then
212 + CONFIG_CHECK+="
213 + ~OVERLAY_FS ~EXT4_FS_SECURITY ~EXT4_FS_POSIX_ACL
214 + "
215 + fi
216 +
217 + linux-info_pkg_setup
218 +
219 + # create docker group for the code checking for it in /etc/group
220 + enewgroup docker
221 +}
222 +
223 +src_compile() {
224 + export GOPATH="${WORKDIR}/${P}:${PWD}/vendor"
225 +
226 + # setup CFLAGS and LDFLAGS for separate build target
227 + # see https://github.com/tianon/docker-overlay/pull/10
228 + export CGO_CFLAGS="-I${ROOT}/usr/include"
229 + export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
230 +
231 + # if we're building from a tarball, we need the GITCOMMIT value
232 + [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
233 +
234 + if use hardened; then
235 + sed -i "s/EXTLDFLAGS_STATIC='/&-fno-PIC /" hack/make.sh || die
236 + grep -q -- '-fno-PIC' hack/make.sh || die 'hardened sed failed'
237 +
238 + sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
239 + -i hack/make/dynbinary-client || die
240 + sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
241 + -i hack/make/dynbinary-daemon || die
242 + grep -q -- '-fno-PIC' hack/make/dynbinary-daemon || die 'hardened sed failed'
243 + grep -q -- '-fno-PIC' hack/make/dynbinary-client || die 'hardened sed failed'
244 + fi
245 +
246 + # let's set up some optional features :)
247 + export DOCKER_BUILDTAGS=''
248 + for gd in aufs btrfs device-mapper overlay; do
249 + if ! use $gd; then
250 + DOCKER_BUILDTAGS+=" exclude_graphdriver_${gd//-/}"
251 + fi
252 + done
253 +
254 + for tag in apparmor pkcs11 seccomp; do
255 + if use $tag; then
256 + DOCKER_BUILDTAGS+=" $tag"
257 + fi
258 + done
259 +
260 + # time to build!
261 + ./hack/make.sh dynbinary || die 'dynbinary failed'
262 +
263 + # build the man pages too
264 + ./man/md2man-all.sh || die "unable to generate man pages"
265 +}
266 +
267 +src_install() {
268 + VERSION="$(cat VERSION)"
269 + newbin "bundles/$VERSION/dynbinary-client/docker-$VERSION" docker
270 + newbin "bundles/$VERSION/dynbinary-daemon/dockerd-$VERSION" dockerd
271 + dosym containerd /usr/bin/docker-containerd
272 + dosym containerd-shim /usr/bin/docker-containerd-shim
273 + dosym runc /usr/bin/docker-runc
274 + use container-init && dosym tini /usr/bin/docker-init
275 +
276 + newinitd contrib/init/openrc/docker.initd docker
277 + newconfd contrib/init/openrc/docker.confd docker
278 +
279 + systemd_dounit contrib/init/systemd/docker.{service,socket}
280 +
281 + udev_dorules contrib/udev/*.rules
282 +
283 + dodoc AUTHORS CONTRIBUTING.md CHANGELOG.md NOTICE README.md
284 + dodoc -r docs/*
285 + doman man/man*/*
286 +
287 + dobashcomp contrib/completion/bash/*
288 +
289 + insinto /usr/share/zsh/site-functions
290 + doins contrib/completion/zsh/_*
291 +
292 + insinto /usr/share/vim/vimfiles
293 + doins -r contrib/syntax/vim/ftdetect
294 + doins -r contrib/syntax/vim/syntax
295 +
296 + # note: intentionally not using "doins" so that we preserve +x bits
297 + dodir /usr/share/${PN}/contrib
298 + cp -R contrib/* "${ED}/usr/share/${PN}/contrib"
299 +}
300 +
301 +pkg_postinst() {
302 + udev_reload
303 +
304 + elog
305 + elog "To use Docker, the Docker daemon must be running as root. To automatically"
306 + elog "start the Docker daemon at boot, add Docker to the default runlevel:"
307 + elog " rc-update add docker default"
308 + elog "Similarly for systemd:"
309 + elog " systemctl enable docker.service"
310 + elog
311 + elog "To use Docker as a non-root user, add yourself to the 'docker' group:"
312 + elog " usermod -aG docker youruser"
313 + elog
314 +}
315
316 diff --git a/app-emulation/docker/files/1.13.1-split-openrc-log.patch b/app-emulation/docker/files/1.13.1-split-openrc-log.patch
317 new file mode 100644
318 index 0000000000..c7cdd224dc
319 --- /dev/null
320 +++ b/app-emulation/docker/files/1.13.1-split-openrc-log.patch
321 @@ -0,0 +1,54 @@
322 +From 65c1a3be5bf748f95edc45f1391c869bf4ff4a52 Mon Sep 17 00:00:00 2001
323 +From: William Hubbs <w.d.hubbs@×××××.com>
324 +Date: Thu, 23 Feb 2017 17:07:26 -0600
325 +Subject: [PATCH] contrib/init/openrc: allow separate logs for stdout and
326 + stderr
327 +
328 +Signed-off-by: William Hubbs <w.d.hubbs@×××××.com>
329 +---
330 + contrib/init/openrc/docker.confd | 10 ++++++++++
331 + contrib/init/openrc/docker.initd | 4 +++-
332 + 2 files changed, 13 insertions(+), 1 deletion(-)
333 +
334 +diff --git a/contrib/init/openrc/docker.confd b/contrib/init/openrc/docker.confd
335 +index 2444031..89183de 100644
336 +--- a/contrib/init/openrc/docker.confd
337 ++++ b/contrib/init/openrc/docker.confd
338 +@@ -1,8 +1,18 @@
339 + # /etc/conf.d/docker: config file for /etc/init.d/docker
340 +
341 + # where the docker daemon output gets piped
342 ++# this contains both stdout and stderr. If you need to separate them,
343 ++# see the settings below
344 + #DOCKER_LOGFILE="/var/log/docker.log"
345 +
346 ++# where the docker daemon stdout gets piped
347 ++# if this is not set, DOCKER_LOGFILE is used
348 ++#DOCKER_OUTFILE="/var/log/docker-out.log"
349 ++
350 ++# where the docker daemon stderr gets piped
351 ++# if this is not set, DOCKER_LOGFILE is used
352 ++#DOCKER_ERRFILE="/var/log/docker-err.log"
353 ++
354 + # where docker's pid get stored
355 + #DOCKER_PIDFILE="/run/docker.pid"
356 +
357 +diff --git a/contrib/init/openrc/docker.initd b/contrib/init/openrc/docker.initd
358 +index 5d31603..6c968f6 100644
359 +--- a/contrib/init/openrc/docker.initd
360 ++++ b/contrib/init/openrc/docker.initd
361 +@@ -6,8 +6,10 @@ command="${DOCKERD_BINARY:-/usr/bin/dockerd}"
362 + pidfile="${DOCKER_PIDFILE:-/run/${RC_SVCNAME}.pid}"
363 + command_args="-p \"${pidfile}\" ${DOCKER_OPTS}"
364 + DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}"
365 ++DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}"
366 ++DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}"
367 + start_stop_daemon_args="--background \
368 +- --stderr \"${DOCKER_LOGFILE}\" --stdout \"${DOCKER_LOGFILE}\""
369 ++ --stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\""
370 +
371 + start_pre() {
372 + checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE"
373 +--
374 +2.10.2
375 +