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