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/
Date: Tue, 28 Jun 2016 13:08:02
Message-Id: 1467119232.095fb19dd519f2dd421741922a88790300b20435.williamh@gentoo
1 commit: 095fb19dd519f2dd421741922a88790300b20435
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 28 13:06:12 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 28 13:07:12 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=095fb19d
7
8 app-emulation/docker: 1.12.0_rc2-r2 revbump for bug #587404
9
10 Package-Manager: portage-2.2.28
11
12 app-emulation/docker/docker-1.12.0_rc2-r2.ebuild | 275 +++++++++++++++++++++++
13 1 file changed, 275 insertions(+)
14
15 diff --git a/app-emulation/docker/docker-1.12.0_rc2-r2.ebuild b/app-emulation/docker/docker-1.12.0_rc2-r2.ebuild
16 new file mode 100644
17 index 0000000..e85287d
18 --- /dev/null
19 +++ b/app-emulation/docker/docker-1.12.0_rc2-r2.ebuild
20 @@ -0,0 +1,275 @@
21 +# Copyright 1999-2016 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Id$
24 +
25 +EAPI=6
26 +
27 +EGO_PN="github.com/docker/docker"
28 +
29 +if [[ ${PV} = *9999* ]]; then
30 + # Docker cannot be fetched via "go get", thanks to autogenerated code
31 + EGIT_REPO_URI="https://${EGO_PN}.git"
32 + EGIT_CHECKOUT_DIR="${WORKDIR}/${P}/src/${EGO_PN}"
33 + inherit git-r3
34 +else
35 + MY_PV="${PV/_/-}"
36 + DOCKER_GITCOMMIT="906eacd"
37 + EGIT_COMMIT="v${MY_PV}"
38 + SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz
39 + https://dev.gentoo.org/~williamh/dist/${P}-23859.patch"
40 + KEYWORDS="~amd64"
41 + [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!"
42 + inherit golang-vcs-snapshot
43 +fi
44 +inherit bash-completion-r1 golang-base linux-info systemd udev user
45 +
46 +DESCRIPTION="The core functions you need to create Docker images and run Docker containers"
47 +HOMEPAGE="https://dockerproject.org"
48 +LICENSE="Apache-2.0"
49 +SLOT="0"
50 +IUSE="apparmor aufs btrfs +device-mapper experimental overlay seccomp"
51 +
52 +# https://github.com/docker/docker/blob/master/hack/PACKAGERS.md#build-dependencies
53 +CDEPEND="
54 + >=dev-db/sqlite-3.7.9:3
55 + device-mapper? (
56 + >=sys-fs/lvm2-2.02.89[thin]
57 + )
58 + seccomp? ( >=sys-libs/libseccomp-2.2.1 )
59 + apparmor? ( sys-libs/libapparmor )
60 +"
61 +
62 +DEPEND="
63 + ${CDEPEND}
64 +
65 + dev-go/go-md2man
66 +
67 + btrfs? (
68 + >=sys-fs/btrfs-progs-3.8
69 + )
70 +"
71 +
72 +# https://github.com/docker/docker/blob/master/hack/PACKAGERS.md#runtime-dependencies
73 +# https://github.com/docker/docker/blob/master/hack/PACKAGERS.md#optional-dependencies
74 +RDEPEND="
75 + ${CDEPEND}
76 +
77 + !app-emulation/docker-bin
78 + >=net-firewall/iptables-1.4
79 + sys-process/procps
80 + >=dev-vcs/git-1.7
81 + >=app-arch/xz-utils-4.9
82 +
83 + >app-emulation/containerd-0.2.2
84 + app-emulation/runc[apparmor?,seccomp?]
85 +"
86 +
87 +RESTRICT="installsources strip"
88 +
89 +S="${WORKDIR}/${P}/src/${EGO_PN}"
90 +
91 +# see "contrib/check-config.sh" from upstream's sources
92 +CONFIG_CHECK="
93 + ~NAMESPACES ~NET_NS ~PID_NS ~IPC_NS ~UTS_NS
94 + ~DEVPTS_MULTIPLE_INSTANCES
95 + ~CGROUPS ~CGROUP_CPUACCT ~CGROUP_DEVICE ~CGROUP_FREEZER ~CGROUP_SCHED ~CPUSETS ~MEMCG
96 + ~KEYS ~MACVLAN ~VETH ~BRIDGE ~BRIDGE_NETFILTER
97 + ~NF_NAT_IPV4 ~IP_NF_FILTER ~IP_NF_TARGET_MASQUERADE
98 + ~IP_VS
99 + ~NETFILTER_XT_MATCH_ADDRTYPE ~NETFILTER_XT_MATCH_CONNTRACK
100 + ~NF_NAT ~NF_NAT_NEEDED
101 +
102 + ~POSIX_MQUEUE
103 +
104 + ~MEMCG_KMEM ~MEMCG_SWAP ~MEMCG_SWAP_ENABLED
105 +
106 + ~BLK_CGROUP ~IOSCHED_CFQ
107 + ~CGROUP_PERF
108 + ~CGROUP_HUGETLB
109 + ~NET_CLS_CGROUP
110 + ~CFS_BANDWIDTH ~FAIR_GROUP_SCHED ~RT_GROUP_SCHED
111 + ~XFRM_ALGO ~XFRM_USER
112 +"
113 +
114 +ERROR_KEYS="CONFIG_KEYS: is mandatory"
115 +ERROR_MEMCG_KMEM="CONFIG_MEMCG_KMEM: is optional"
116 +ERROR_MEMCG_SWAP="CONFIG_MEMCG_SWAP: is required if you wish to limit swap usage of containers"
117 +ERROR_RESOURCE_COUNTERS="CONFIG_RESOURCE_COUNTERS: is optional for container statistics gathering"
118 +
119 +ERROR_BLK_CGROUP="CONFIG_BLK_CGROUP: is optional for container statistics gathering"
120 +ERROR_IOSCHED_CFQ="CONFIG_IOSCHED_CFQ: is optional for container statistics gathering"
121 +ERROR_CGROUP_PERF="CONFIG_CGROUP_PERF: is optional for container statistics gathering"
122 +ERROR_CFS_BANDWIDTH="CONFIG_CFS_BANDWIDTH: is optional for container statistics gathering"
123 +ERROR_XFRM_ALGO="CONFIG_XFRM_ALGO: is optional for secure networks"
124 +ERROR_XFRM_USER="CONFIG_XFRM_USER: is optional for secure networks"
125 +
126 +pkg_setup() {
127 + if kernel_is lt 3 10; then
128 + ewarn ""
129 + ewarn "Using Docker with kernels older than 3.10 is unstable and unsupported."
130 + ewarn " - http://docs.docker.com/installation/binaries/#check-kernel-dependencies"
131 + fi
132 +
133 + # for where these kernel versions come from, see:
134 + # https://www.google.com/search?q=945b2b2d259d1a4364a2799e80e8ff32f8c6ee6f+site%3Akernel.org%2Fpub%2Flinux%2Fkernel+file%3AChangeLog*
135 + if ! {
136 + kernel_is ge 3 16 \
137 + || { kernel_is 3 15 && kernel_is ge 3 15 5; } \
138 + || { kernel_is 3 14 && kernel_is ge 3 14 12; } \
139 + || { kernel_is 3 12 && kernel_is ge 3 12 25; }
140 + }; then
141 + ewarn ""
142 + ewarn "There is a serious Docker-related kernel panic that has been fixed in 3.16+"
143 + ewarn " (and was backported to 3.15.5+, 3.14.12+, and 3.12.25+)"
144 + ewarn ""
145 + ewarn "See also https://github.com/docker/docker/issues/2960"
146 + fi
147 +
148 + if kernel_is le 3 18; then
149 + CONFIG_CHECK+="
150 + ~RESOURCE_COUNTERS
151 + "
152 + fi
153 +
154 + if kernel_is le 3 13; then
155 + CONFIG_CHECK+="
156 + ~NETPRIO_CGROUP
157 + "
158 + else
159 + CONFIG_CHECK+="
160 + ~CGROUP_NET_PRIO
161 + "
162 + fi
163 +
164 + if use aufs; then
165 + CONFIG_CHECK+="
166 + ~AUFS_FS
167 + ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
168 + "
169 + ERROR_AUFS_FS="CONFIG_AUFS_FS: is required to be set if and only if aufs-sources are used instead of aufs4/aufs3"
170 + fi
171 +
172 + if use btrfs; then
173 + CONFIG_CHECK+="
174 + ~BTRFS_FS
175 + "
176 + fi
177 +
178 + if use device-mapper; then
179 + CONFIG_CHECK+="
180 + ~BLK_DEV_DM ~DM_THIN_PROVISIONING ~EXT4_FS ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
181 + "
182 + fi
183 +
184 + if use overlay; then
185 + CONFIG_CHECK+="
186 + ~OVERLAY_FS ~EXT4_FS_SECURITY ~EXT4_FS_POSIX_ACL
187 + "
188 + fi
189 +
190 + linux-info_pkg_setup
191 +
192 + # create docker group for the code checking for it in /etc/group
193 + enewgroup docker
194 +}
195 +
196 +PATCHES=(
197 + # https://github.com/docker/docker/pull/23859
198 + "${DISTDIR}"/${P}-23859.patch
199 +)
200 +
201 +src_compile() {
202 + export GOPATH="${WORKDIR}/${P}:${PWD}/vendor"
203 +
204 + # setup CFLAGS and LDFLAGS for separate build target
205 + # see https://github.com/tianon/docker-overlay/pull/10
206 + export CGO_CFLAGS="-I${ROOT}/usr/include"
207 + export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
208 +
209 + # if we're building from a zip, we need the GITCOMMIT value
210 + [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
211 +
212 + if gcc-specs-pie; then
213 + sed -i "s/EXTLDFLAGS_STATIC='/&-fno-PIC /" hack/make.sh || die
214 + grep -q -- '-fno-PIC' hack/make.sh || die 'hardened sed failed'
215 +
216 + sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
217 + -i hack/make/dynbinary || die
218 + grep -q -- '-fno-PIC' hack/make/dynbinary || die 'hardened sed failed'
219 + fi
220 +
221 + # let's set up some optional features :)
222 + export DOCKER_BUILDTAGS=''
223 + for gd in aufs btrfs device-mapper overlay; do
224 + if ! use $gd; then
225 + DOCKER_BUILDTAGS+=" exclude_graphdriver_${gd//-/}"
226 + fi
227 + done
228 +
229 + for tag in apparmor seccomp; do
230 + if use $tag; then
231 + DOCKER_BUILDTAGS+=" $tag"
232 + fi
233 + done
234 +
235 + # https://github.com/docker/docker/pull/13338
236 + if use experimental; then
237 + export DOCKER_EXPERIMENTAL=1
238 + else
239 + unset DOCKER_EXPERIMENTAL
240 + fi
241 +
242 + # time to build!
243 + ./hack/make.sh dynbinary || die 'dynbinary failed'
244 +
245 + # build the man pages too
246 + ./man/md2man-all.sh || die "unable to generate man pages"
247 +}
248 +
249 +src_install() {
250 + VERSION="$(cat VERSION)"
251 + newbin "bundles/$VERSION/dynbinary-client/docker-$VERSION" docker
252 + newbin "bundles/$VERSION/dynbinary-daemon/dockerd-$VERSION" dockerd
253 + dosym containerd /usr/bin/docker-containerd
254 + dosym containerd-shim /usr/bin/docker-containerd-shim
255 + dosym runc /usr/bin/docker-runc
256 +
257 + newinitd contrib/init/openrc/docker.initd docker
258 + newconfd contrib/init/openrc/docker.confd docker
259 +
260 + systemd_dounit contrib/init/systemd/docker.{service,socket}
261 +
262 + udev_dorules contrib/udev/*.rules
263 +
264 + dodoc AUTHORS CONTRIBUTING.md CHANGELOG.md NOTICE README.md
265 + dodoc -r docs/*
266 + doman man/man*/*
267 +
268 + dobashcomp contrib/completion/bash/*
269 +
270 + insinto /usr/share/zsh/site-functions
271 + doins contrib/completion/zsh/*
272 +
273 + insinto /usr/share/vim/vimfiles
274 + doins -r contrib/syntax/vim/ftdetect
275 + doins -r contrib/syntax/vim/syntax
276 +
277 + # note: intentionally not using "doins" so that we preserve +x bits
278 + mkdir -p "${D}/usr/share/${PN}/contrib"
279 + cp -R contrib/* "${D}/usr/share/${PN}/contrib"
280 +}
281 +
282 +pkg_postinst() {
283 + udev_reload
284 +
285 + elog
286 + elog "To use Docker, the Docker daemon must be running as root. To automatically"
287 + elog "start the Docker daemon at boot, add Docker to the default runlevel:"
288 + elog " rc-update add docker default"
289 + elog "Similarly for systemd:"
290 + elog " systemctl enable docker.service"
291 + elog
292 + elog "To use Docker as a non-root user, add yourself to the 'docker' group:"
293 + elog " usermod -aG docker youruser"
294 + elog
295 +}