Gentoo Archives: gentoo-commits

From: "Manuel Rüger" <mrueg@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/docker/
Date: Sun, 28 Oct 2018 17:30:20
Message-Id: 1540747732.ac98ab3522a0966544289962c313f96abb40d102.mrueg@gentoo
1 commit: ac98ab3522a0966544289962c313f96abb40d102
2 Author: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 28 17:27:12 2018 +0000
4 Commit: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 28 17:28:52 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac98ab35
7
8 app-emulation/docker: Add new version of apparmor profile patch
9
10 Signed-off-by: Manuel Rüger <mrueg <AT> gentoo.org>
11 Package-Manager: Portage-2.3.51, Repoman-2.3.11
12
13 app-emulation/docker/docker-18.06.1-r1.ebuild | 305 ++++++++++++++++++++++++++
14 1 file changed, 305 insertions(+)
15
16 diff --git a/app-emulation/docker/docker-18.06.1-r1.ebuild b/app-emulation/docker/docker-18.06.1-r1.ebuild
17 new file mode 100644
18 index 00000000000..149bfeb91e8
19 --- /dev/null
20 +++ b/app-emulation/docker/docker-18.06.1-r1.ebuild
21 @@ -0,0 +1,305 @@
22 +# Copyright 1999-2018 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=6
26 +
27 +EGO_PN="github.com/docker/docker-ce"
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 + inherit versionator
36 + if [ "$(get_version_component_count)" = 4 ]; then
37 + MY_PV="$(replace_version_separator 3 '-ce-')"
38 + else
39 + MY_PV="$PV-ce"
40 + fi
41 + DOCKER_GITCOMMIT="e68fc7a"
42 + EGIT_COMMIT="v${MY_PV}"
43 + SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
44 + KEYWORDS="~amd64 ~arm ~arm64"
45 + [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!"
46 + inherit golang-vcs-snapshot
47 +fi
48 +inherit bash-completion-r1 golang-base linux-info systemd udev user
49 +
50 +DESCRIPTION="The core functions you need to create Docker images and run Docker containers"
51 +HOMEPAGE="https://dockerproject.org"
52 +LICENSE="Apache-2.0"
53 +SLOT="0"
54 +IUSE="apparmor aufs btrfs +container-init +device-mapper hardened +overlay pkcs11 seccomp"
55 +
56 +# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
57 +CDEPEND="
58 + >=dev-db/sqlite-3.7.9:3
59 + device-mapper? (
60 + >=sys-fs/lvm2-2.02.89[thin]
61 + )
62 + seccomp? ( >=sys-libs/libseccomp-2.2.1 )
63 + apparmor? ( sys-libs/libapparmor )
64 +"
65 +
66 +DEPEND="
67 + ${CDEPEND}
68 +
69 + dev-go/go-md2man
70 +
71 + btrfs? (
72 + >=sys-fs/btrfs-progs-3.16.1
73 + )
74 +"
75 +
76 +# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
77 +# https://github.com/docker/docker/blob/master/project/PACKAGERS.md#optional-dependencies
78 +RDEPEND="
79 + ${CDEPEND}
80 + >=net-firewall/iptables-1.4
81 + sys-process/procps
82 + >=dev-vcs/git-1.7
83 + >=app-arch/xz-utils-4.9
84 + dev-libs/libltdl
85 + ~app-emulation/containerd-1.1.2
86 + ~app-emulation/runc-1.0.0_rc5_p20180509[apparmor?,seccomp?]
87 + ~app-emulation/docker-proxy-0.8.0_p20180626
88 + container-init? ( >=sys-process/tini-0.18.0[static] )
89 +"
90 +
91 +RESTRICT="installsources strip"
92 +
93 +S="${WORKDIR}/${P}/src/${EGO_PN}"
94 +
95 +PATCHES=( "${FILESDIR}"/bsc1073877-docker-apparmor-add-signal-r2.patch )
96 +
97 +# see "contrib/check-config.sh" from upstream's sources
98 +CONFIG_CHECK="
99 + ~NAMESPACES ~NET_NS ~PID_NS ~IPC_NS ~UTS_NS
100 + ~CGROUPS ~CGROUP_CPUACCT ~CGROUP_DEVICE ~CGROUP_FREEZER ~CGROUP_SCHED ~CPUSETS ~MEMCG
101 + ~KEYS
102 + ~VETH ~BRIDGE ~BRIDGE_NETFILTER
103 + ~NF_NAT_IPV4 ~IP_NF_FILTER ~IP_NF_TARGET_MASQUERADE
104 + ~NETFILTER_XT_MATCH_ADDRTYPE ~NETFILTER_XT_MATCH_CONNTRACK ~NETFILTER_XT_MATCH_IPVS
105 + ~IP_NF_NAT ~NF_NAT ~NF_NAT_NEEDED
106 + ~POSIX_MQUEUE
107 +
108 + ~USER_NS
109 + ~SECCOMP
110 + ~CGROUP_PIDS
111 + ~MEMCG_SWAP ~MEMCG_SWAP_ENABLED
112 +
113 + ~BLK_CGROUP ~BLK_DEV_THROTTLING ~IOSCHED_CFQ ~CFQ_GROUP_IOSCHED
114 + ~CGROUP_PERF
115 + ~CGROUP_HUGETLB
116 + ~NET_CLS_CGROUP
117 + ~CFS_BANDWIDTH ~FAIR_GROUP_SCHED ~RT_GROUP_SCHED
118 + ~IP_VS ~IP_VS_PROTO_TCP ~IP_VS_PROTO_UDP ~IP_VS_NFCT ~IP_VS_RR
119 +
120 + ~VXLAN
121 + ~CRYPTO ~CRYPTO_AEAD ~CRYPTO_GCM ~CRYPTO_SEQIV ~CRYPTO_GHASH ~XFRM_ALGO ~XFRM_USER
122 + ~IPVLAN
123 + ~MACVLAN ~DUMMY
124 +"
125 +
126 +ERROR_KEYS="CONFIG_KEYS: is mandatory"
127 +ERROR_MEMCG_SWAP="CONFIG_MEMCG_SWAP: is required if you wish to limit swap usage of containers"
128 +ERROR_RESOURCE_COUNTERS="CONFIG_RESOURCE_COUNTERS: is optional for container statistics gathering"
129 +
130 +ERROR_BLK_CGROUP="CONFIG_BLK_CGROUP: is optional for container statistics gathering"
131 +ERROR_IOSCHED_CFQ="CONFIG_IOSCHED_CFQ: is optional for container statistics gathering"
132 +ERROR_CGROUP_PERF="CONFIG_CGROUP_PERF: is optional for container statistics gathering"
133 +ERROR_CFS_BANDWIDTH="CONFIG_CFS_BANDWIDTH: is optional for container statistics gathering"
134 +ERROR_XFRM_ALGO="CONFIG_XFRM_ALGO: is optional for secure networks"
135 +ERROR_XFRM_USER="CONFIG_XFRM_USER: is optional for secure networks"
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 + if kernel_is le 3 18; then
145 + CONFIG_CHECK+="
146 + ~RESOURCE_COUNTERS
147 + "
148 + fi
149 +
150 + if kernel_is le 3 13; then
151 + CONFIG_CHECK+="
152 + ~NETPRIO_CGROUP
153 + "
154 + else
155 + CONFIG_CHECK+="
156 + ~CGROUP_NET_PRIO
157 + "
158 + fi
159 +
160 + if kernel_is lt 4 5; then
161 + CONFIG_CHECK+="
162 + ~MEMCG_KMEM
163 + "
164 + ERROR_MEMCG_KMEM="CONFIG_MEMCG_KMEM: is optional"
165 + fi
166 +
167 + if kernel_is lt 4 7; then
168 + CONFIG_CHECK+="
169 + ~DEVPTS_MULTIPLE_INSTANCES
170 + "
171 + fi
172 +
173 + if use aufs; then
174 + CONFIG_CHECK+="
175 + ~AUFS_FS
176 + ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
177 + "
178 + ERROR_AUFS_FS="CONFIG_AUFS_FS: is required to be set if and only if aufs-sources are used instead of aufs4/aufs3"
179 + fi
180 +
181 + if use btrfs; then
182 + CONFIG_CHECK+="
183 + ~BTRFS_FS
184 + ~BTRFS_FS_POSIX_ACL
185 + "
186 + fi
187 +
188 + if use device-mapper; then
189 + CONFIG_CHECK+="
190 + ~BLK_DEV_DM ~DM_THIN_PROVISIONING ~EXT4_FS ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
191 + "
192 + fi
193 +
194 + if use overlay; then
195 + CONFIG_CHECK+="
196 + ~OVERLAY_FS ~EXT4_FS_SECURITY ~EXT4_FS_POSIX_ACL
197 + "
198 + fi
199 +
200 + linux-info_pkg_setup
201 +
202 + # create docker group for the code checking for it in /etc/group
203 + enewgroup docker
204 +}
205 +
206 +src_compile() {
207 + export GOPATH="${WORKDIR}/${P}"
208 +
209 + # setup CFLAGS and LDFLAGS for separate build target
210 + # see https://github.com/tianon/docker-overlay/pull/10
211 + export CGO_CFLAGS="-I${ROOT}/usr/include"
212 + export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
213 +
214 + # if we're building from a tarball, we need the GITCOMMIT value
215 + [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
216 +
217 + # fake golang layout
218 + ln -s docker-ce/components/engine ../docker || die
219 + ln -s docker-ce/components/cli ../cli || die
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 pkcs11 seccomp; do
230 + if use $tag; then
231 + DOCKER_BUILDTAGS+=" $tag"
232 + fi
233 + done
234 +
235 + pushd components/engine || die
236 +
237 + if use hardened; then
238 + sed -i "s/EXTLDFLAGS_STATIC='/&-fno-PIC /" hack/make.sh || die
239 + grep -q -- '-fno-PIC' hack/make.sh || die 'hardened sed failed'
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 + fi
244 +
245 + # build daemon
246 + VERSION="$(cat ../../VERSION)" \
247 + ./hack/make.sh dynbinary || die 'dynbinary failed'
248 +
249 + popd || die # components/engine
250 +
251 + pushd components/cli || die
252 +
253 + # build cli
254 + emake \
255 + LDFLAGS="$(usex hardened '-extldflags -fno-PIC' '')" \
256 + VERSION="$(cat ../../VERSION)" \
257 + GITCOMMIT="${DOCKER_GITCOMMIT}" \
258 + DISABLE_WARN_OUTSIDE_CONTAINER=1 \
259 + dynbinary || die
260 +
261 + # build man pages
262 + go build -o gen-manpages github.com/docker/cli/man || die
263 + ./gen-manpages --root . --target ./man/man1 || die
264 + ./man/md2man-all.sh -q || die
265 + rm gen-manpages || die
266 + # see "components/cli/scripts/docs/generate-man.sh" (which also does "go get" for go-md2man)
267 +
268 + popd || die # components/cli
269 +}
270 +
271 +src_install() {
272 + dosym containerd /usr/bin/docker-containerd
273 + dosym containerd-shim /usr/bin/docker-containerd-shim
274 + dosym runc /usr/bin/docker-runc
275 + use container-init && dosym tini /usr/bin/docker-init
276 +
277 + pushd components/engine || die
278 + newbin "$(readlink -f bundles/latest/dynbinary-daemon/dockerd)" dockerd
279 +
280 + newinitd contrib/init/openrc/docker.initd docker
281 + newconfd contrib/init/openrc/docker.confd docker
282 +
283 + systemd_dounit contrib/init/systemd/docker.{service,socket}
284 +
285 + udev_dorules contrib/udev/*.rules
286 +
287 + dodoc AUTHORS CONTRIBUTING.md CHANGELOG.md NOTICE README.md
288 + dodoc -r docs/*
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 + popd || die # components/engine
298 +
299 + pushd components/cli || die
300 +
301 + newbin build/docker-* docker
302 +
303 + doman man/man*/*
304 +
305 + dobashcomp contrib/completion/bash/*
306 + insinto /usr/share/fish/vendor_completions.d/
307 + doins contrib/completion/fish/docker.fish
308 + insinto /usr/share/zsh/site-functions
309 + doins contrib/completion/zsh/_*
310 + popd || die # components/cli
311 +}
312 +
313 +pkg_postinst() {
314 + udev_reload
315 +
316 + elog
317 + elog "To use Docker, the Docker daemon must be running as root. To automatically"
318 + elog "start the Docker daemon at boot, add Docker to the default runlevel:"
319 + elog " rc-update add docker default"
320 + elog "Similarly for systemd:"
321 + elog " systemctl enable docker.service"
322 + elog
323 + elog "To use Docker as a non-root user, add yourself to the 'docker' group:"
324 + elog " usermod -aG docker youruser"
325 + elog
326 +}