1 |
commit: 7f091e8001253dfcd84e81d263d7db319b63aabf |
2 |
Author: Erik Mackdanz <stasibear <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 19 22:20:07 2018 +0000 |
4 |
Commit: Erik Mackdanz <stasibear <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Aug 19 22:20:07 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f091e80 |
7 |
|
8 |
app-emulation/lxd: Bump to version 3.4 |
9 |
|
10 |
Add some dependencies used by upstream, fully build custom sqlite, |
11 |
move tools to IUSE. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/show_bug.cgi?id=628346 |
14 |
Package-Manager: Portage-2.3.46, Repoman-2.3.10 |
15 |
|
16 |
app-emulation/lxd/Manifest | 1 + |
17 |
app-emulation/lxd/files/lxd.initd.1 | 47 ++++++++ |
18 |
app-emulation/lxd/lxd-3.4.ebuild | 232 ++++++++++++++++++++++++++++++++++++ |
19 |
app-emulation/lxd/metadata.xml | 5 +- |
20 |
4 files changed, 284 insertions(+), 1 deletion(-) |
21 |
|
22 |
diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest |
23 |
index a59667370be..12ef79ec012 100644 |
24 |
--- a/app-emulation/lxd/Manifest |
25 |
+++ b/app-emulation/lxd/Manifest |
26 |
@@ -45,3 +45,4 @@ DIST lxd-2.21.tar.gz 882352 BLAKE2B 80542bcc03c05667ee0207dfbfd2bf41c5a6ef69178a |
27 |
DIST lxd-3.1.tar.gz 27979442 BLAKE2B 0b74e3f76a7ab835b042b52b469a6fe11e7077d567e0658d13fab2192fd25d99518d65ba319c981a2e4677319e280cccae26f70ef99e9911264dc028ca5628fd SHA512 61f64d08dd80f7f676f386912f4dfc0d0af38cce0287de7865123b9da667b54ab91d22b76ffe03480e04ae0fbd8dc837d7d519d0e34409377c3d7e6624bf636c |
28 |
DIST lxd-3.2.tar.gz 28183660 BLAKE2B 9aabc9fd0bd66d3b4e0178448a65ca39c69e4e7a14d01309e0e023501de1c17b2b7887a9da5b84fcfde27db3f521cce3451beace9955232da9bd5e5136bc0043 SHA512 82c37e87d75e328a29b1f2876a24fedec43a253bb72f3ea55fa9cdb928d11947eda723a01e758f90ef77ed4492f86ec6dd5f1f88240d05e771d926dfdc9888fb |
29 |
DIST lxd-3.3.tar.gz 28414680 BLAKE2B 7f3eecf400761548935e6e3c81d894379cd667ffbe6d8ef67a7dd3ad4f1c13846f524fcefc4cdc306674fb990706bda0b2c4ef390f320c41561fa86cf610586c SHA512 ed5d792c1080f2be7f48f34051fbfa28d138b4ccb5405edb13cd630776ec34312da491a1881f77dddbe1a121e589b44952e73ce1e61f2cba72243f3b8f4c0177 |
30 |
+DIST lxd-3.4.tar.gz 24313641 BLAKE2B 6f2db8a690474d020a0d43366e940760c0886c8af60e17ecc6bf1f9747d8454d09d619b723b1794bec503dda82028f7d81edc2d0c33216cbad9c810f2657198d SHA512 f041878fcfd2b45f594d97e748272d44c517f28e181861a604bef23f858c4bd59cc93ac56c24cce6d353743428b66940f11df268ff9f66e83a5c8f1fb95dc3aa |
31 |
|
32 |
diff --git a/app-emulation/lxd/files/lxd.initd.1 b/app-emulation/lxd/files/lxd.initd.1 |
33 |
new file mode 100644 |
34 |
index 00000000000..b6d3cd4eb26 |
35 |
--- /dev/null |
36 |
+++ b/app-emulation/lxd/files/lxd.initd.1 |
37 |
@@ -0,0 +1,47 @@ |
38 |
+#!/sbin/openrc-run |
39 |
+# Copyright 1999-2018 Gentoo Foundation |
40 |
+# Distributed under the terms of the GNU General Public License v2 |
41 |
+ |
42 |
+DAEMON=/usr/sbin/lxd |
43 |
+PIDFILE=/run/lxd.pid |
44 |
+ |
45 |
+extra_commands="stopall" |
46 |
+ |
47 |
+depend() { |
48 |
+ need net |
49 |
+ use lxcfs |
50 |
+} |
51 |
+ |
52 |
+start() { |
53 |
+ ebegin "Starting lxd service" |
54 |
+ |
55 |
+ start-stop-daemon --start \ |
56 |
+ --pidfile ${PIDFILE} \ |
57 |
+ --exec ${DAEMON} \ |
58 |
+ --background \ |
59 |
+ --make-pidfile \ |
60 |
+ --env LD_LIBRARY_PATH="/usr/lib/lxd" \ |
61 |
+ -- \ |
62 |
+ ${LXD_OPTIONS} |
63 |
+ |
64 |
+ eend $? |
65 |
+} |
66 |
+ |
67 |
+stop() { |
68 |
+ if [ "$RC_GOINGDOWN" = "YES" ] || [ "$RC_REBOOT" = "YES" ]; then |
69 |
+ stopall |
70 |
+ else |
71 |
+ ebegin "Stopping lxd service (but not containers)" |
72 |
+ start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} |
73 |
+ eend $? |
74 |
+ fi |
75 |
+} |
76 |
+ |
77 |
+stopall() { |
78 |
+ ebegin "Stopping lxd service and containers" |
79 |
+ if "${DAEMON}" shutdown; then |
80 |
+ /etc/init.d/lxd zap |
81 |
+ rm -f ${PIDFILE} |
82 |
+ fi |
83 |
+ eend $? |
84 |
+} |
85 |
|
86 |
diff --git a/app-emulation/lxd/lxd-3.4.ebuild b/app-emulation/lxd/lxd-3.4.ebuild |
87 |
new file mode 100644 |
88 |
index 00000000000..32dc9abda4a |
89 |
--- /dev/null |
90 |
+++ b/app-emulation/lxd/lxd-3.4.ebuild |
91 |
@@ -0,0 +1,232 @@ |
92 |
+# Copyright 1999-2018 Gentoo Foundation |
93 |
+# Distributed under the terms of the GNU General Public License v2 |
94 |
+ |
95 |
+EAPI=6 |
96 |
+ |
97 |
+DESCRIPTION="Fast, dense and secure container management" |
98 |
+HOMEPAGE="https://linuxcontainers.org/lxd/introduction/" |
99 |
+ |
100 |
+LICENSE="Apache-2.0 BSD BSD-2 LGPL-3 MIT MPL-2.0" |
101 |
+SLOT="0" |
102 |
+KEYWORDS="~amd64" |
103 |
+ |
104 |
+IUSE="+daemon +ipv6 +dnsmasq nls test tools" |
105 |
+ |
106 |
+inherit autotools bash-completion-r1 linux-info systemd user |
107 |
+ |
108 |
+SRC_URI="https://linuxcontainers.org/downloads/${PN}/${P}.tar.gz" |
109 |
+ |
110 |
+DEPEND=" |
111 |
+ dev-lang/tcl |
112 |
+ >=dev-lang/go-1.9.4 |
113 |
+ dev-libs/protobuf |
114 |
+ nls? ( sys-devel/gettext ) |
115 |
+ test? ( |
116 |
+ app-misc/jq |
117 |
+ net-misc/curl |
118 |
+ sys-devel/gettext |
119 |
+ ) |
120 |
+" |
121 |
+ |
122 |
+RDEPEND=" |
123 |
+ daemon? ( |
124 |
+ app-arch/xz-utils |
125 |
+ >=app-emulation/lxc-2.0.7[seccomp] |
126 |
+ dev-libs/lzo |
127 |
+ dev-util/xdelta:3 |
128 |
+ dnsmasq? ( |
129 |
+ net-dns/dnsmasq[dhcp,ipv6?] |
130 |
+ ) |
131 |
+ net-firewall/ebtables |
132 |
+ net-firewall/iptables[ipv6?] |
133 |
+ net-libs/libnfnetlink |
134 |
+ net-misc/rsync[xattr] |
135 |
+ sys-apps/iproute2[ipv6?] |
136 |
+ sys-fs/fuse |
137 |
+ sys-fs/lxcfs |
138 |
+ sys-fs/squashfs-tools |
139 |
+ virtual/acl |
140 |
+ ) |
141 |
+" |
142 |
+ |
143 |
+CONFIG_CHECK=" |
144 |
+ ~BRIDGE |
145 |
+ ~DUMMY |
146 |
+ ~IP6_NF_NAT |
147 |
+ ~IP6_NF_TARGET_MASQUERADE |
148 |
+ ~IPV6 |
149 |
+ ~IP_NF_NAT |
150 |
+ ~IP_NF_TARGET_MASQUERADE |
151 |
+ ~MACVLAN |
152 |
+ ~NETFILTER_XT_MATCH_COMMENT |
153 |
+ ~NET_IPGRE |
154 |
+ ~NET_IPGRE_DEMUX |
155 |
+ ~NET_IPIP |
156 |
+ ~NF_NAT_MASQUERADE_IPV4 |
157 |
+ ~NF_NAT_MASQUERADE_IPV6 |
158 |
+ ~VXLAN |
159 |
+" |
160 |
+ |
161 |
+ERROR_BRIDGE="BRIDGE: needed for network commands" |
162 |
+ERROR_DUMMY="DUMMY: needed for network commands" |
163 |
+ERROR_IP6_NF_NAT="IP6_NF_NAT: needed for network commands" |
164 |
+ERROR_IP6_NF_TARGET_MASQUERADE="IP6_NF_TARGET_MASQUERADE: needed for network commands" |
165 |
+ERROR_IPV6="IPV6: needed for network commands" |
166 |
+ERROR_IP_NF_NAT="IP_NF_NAT: needed for network commands" |
167 |
+ERROR_IP_NF_TARGET_MASQUERADE="IP_NF_TARGET_MASQUERADE: needed for network commands" |
168 |
+ERROR_MACVLAN="MACVLAN: needed for network commands" |
169 |
+ERROR_NETFILTER_XT_MATCH_COMMENT="NETFILTER_XT_MATCH_COMMENT: needed for network commands" |
170 |
+ERROR_NET_IPGRE="NET_IPGRE: needed for network commands" |
171 |
+ERROR_NET_IPGRE_DEMUX="NET_IPGRE_DEMUX: needed for network commands" |
172 |
+ERROR_NET_IPIP="NET_IPIP: needed for network commands" |
173 |
+ERROR_NF_NAT_MASQUERADE_IPV4="NF_NAT_MASQUERADE_IPV4: needed for network commands" |
174 |
+ERROR_NF_NAT_MASQUERADE_IPV6="NF_NAT_MASQUERADE_IPV6: needed for network commands" |
175 |
+ERROR_VXLAN="VXLAN: needed for network commands" |
176 |
+ |
177 |
+EGO_PN="github.com/lxc/lxd" |
178 |
+ |
179 |
+src_prepare() { |
180 |
+ eapply_user |
181 |
+ eapply "${FILESDIR}/de-translation-newline.patch" |
182 |
+ |
183 |
+ cd "${S}/dist/dqlite" || die "Can't cd to dqlite dir" |
184 |
+ eautoreconf |
185 |
+} |
186 |
+ |
187 |
+src_configure() { |
188 |
+ export GOPATH="${S}/dist" |
189 |
+ cd "${GOPATH}/sqlite" || die "Can't cd to sqlite dir" |
190 |
+ econf --enable-replication --disable-amalgamation --disable-tcl --libdir=/usr/lib/lxd |
191 |
+ |
192 |
+ cd "${GOPATH}/dqlite" || die "Can't cd to dqlite dir" |
193 |
+ PKG_CONFIG_PATH="${GOPATH}/sqlite/" econf --libdir=/usr/lib/lxd |
194 |
+} |
195 |
+ |
196 |
+src_compile() { |
197 |
+ export GOPATH="${S}/dist" |
198 |
+ |
199 |
+ cd "${GOPATH}/sqlite" || die "Can't cd to sqlite dir" |
200 |
+ emake |
201 |
+ |
202 |
+ cd "${GOPATH}/dqlite" || die "Can't cd to dqlite dir" |
203 |
+ emake CFLAGS="-I${GOPATH}/sqlite" |
204 |
+ |
205 |
+ # We don't use the Makefile here because it builds targets with the |
206 |
+ # assumption that `pwd` is in a deep gopath namespace, which we're not. |
207 |
+ # It's simpler to manually call "go install" than patching the Makefile. |
208 |
+ cd "${S}" |
209 |
+ go install -v -x ${EGO_PN}/lxc || die "Failed to build the client" |
210 |
+ |
211 |
+ if use daemon; then |
212 |
+ |
213 |
+ # LXD depends on a patched, bundled sqlite with replication |
214 |
+ # capabilities. |
215 |
+ export CGO_CFLAGS="-I${GOPATH}/sqlite/ -I${GOPATH}/dqlite/include/" |
216 |
+ export CGO_LDFLAGS="-L${GOPATH}/sqlite/.libs/ -L${GOPATH}/dqlite/.libs/" |
217 |
+ export LD_LIBRARY_PATH="${GOPATH}/sqlite/.libs/:${GOPATH}/dqlite/.libs/" |
218 |
+ |
219 |
+ go install -v -x -tags libsqlite3 ${EGO_PN}/lxd || die "Failed to build the daemon" |
220 |
+ fi |
221 |
+ |
222 |
+ if use tools; then |
223 |
+ go install -v -x ${EGO_PN}/fuidshift || die "Failed to build fuidshift" |
224 |
+ go install -v -x ${EGO_PN}/lxc-to-lxd || die "Failed to build lxc-to-lxd" |
225 |
+ go install -v -x ${EGO_PN}/lxd-benchmark || die "Failed to build lxd-benchmark" |
226 |
+ fi |
227 |
+ |
228 |
+ use nls && emake build-mo |
229 |
+} |
230 |
+ |
231 |
+src_test() { |
232 |
+ if use daemon; then |
233 |
+ export GOPATH="${S}/dist" |
234 |
+ # This is mostly a copy/paste from the Makefile's "check" rule, but |
235 |
+ # patching the Makefile to work in a non "fully-qualified" go namespace |
236 |
+ # was more complicated than this modest copy/paste. |
237 |
+ # Also: sorry, for now a network connection is needed to run tests. |
238 |
+ # Will properly bundle test dependencies later. |
239 |
+ go get -v -x github.com/rogpeppe/godeps |
240 |
+ go get -v -x github.com/remyoudompheng/go-misc/deadcode |
241 |
+ go get -v -x github.com/golang/lint/golint |
242 |
+ go test -v ${EGO_PN}/lxd |
243 |
+ else |
244 |
+ einfo "No tests to run for client-only builds" |
245 |
+ fi |
246 |
+} |
247 |
+ |
248 |
+src_install() { |
249 |
+ local bindir="dist/bin" |
250 |
+ dobin ${bindir}/lxc |
251 |
+ if use daemon; then |
252 |
+ |
253 |
+ export GOPATH="${S}/dist" |
254 |
+ cd "${GOPATH}/sqlite" || die "Can't cd to sqlite dir" |
255 |
+ emake DESTDIR="${D}" install |
256 |
+ |
257 |
+ cd "${GOPATH}/dqlite" || die "Can't cd to dqlite dir" |
258 |
+ emake DESTDIR="${D}" install |
259 |
+ |
260 |
+ # Must only install libs |
261 |
+ rm "${D}/usr/bin/sqlite3" || die "Can't remove custom sqlite3 binary" |
262 |
+ rm -r "${D}/usr/include" || die "Can't remove include directory" |
263 |
+ |
264 |
+ cd "${S}" || die "Can't cd to \${S}" |
265 |
+ dosbin ${bindir}/lxd |
266 |
+ fi |
267 |
+ |
268 |
+ if use tools; then |
269 |
+ dobin ${bindir}/fuidshift |
270 |
+ dobin ${bindir}/lxc-to-lxd |
271 |
+ dobin ${bindir}/lxd-benchmark |
272 |
+ fi |
273 |
+ |
274 |
+ if use nls; then |
275 |
+ domo po/*.mo |
276 |
+ fi |
277 |
+ |
278 |
+ if use daemon; then |
279 |
+ newinitd "${FILESDIR}"/${PN}.initd.1 lxd |
280 |
+ newconfd "${FILESDIR}"/${PN}.confd.1 lxd |
281 |
+ |
282 |
+ systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service |
283 |
+ fi |
284 |
+ |
285 |
+ newbashcomp scripts/bash/lxd-client lxc |
286 |
+ |
287 |
+ dodoc AUTHORS doc/* |
288 |
+} |
289 |
+ |
290 |
+pkg_postinst() { |
291 |
+ elog |
292 |
+ elog "Consult https://wiki.gentoo.org/wiki/LXD for more information," |
293 |
+ elog "including a Quick Start." |
294 |
+ |
295 |
+ # The messaging below only applies to daemon installs |
296 |
+ use daemon || return 0 |
297 |
+ |
298 |
+ # The control socket will be owned by (and writeable by) this group. |
299 |
+ enewgroup lxd |
300 |
+ |
301 |
+ # Ubuntu also defines an lxd user but it appears unused (the daemon |
302 |
+ # must run as root) |
303 |
+ |
304 |
+ elog |
305 |
+ elog "Though not strictly required, some features are enabled at run-time" |
306 |
+ elog "when the relevant helper programs are detected:" |
307 |
+ elog "- sys-apps/apparmor" |
308 |
+ elog "- sys-fs/btrfs-progs" |
309 |
+ elog "- sys-fs/lvm2" |
310 |
+ elog "- sys-fs/zfs" |
311 |
+ elog "- sys-process/criu" |
312 |
+ elog |
313 |
+ elog "Since these features can't be disabled at build-time they are" |
314 |
+ elog "not USE-conditional." |
315 |
+ elog |
316 |
+ elog "Be sure to add your local user to the lxd group." |
317 |
+ elog |
318 |
+ elog "Networks with bridge.mode=fan are unsupported due to requiring" |
319 |
+ elog "a patched kernel and iproute2." |
320 |
+} |
321 |
+ |
322 |
+# TODO: |
323 |
+# - man page, I don't see cobra generating it |
324 |
|
325 |
diff --git a/app-emulation/lxd/metadata.xml b/app-emulation/lxd/metadata.xml |
326 |
index de08da5ec7d..3896143698f 100644 |
327 |
--- a/app-emulation/lxd/metadata.xml |
328 |
+++ b/app-emulation/lxd/metadata.xml |
329 |
@@ -27,7 +27,10 @@ |
330 |
Build the system daemon, not just the client tool |
331 |
</flag> |
332 |
<flag name="dnsmasq"> |
333 |
- Depend on dnsmasq to provide DHCP and DNS. |
334 |
+ Depend on dnsmasq to provide DHCP and DNS |
335 |
+ </flag> |
336 |
+ <flag name="tools"> |
337 |
+ Build and install optional tools |
338 |
</flag> |
339 |
</use> |
340 |
</pkgmetadata> |