Gentoo Archives: gentoo-commits

From: Erik Mackdanz <stasibear@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxd/, app-emulation/lxd/files/
Date: Tue, 11 Oct 2016 04:22:43
Message-Id: 1476159744.3280f0a52600244c29c9b6b943cb9f3455b387d8.stasibear@gentoo
1 commit: 3280f0a52600244c29c9b6b943cb9f3455b387d8
2 Author: Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 11 04:22:24 2016 +0000
4 Commit: Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 11 04:22:24 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3280f0a5
7
8 app-emulation/lxd: Bump to 2.4.1
9
10 Package-Manager: portage-2.3.1
11
12 app-emulation/lxd/Manifest | 1 +
13 .../lxd/files/lxd-2.4.1-dont-go-get.patch | 22 +++
14 app-emulation/lxd/files/lxd-2.4.1.confd | 27 +++
15 app-emulation/lxd/files/lxd-2.4.1.initd | 50 ++++++
16 app-emulation/lxd/lxd-2.4.1.ebuild | 195 +++++++++++++++++++++
17 5 files changed, 295 insertions(+)
18
19 diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest
20 index b4ba1ca..20f1f79 100644
21 --- a/app-emulation/lxd/Manifest
22 +++ b/app-emulation/lxd/Manifest
23 @@ -1,2 +1,3 @@
24 DIST lxd-2.2.tar.bz2 2234844 SHA256 c76b8698a9266afa5e4aec3ccaa283226cc52232e10ad376f02c4bcd000126b7 SHA512 272cd02f8533a18a51739fd2698f239cd57ae852fbf828d3dc53ed1253629808984720bde9173ae7df1f9e94389ab929b53893e7b57c2d0f6571744365c1c93a WHIRLPOOL d76c5ed9bedde8d51403a452bfc1f33bcb19d71fca79439c63f2b70bd58544ff0c05f4008f2603935dd1c63c4d0ea5c733775c723330de692fc5f6cd471d1529
25 DIST lxd-2.3.tar.bz2 2248758 SHA256 cd746b3f9682e50b7973e6175a5b48b999748face9e4b515491773ade9d754c4 SHA512 746ea9c2e9266a8482a62fc9e9fdb83f0713b0094e1b52957c5bf2fbd00f4bf1d7a0978086ab123d60ac02bd0dd1f00d46801959ced3b01308170dd7911c7bdc WHIRLPOOL f899e78bd3082ddd46dab5d09d83fe23a23aabbee09488f48ef2ff4a9f3bc41878ecb50b4223235c12962b01468c7b0124c0ae54e60d452f224824cbc89d144e
26 +DIST lxd-2.4.1.tar.bz2 2257768 SHA256 4a02c74819870be5df71227f90be4bc1b7cb90784c115c9f96a6174c8d4dcf75 SHA512 84ce4911a55d495f809a4174061577eceba0b3cd0381170a23fea91651049e43ec809494bf885b315b2d5fde7cda19ee29eed71259b88d3a789fd87c26aac3db WHIRLPOOL 70a2eb3c6b239e9d8682005134ae5c8e991b2f331685b971e1e8d09173aec8c34848527c9f893af0f937384d0f33f7a9e626f8063a00e2fa450331acf00ad7fe
27
28 diff --git a/app-emulation/lxd/files/lxd-2.4.1-dont-go-get.patch b/app-emulation/lxd/files/lxd-2.4.1-dont-go-get.patch
29 new file mode 100644
30 index 00000000..9402de5
31 --- /dev/null
32 +++ b/app-emulation/lxd/files/lxd-2.4.1-dont-go-get.patch
33 @@ -0,0 +1,22 @@
34 +--- /Makefile.orig 2016-07-11 23:34:40.299664675 +0000
35 ++++ /Makefile 2016-07-11 23:37:00.816018727 +0000
36 +@@ -12,19 +12,11 @@
37 +
38 + .PHONY: default
39 + default:
40 +- # Must a few times due to go get race
41 +- -go get -t -v -d ./...
42 +- -go get -t -v -d ./...
43 +- -go get -t -v -d ./...
44 + go install -v $(DEBUG) ./...
45 + @echo "LXD built successfully"
46 +
47 + .PHONY: client
48 + client:
49 +- # Must a few times due to go get race
50 +- -go get -t -v -d ./...
51 +- -go get -t -v -d ./...
52 +- -go get -t -v -d ./...
53 + go install -v $(DEBUG) ./lxc
54 + @echo "LXD client built successfully"
55 +
56
57 diff --git a/app-emulation/lxd/files/lxd-2.4.1.confd b/app-emulation/lxd/files/lxd-2.4.1.confd
58 new file mode 100644
59 index 00000000..3d55327
60 --- /dev/null
61 +++ b/app-emulation/lxd/files/lxd-2.4.1.confd
62 @@ -0,0 +1,27 @@
63 +# Group which owns the shared socket
64 +LXD_OPTIONS+=" --group lxd"
65 +
66 +
67 +
68 +# Enable cpu profiling into the specified file
69 +#LXD_OPTIONS+=" --cpuprofile /tmp/lxc_cpu_profile"
70 +
71 +# Enable memory profiling into the specified file
72 +#LXD_OPTIONS+=" --memprofile /tmp/lxc_mem_profile"
73 +
74 +
75 +
76 +# Enables debug mode
77 +#LXD_OPTIONS+=" --debug"
78 +
79 +# For debugging, print a complete stack trace every n seconds
80 +#LXD_OPTIONS+=" --print-goroutines-every 5"
81 +
82 +# Enables verbose mode
83 +#LXD_OPTIONS+=" -v"
84 +
85 +# Logfile to log to
86 +#LXD_OPTIONS+=" --logfile /var/log/lxd/lxd.log"
87 +
88 +# Enables syslog logging
89 +#LXD_OPTIONS+=" --syslog"
90
91 diff --git a/app-emulation/lxd/files/lxd-2.4.1.initd b/app-emulation/lxd/files/lxd-2.4.1.initd
92 new file mode 100644
93 index 00000000..c1aef37
94 --- /dev/null
95 +++ b/app-emulation/lxd/files/lxd-2.4.1.initd
96 @@ -0,0 +1,50 @@
97 +#!/sbin/openrc-run
98 +# Copyright 1999-2016 Gentoo Foundation
99 +# Distributed under the terms of the GNU General Public License v2
100 +# $Id$
101 +
102 +DAEMON=/usr/sbin/lxd
103 +PIDFILE=/run/lxd.pid
104 +
105 +extra_commands="stopall"
106 +
107 +depend() {
108 + need net
109 + use lxcfs
110 +
111 + # remove with 2.0 release
112 + need cgmanager
113 +}
114 +
115 +start() {
116 + ebegin "Starting lxd server"
117 +
118 + start-stop-daemon --start \
119 + --pidfile ${PIDFILE} \
120 + --exec ${DAEMON} \
121 + --background \
122 + --make-pidfile \
123 + -- \
124 + ${LXD_OPTIONS}
125 +
126 + eend $?
127 +}
128 +
129 +stop() {
130 + if [[ $RC_GOINGDOWN = YES ]] || [[ $RC_REBOOT = YES ]]; then
131 + stopall
132 + else
133 + ebegin "Stopping lxd service (but not containers)"
134 + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE}
135 + eend $?
136 + fi
137 +}
138 +
139 +stopall() {
140 + ebegin "Stopping lxd service and containers"
141 + if "${DAEMON}" shutdown; then
142 + /etc/init.d/lxd zap
143 + rm -f ${PIDFILE}
144 + fi
145 + eend $?
146 +}
147
148 diff --git a/app-emulation/lxd/lxd-2.4.1.ebuild b/app-emulation/lxd/lxd-2.4.1.ebuild
149 new file mode 100644
150 index 00000000..809f11a
151 --- /dev/null
152 +++ b/app-emulation/lxd/lxd-2.4.1.ebuild
153 @@ -0,0 +1,195 @@
154 +# Copyright 1999-2016 Gentoo Foundation
155 +# Distributed under the terms of the GNU General Public License v2
156 +# $Id$
157 +
158 +EAPI=6
159 +
160 +DESCRIPTION="Fast, dense and secure container management"
161 +HOMEPAGE="https://linuxcontainers.org/lxd/introduction/"
162 +EGO_PN_PARENT="github.com/lxc"
163 +EGO_PN="${EGO_PN_PARENT}/lxd"
164 +
165 +# The source is repackaged using a script at:
166 +# https://dev.gentoo.org/~stasibear/lxd_repackage.py
167 +# This is necessary because go's native package management assumes
168 +# that a build starts with checking out many git repositories, often
169 +# from HEAD. This provides no way to build the same code repeatably,
170 +# and anyway portage requires that fetching is only done from SRC_URI.
171 +# The only sane alternative I've seen is in the consul ebuild, which
172 +# is more transparent but raises other questions.
173 +SRC_URI="https://dev.gentoo.org/~stasibear/distfiles/${P}.tar.bz2"
174 +
175 +LICENSE="Apache-2.0"
176 +SLOT="0"
177 +KEYWORDS="~amd64"
178 +
179 +PLOCALES="de fr ja"
180 +IUSE="+daemon nls test"
181 +
182 +# IUSE and PLOCALES must be defined before l10n inherited
183 +inherit bash-completion-r1 golang-build l10n linux-info systemd user vcs-snapshot
184 +
185 +DEPEND="
186 + >=dev-lang/go-1.7.1
187 + dev-go/go-crypto
188 + dev-libs/protobuf
189 + nls? ( sys-devel/gettext )
190 + test? (
191 + app-misc/jq
192 + dev-db/sqlite
193 + net-misc/curl
194 + sys-devel/gettext
195 + )
196 +"
197 +
198 +RDEPEND="
199 + daemon? (
200 + app-admin/cgmanager
201 + app-arch/xz-utils
202 + app-emulation/lxc[cgmanager,seccomp]
203 + net-dns/dnsmasq[dhcp,ipv6]
204 + net-misc/rsync[xattr]
205 + sys-apps/iproute2[ipv6]
206 + sys-fs/squashfs-tools
207 + virtual/acl
208 + )
209 +"
210 +
211 +CONFIG_CHECK="
212 + ~BRIDGE
213 + ~DUMMY
214 + ~IP6_NF_NAT
215 + ~IP6_NF_TARGET_MASQUERADE
216 + ~IPV6
217 + ~IP_NF_NAT
218 + ~IP_NF_TARGET_MASQUERADE
219 + ~MACVLAN
220 + ~NETFILTER_XT_MATCH_COMMENT
221 + ~NET_IPGRE
222 + ~NET_IPGRE_DEMUX
223 + ~NET_IPIP
224 + ~NF_NAT_MASQUERADE_IPV4
225 + ~NF_NAT_MASQUERADE_IPV6
226 + ~VXLAN
227 +"
228 +
229 +ERROR_BRIDGE="BRIDGE: needed for network commands"
230 +ERROR_DUMMY="DUMMY: needed for network commands"
231 +ERROR_IP6_NF_NAT="IP6_NF_NAT: needed for network commands"
232 +ERROR_IP6_NF_TARGET_MASQUERADE="IP6_NF_TARGET_MASQUERADE: needed for network commands"
233 +ERROR_IPV6="IPV6: needed for network commands"
234 +ERROR_IP_NF_NAT="IP_NF_NAT: needed for network commands"
235 +ERROR_IP_NF_TARGET_MASQUERADE="IP_NF_TARGET_MASQUERADE: needed for network commands"
236 +ERROR_MACVLAN="MACVLAN: needed for network commands"
237 +ERROR_NETFILTER_XT_MATCH_COMMENT="NETFILTER_XT_MATCH_COMMENT: needed for network commands"
238 +ERROR_NET_IPGRE="NET_IPGRE: needed for network commands"
239 +ERROR_NET_IPGRE_DEMUX="NET_IPGRE_DEMUX: needed for network commands"
240 +ERROR_NET_IPIP="NET_IPIP: needed for network commands"
241 +ERROR_NF_NAT_MASQUERADE_IPV4="NF_NAT_MASQUERADE_IPV4: needed for network commands"
242 +ERROR_NF_NAT_MASQUERADE_IPV6="NF_NAT_MASQUERADE_IPV6: needed for network commands"
243 +ERROR_VXLAN="VXLAN: needed for network commands"
244 +
245 +PATCHES=("${FILESDIR}/${P}-dont-go-get.patch")
246 +
247 +# KNOWN ISSUES:
248 +# - Translations may not work. I've been unsuccessful in forcing
249 +# localized output. Anyway, upstream (Canonical) doesn't install the
250 +# message files.
251 +
252 +src_prepare() {
253 + cd "${S}/src/${EGO_PN}" || die "Failed to change to deep src dir"
254 +
255 + default_src_prepare
256 +
257 + tmpgoroot="${T}/goroot"
258 + mkdir -p "$tmpgoroot" || die "Failed to create temporary GOROOT"
259 + cp -sR "$(get_golibdir_gopath)"/* "${tmpgoroot}" || die "Failed to copy files to temporary GOROOT"
260 +
261 + # Warn on unhandled locale changes
262 + l10n_find_plocales_changes po "" .po
263 +}
264 +
265 +src_compile() {
266 + golang-build_src_compile
267 +
268 + cd "${S}/src/${EGO_PN}" || die "Failed to change to deep src dir"
269 +
270 + tmpgoroot="${T}/goroot"
271 + if use daemon; then
272 + # Build binaries
273 + GOPATH="${S}:${tmpgoroot}" emake
274 + else
275 + # build client tool
276 + GOPATH="${S}:${tmpgoroot}" emake client
277 + fi
278 +
279 + use nls && emake build-mo
280 +}
281 +
282 +src_test() {
283 + if use daemon; then
284 + # Go native tests should succeed
285 + golang-build_src_test
286 + fi
287 +}
288 +
289 +src_install() {
290 + # Installs all src,pkg to /usr/lib/go-gentoo
291 + golang-build_src_install
292 +
293 + cd "${S}"
294 + dobin bin/lxc
295 + use daemon && dosbin bin/lxd
296 +
297 + cd "src/${EGO_PN}"
298 +
299 + if use nls; then
300 + for lingua in ${PLOCALES}; do
301 + if use linguas_${lingua}; then
302 + domo po/${lingua}.mo
303 + fi
304 + done
305 + fi
306 +
307 + if use daemon; then
308 + newinitd "${FILESDIR}"/${P}.initd lxd
309 + newconfd "${FILESDIR}"/${P}.confd lxd
310 +
311 + systemd_dounit "${FILESDIR}"/lxd.service
312 + fi
313 +
314 + newbashcomp config/bash/lxd-client lxc
315 +
316 + dodoc AUTHORS CONTRIBUTING.md README.md doc/*
317 +}
318 +
319 +pkg_postinst() {
320 + einfo
321 + einfo "Consult https://wiki.gentoo.org/wiki/LXD for more information,"
322 + einfo "including a Quick Start."
323 +
324 + # The messaging below only applies to daemon installs
325 + use daemon || return 0
326 +
327 + # The control socket will be owned by (and writeable by) this group.
328 + enewgroup lxd
329 +
330 + # Ubuntu also defines an lxd user but it appears unused (the daemon
331 + # must run as root)
332 +
333 + einfo
334 + einfo "Though not strictly required, some features are enabled at run-time"
335 + einfo "when the relevant helper programs are detected:"
336 + einfo "- sys-apps/apparmor"
337 + einfo "- sys-fs/btrfs-progs"
338 + einfo "- sys-fs/lvm2"
339 + einfo "- sys-fs/lxcfs"
340 + einfo "- sys-fs/zfs"
341 + einfo "- sys-process/criu"
342 + einfo
343 + einfo "Since these features can't be disabled at build-time they are"
344 + einfo "not USE-conditional."
345 + einfo
346 + einfo "Networks with bridge.mode=fan are unsupported due to requiring"
347 + einfo "a patched kernel and iproute2."
348 +}