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: Thu, 28 Jul 2016 14:14:51
Message-Id: 1469715260.f68e60acc4c699b06605681170d716374b061a86.williamh@gentoo
1 commit: f68e60acc4c699b06605681170d716374b061a86
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 28 14:13:53 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 28 14:14:20 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f68e60ac
7
8 app-emulation/docker: 1.12.0_rc5-r1 bump for #589298 and to fix DOCKER_GITCOMMIT
9
10 Package-Manager: portage-2.2.28
11
12 app-emulation/docker/docker-1.12.0_rc5-r1.ebuild | 281 +++++++++++++++++++++++
13 1 file changed, 281 insertions(+)
14
15 diff --git a/app-emulation/docker/docker-1.12.0_rc5-r1.ebuild b/app-emulation/docker/docker-1.12.0_rc5-r1.ebuild
16 new file mode 100644
17 index 0000000..78df6ad
18 --- /dev/null
19 +++ b/app-emulation/docker/docker-1.12.0_rc5-r1.ebuild
20 @@ -0,0 +1,281 @@
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="a3f2063"
37 + EGIT_COMMIT="v${MY_PV}"
38 + SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
39 + KEYWORDS="~amd64"
40 + [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!"
41 + inherit golang-vcs-snapshot
42 +fi
43 +inherit bash-completion-r1 golang-base linux-info systemd udev user
44 +
45 +DESCRIPTION="The core functions you need to create Docker images and run Docker containers"
46 +HOMEPAGE="https://dockerproject.org"
47 +LICENSE="Apache-2.0"
48 +SLOT="0"
49 +IUSE="apparmor aufs btrfs +device-mapper experimental overlay seccomp"
50 +
51 +# https://github.com/docker/docker/blob/master/hack/PACKAGERS.md#build-dependencies
52 +CDEPEND="
53 + >=dev-db/sqlite-3.7.9:3
54 + device-mapper? (
55 + >=sys-fs/lvm2-2.02.89[thin]
56 + )
57 + seccomp? ( >=sys-libs/libseccomp-2.2.1 )
58 + apparmor? ( sys-libs/libapparmor )
59 +"
60 +
61 +DEPEND="
62 + ${CDEPEND}
63 +
64 + dev-go/go-md2man
65 +
66 + btrfs? (
67 + >=sys-fs/btrfs-progs-3.8
68 + )
69 +"
70 +
71 +# https://github.com/docker/docker/blob/master/hack/PACKAGERS.md#runtime-dependencies
72 +# https://github.com/docker/docker/blob/master/hack/PACKAGERS.md#optional-dependencies
73 +RDEPEND="
74 + ${CDEPEND}
75 +
76 + !app-emulation/docker-bin
77 + >=net-firewall/iptables-1.4
78 + sys-process/procps
79 + >=dev-vcs/git-1.7
80 + >=app-arch/xz-utils-4.9
81 +
82 + >app-emulation/containerd-0.2.2
83 + app-emulation/runc[apparmor?,seccomp?]
84 +"
85 +
86 +RESTRICT="installsources strip"
87 +
88 +S="${WORKDIR}/${P}/src/${EGO_PN}"
89 +
90 +# see "contrib/check-config.sh" from upstream's sources
91 +CONFIG_CHECK="
92 + ~NAMESPACES ~NET_NS ~PID_NS ~IPC_NS ~UTS_NS
93 + ~DEVPTS_MULTIPLE_INSTANCES
94 + ~CGROUPS ~CGROUP_CPUACCT ~CGROUP_DEVICE ~CGROUP_FREEZER ~CGROUP_SCHED ~CPUSETS ~MEMCG
95 + ~KEYS ~MACVLAN ~VETH ~BRIDGE ~BRIDGE_NETFILTER
96 + ~NF_NAT_IPV4 ~IP_NF_FILTER ~IP_NF_MANGLE ~IP_NF_TARGET_MASQUERADE
97 + ~IP_VS ~IP_VS_RR
98 + ~NETFILTER_XT_MATCH_ADDRTYPE ~NETFILTER_XT_MATCH_CONNTRACK
99 + ~NETFILTER_XT_MATCH_IVPS
100 + ~NETFILTER_XT_MARK ~NETFILTER_XT_TARGET_REDIRECT
101 + ~NF_NAT ~NF_NAT_NEEDED
102 +
103 + ~POSIX_MQUEUE
104 +
105 + ~MEMCG_SWAP ~MEMCG_SWAP_ENABLED
106 +
107 + ~BLK_CGROUP ~IOSCHED_CFQ
108 + ~CGROUP_PERF
109 + ~CGROUP_HUGETLB
110 + ~NET_CLS_CGROUP
111 + ~CFS_BANDWIDTH ~FAIR_GROUP_SCHED ~RT_GROUP_SCHED
112 + ~XFRM_ALGO ~XFRM_USER
113 +"
114 +
115 +ERROR_KEYS="CONFIG_KEYS: is mandatory"
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 kernel_is lt 4 5; then
165 + CONFIG_CHECK+="
166 + ~MEMCG_KMEM
167 + "
168 + ERROR_MEMCG_KMEM="CONFIG_MEMCG_KMEM: is optional"
169 + fi
170 +
171 + if use aufs; then
172 + CONFIG_CHECK+="
173 + ~AUFS_FS
174 + ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
175 + "
176 + ERROR_AUFS_FS="CONFIG_AUFS_FS: is required to be set if and only if aufs-sources are used instead of aufs4/aufs3"
177 + fi
178 +
179 + if use btrfs; then
180 + CONFIG_CHECK+="
181 + ~BTRFS_FS
182 + "
183 + fi
184 +
185 + if use device-mapper; then
186 + CONFIG_CHECK+="
187 + ~BLK_DEV_DM ~DM_THIN_PROVISIONING ~EXT4_FS ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
188 + "
189 + fi
190 +
191 + if use overlay; then
192 + CONFIG_CHECK+="
193 + ~OVERLAY_FS ~EXT4_FS_SECURITY ~EXT4_FS_POSIX_ACL
194 + "
195 + fi
196 +
197 + linux-info_pkg_setup
198 +
199 + # create docker group for the code checking for it in /etc/group
200 + enewgroup docker
201 +}
202 +
203 +src_compile() {
204 + export GOPATH="${WORKDIR}/${P}:${PWD}/vendor"
205 +
206 + # setup CFLAGS and LDFLAGS for separate build target
207 + # see https://github.com/tianon/docker-overlay/pull/10
208 + export CGO_CFLAGS="-I${ROOT}/usr/include"
209 + export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
210 +
211 + # if we're building from a zip, we need the GITCOMMIT value
212 + [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
213 +
214 + if gcc-specs-pie; then
215 + sed -i "s/EXTLDFLAGS_STATIC='/&-fno-PIC /" hack/make.sh || die
216 + grep -q -- '-fno-PIC' hack/make.sh || die 'hardened sed failed'
217 +
218 + sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
219 + -i hack/make/dynbinary-client || die
220 + sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
221 + -i hack/make/dynbinary-daemon || die
222 + grep -q -- '-fno-PIC' hack/make/dynbinary-daemon || die 'hardened sed failed'
223 + grep -q -- '-fno-PIC' hack/make/dynbinary-client || die 'hardened sed failed'
224 + fi
225 +
226 + # let's set up some optional features :)
227 + export DOCKER_BUILDTAGS=''
228 + for gd in aufs btrfs device-mapper overlay; do
229 + if ! use $gd; then
230 + DOCKER_BUILDTAGS+=" exclude_graphdriver_${gd//-/}"
231 + fi
232 + done
233 +
234 + for tag in apparmor seccomp; do
235 + if use $tag; then
236 + DOCKER_BUILDTAGS+=" $tag"
237 + fi
238 + done
239 +
240 + # https://github.com/docker/docker/pull/13338
241 + if use experimental; then
242 + export DOCKER_EXPERIMENTAL=1
243 + else
244 + unset DOCKER_EXPERIMENTAL
245 + fi
246 +
247 + # time to build!
248 + ./hack/make.sh dynbinary || die 'dynbinary failed'
249 +
250 + # build the man pages too
251 + ./man/md2man-all.sh || die "unable to generate man pages"
252 +}
253 +
254 +src_install() {
255 + VERSION="$(cat VERSION)"
256 + newbin "bundles/$VERSION/dynbinary-client/docker-$VERSION" docker
257 + newbin "bundles/$VERSION/dynbinary-daemon/dockerd-$VERSION" dockerd
258 + newbin "bundles/$VERSION/dynbinary-daemon/docker-proxy-$VERSION" docker-proxy
259 + dosym containerd /usr/bin/docker-containerd
260 + dosym containerd-shim /usr/bin/docker-containerd-shim
261 + dosym runc /usr/bin/docker-runc
262 +
263 + newinitd contrib/init/openrc/docker.initd docker
264 + newconfd contrib/init/openrc/docker.confd docker
265 +
266 + systemd_dounit contrib/init/systemd/docker.{service,socket}
267 +
268 + udev_dorules contrib/udev/*.rules
269 +
270 + dodoc AUTHORS CONTRIBUTING.md CHANGELOG.md NOTICE README.md
271 + dodoc -r docs/*
272 + doman man/man*/*
273 +
274 + dobashcomp contrib/completion/bash/*
275 +
276 + insinto /usr/share/zsh/site-functions
277 + doins contrib/completion/zsh/*
278 +
279 + insinto /usr/share/vim/vimfiles
280 + doins -r contrib/syntax/vim/ftdetect
281 + doins -r contrib/syntax/vim/syntax
282 +
283 + # note: intentionally not using "doins" so that we preserve +x bits
284 + mkdir -p "${D}/usr/share/${PN}/contrib"
285 + cp -R contrib/* "${D}/usr/share/${PN}/contrib"
286 +}
287 +
288 +pkg_postinst() {
289 + udev_reload
290 +
291 + elog
292 + elog "To use Docker, the Docker daemon must be running as root. To automatically"
293 + elog "start the Docker daemon at boot, add Docker to the default runlevel:"
294 + elog " rc-update add docker default"
295 + elog "Similarly for systemd:"
296 + elog " systemctl enable docker.service"
297 + elog
298 + elog "To use Docker as a non-root user, add yourself to the 'docker' group:"
299 + elog " usermod -aG docker youruser"
300 + elog
301 +}