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/
Date: Mon, 09 Sep 2019 02:58:15
Message-Id: 1567997861.c3ec35f78f6aae4d02478aeee3f0a7893dc7bd7f.stasibear@gentoo
1 commit: c3ec35f78f6aae4d02478aeee3f0a7893dc7bd7f
2 Author: Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 9 02:56:59 2019 +0000
4 Commit: Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 9 02:57:41 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3ec35f7
7
8 app-emulation/lxd: Upgrade to 3.16
9
10 Signed-off-by: Erik Mackdanz <stasibear <AT> gentoo.org>
11 Package-Manager: Portage-2.3.73, Repoman-2.3.17
12
13 app-emulation/lxd/Manifest | 1 +
14 app-emulation/lxd/lxd-3.16.ebuild | 265 ++++++++++++++++++++++++++++++++++++++
15 2 files changed, 266 insertions(+)
16
17 diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest
18 index ffff6a388ba..f0a03569d10 100644
19 --- a/app-emulation/lxd/Manifest
20 +++ b/app-emulation/lxd/Manifest
21 @@ -1 +1,2 @@
22 DIST lxd-3.14.tar.gz 26141949 BLAKE2B 69004501012c9a873eef77a60df7e5dba25c692224d27b02cd2d2b27533012e71bd7562cb64a17920234746e8be2819bb773365c01422c0b776dd2b7c36b69fe SHA512 3d2d4e61298fc9fde49defad776a398fcccf7639485e810173c9c7f7d939c354a9ad8112a4a631b0850f6eb54435012d289236ff61839416caf95434eb23c8ff
23 +DIST lxd-3.16.tar.gz 24863601 BLAKE2B 0087c00d86ea3f623ea31bc008176e4232bb432f5c431c288f5c5ff3e1658abe4e310509088ddc6b23d8db68f8e93997522b8a5c0b19fd243abee13e11d3deb9 SHA512 11c6c5c49ceb23c31979829937e1baad340b8920481ef5b89b2b6d0b6b05967ec1f446f8b0330c11008f6fecea077eed0858af7fe802c50b52148757584fdfb9
24
25 diff --git a/app-emulation/lxd/lxd-3.16.ebuild b/app-emulation/lxd/lxd-3.16.ebuild
26 new file mode 100644
27 index 00000000000..8c7e5f94a4d
28 --- /dev/null
29 +++ b/app-emulation/lxd/lxd-3.16.ebuild
30 @@ -0,0 +1,265 @@
31 +# Copyright 1999-2019 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +DESCRIPTION="Fast, dense and secure container management"
37 +HOMEPAGE="https://linuxcontainers.org/lxd/introduction/"
38 +
39 +LICENSE="Apache-2.0 BSD BSD-2 LGPL-3 MIT MPL-2.0"
40 +SLOT="0"
41 +KEYWORDS="~amd64"
42 +
43 +IUSE="+daemon +ipv6 +dnsmasq nls test tools"
44 +
45 +inherit autotools bash-completion-r1 linux-info systemd user
46 +
47 +SRC_URI="https://linuxcontainers.org/downloads/${PN}/${P}.tar.gz"
48 +
49 +DEPEND="
50 + dev-lang/tcl
51 + >=dev-lang/go-1.9.4
52 + dev-libs/libuv
53 + dev-libs/protobuf
54 + nls? ( sys-devel/gettext )
55 + test? (
56 + app-misc/jq
57 + net-misc/curl
58 + sys-devel/gettext
59 + )
60 +"
61 +
62 +RDEPEND="
63 + daemon? (
64 + app-arch/xz-utils
65 + >=app-emulation/lxc-2.0.7[seccomp]
66 + dev-libs/libuv
67 + dev-libs/lzo
68 + dev-util/xdelta:3
69 + dnsmasq? (
70 + net-dns/dnsmasq[dhcp,ipv6?]
71 + )
72 + net-firewall/ebtables
73 + net-firewall/iptables[ipv6?]
74 + net-libs/libnfnetlink
75 + net-libs/libnsl:0=
76 + net-misc/rsync[xattr]
77 + sys-apps/iproute2[ipv6?]
78 + sys-fs/fuse
79 + sys-fs/lxcfs
80 + sys-fs/squashfs-tools
81 + virtual/acl
82 + )
83 +"
84 +
85 +CONFIG_CHECK="
86 + ~BRIDGE
87 + ~DUMMY
88 + ~IP6_NF_NAT
89 + ~IP6_NF_TARGET_MASQUERADE
90 + ~IPV6
91 + ~IP_NF_NAT
92 + ~IP_NF_TARGET_MASQUERADE
93 + ~MACVLAN
94 + ~NETFILTER_XT_MATCH_COMMENT
95 + ~NET_IPGRE
96 + ~NET_IPGRE_DEMUX
97 + ~NET_IPIP
98 + ~NF_NAT_MASQUERADE_IPV4
99 + ~NF_NAT_MASQUERADE_IPV6
100 + ~VXLAN
101 +"
102 +
103 +ERROR_BRIDGE="BRIDGE: needed for network commands"
104 +ERROR_DUMMY="DUMMY: needed for network commands"
105 +ERROR_IP6_NF_NAT="IP6_NF_NAT: needed for network commands"
106 +ERROR_IP6_NF_TARGET_MASQUERADE="IP6_NF_TARGET_MASQUERADE: needed for network commands"
107 +ERROR_IPV6="IPV6: needed for network commands"
108 +ERROR_IP_NF_NAT="IP_NF_NAT: needed for network commands"
109 +ERROR_IP_NF_TARGET_MASQUERADE="IP_NF_TARGET_MASQUERADE: needed for network commands"
110 +ERROR_MACVLAN="MACVLAN: needed for network commands"
111 +ERROR_NETFILTER_XT_MATCH_COMMENT="NETFILTER_XT_MATCH_COMMENT: needed for network commands"
112 +ERROR_NET_IPGRE="NET_IPGRE: needed for network commands"
113 +ERROR_NET_IPGRE_DEMUX="NET_IPGRE_DEMUX: needed for network commands"
114 +ERROR_NET_IPIP="NET_IPIP: needed for network commands"
115 +ERROR_NF_NAT_MASQUERADE_IPV4="NF_NAT_MASQUERADE_IPV4: needed for network commands"
116 +ERROR_NF_NAT_MASQUERADE_IPV6="NF_NAT_MASQUERADE_IPV6: needed for network commands"
117 +ERROR_VXLAN="VXLAN: needed for network commands"
118 +
119 +EGO_PN="github.com/lxc/lxd"
120 +
121 +src_prepare() {
122 + eapply_user
123 + eapply "${FILESDIR}/de-translation-newline-1.patch"
124 +
125 + cd "${S}/_dist/deps/raft" || die "Can't cd to raft dir"
126 + # Workaround for " * ACCESS DENIED: open_wr: /dev/zfs"
127 + sed -i 's#zfs version | cut -f 2#< /sys/module/zfs/version cut -f 1#' configure.ac || die "Can't sed configure.ac for raft"
128 + eautoreconf
129 +
130 + cd "${S}/_dist/deps/dqlite" || die "Can't cd to dqlite dir"
131 + eautoreconf
132 +
133 +}
134 +
135 +src_configure() {
136 + export GOPATH="${S}/_dist"
137 + cd "${GOPATH}/deps/sqlite" || die "Can't cd to sqlite dir"
138 + econf --enable-replication --disable-amalgamation --disable-tcl --libdir="${EPREFIX}/usr/lib/lxd"
139 +
140 + cd "${GOPATH}/deps/raft" || die "Can't cd to raft dir"
141 + PKG_CONFIG_PATH="${GOPATH}/raft/" econf --libdir=${EPREFIX}/usr/lib/lxd
142 +
143 + cd "${GOPATH}/deps/dqlite" || die "Can't cd to dqlite dir"
144 + export RAFT_CFLAGS="-I${GOPATH}/deps/raft/include/"
145 + export RAFT_LIBS="${GOPATH}/deps/raft/.libs"
146 + export CO_CFLAGS="-I${GOPATH}/deps/libco/"
147 + export CO_LIBS="${GOPATH}/deps/libco/"
148 + PKG_CONFIG_PATH="${GOPATH}/sqlite/" econf --libdir=${EPREFIX}/usr/lib/lxd
149 +}
150 +
151 +src_compile() {
152 + export GOPATH="${S}/_dist"
153 +
154 + cd "${GOPATH}/deps/sqlite" || die "Can't cd to sqlite dir"
155 + emake
156 +
157 + cd "${GOPATH}/deps/raft" || die "Can't cd to raft dir"
158 + emake
159 +
160 + cd "${GOPATH}/deps/libco" || die "Can't cd to libco dir"
161 + emake
162 +
163 + cd "${GOPATH}/deps/dqlite" || die "Can't cd to dqlite dir"
164 + emake CFLAGS="-I${GOPATH}/deps/sqlite -I${GOPATH}/deps/raft/include" LDFLAGS="-L${GOPATH}/deps/sqlite -L${GOPATH}/deps/raft"
165 +
166 + # We don't use the Makefile here because it builds targets with the
167 + # assumption that `pwd` is in a deep gopath namespace, which we're not.
168 + # It's simpler to manually call "go install" than patching the Makefile.
169 + cd "${S}"
170 + go install -v -x ${EGO_PN}/lxc || die "Failed to build the client"
171 +
172 + if use daemon; then
173 +
174 + # LXD depends on a patched, bundled sqlite with replication
175 + # capabilities.
176 + export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ -I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ -I${GOPATH}/deps/libco/"
177 + export CGO_LDFLAGS="${CGO_LDFLAGS} -L${GOPATH}/deps/sqlite/.libs/ -L${GOPATH}/deps/dqlite/.libs/ -L${GOPATH}/deps/raft/.libs -L${GOPATH}/deps/libco/ -Wl,-rpath,${EPREFIX}/usr/lib/lxd"
178 + export LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}"
179 +
180 + go install -v -x -tags libsqlite3 ${EGO_PN}/lxd || die "Failed to build the daemon"
181 + fi
182 +
183 + if use tools; then
184 + go install -v -x ${EGO_PN}/fuidshift || die "Failed to build fuidshift"
185 + go install -v -x ${EGO_PN}/lxc-to-lxd || die "Failed to build lxc-to-lxd"
186 + go install -v -x ${EGO_PN}/lxd-benchmark || die "Failed to build lxd-benchmark"
187 + go install -v -x ${EGO_PN}/lxd-p2c || die "Failed to build lxd-p2c"
188 + fi
189 +
190 + use nls && emake build-mo
191 +}
192 +
193 +src_test() {
194 + if use daemon; then
195 + export GOPATH="${S}/_dist"
196 + # This is mostly a copy/paste from the Makefile's "check" rule, but
197 + # patching the Makefile to work in a non "fully-qualified" go namespace
198 + # was more complicated than this modest copy/paste.
199 + # Also: sorry, for now a network connection is needed to run tests.
200 + # Will properly bundle test dependencies later.
201 + go get -v -x github.com/rogpeppe/godeps
202 + go get -v -x github.com/remyoudompheng/go-misc/deadcode
203 + go get -v -x github.com/golang/lint/golint
204 + go test -v ${EGO_PN}/lxd
205 + else
206 + einfo "No tests to run for client-only builds"
207 + fi
208 +}
209 +
210 +src_install() {
211 + local bindir="_dist/bin"
212 + dobin ${bindir}/lxc
213 + if use daemon; then
214 +
215 + export GOPATH="${S}/_dist"
216 + cd "${GOPATH}/deps/sqlite" || die "Can't cd to sqlite dir"
217 + emake DESTDIR="${D}" install
218 +
219 + cd "${GOPATH}/deps/raft" || die "Can't cd to raft dir"
220 + emake DESTDIR="${D}" install
221 +
222 + cd "${GOPATH}/deps/libco" || die "Can't cd to libco dir"
223 + dolib.so libco.so || die "Can't install libco.so"
224 +
225 + cd "${GOPATH}/deps/dqlite" || die "Can't cd to dqlite dir"
226 + emake DESTDIR="${D}" install
227 +
228 + # Must only install libs
229 + rm "${D}/usr/bin/sqlite3" || die "Can't remove custom sqlite3 binary"
230 + rm -r "${D}/usr/include" || die "Can't remove include directory"
231 +
232 + cd "${S}" || die "Can't cd to \${S}"
233 + dosbin ${bindir}/lxd
234 + fi
235 +
236 + if use tools; then
237 + dobin ${bindir}/fuidshift
238 + dobin ${bindir}/lxc-to-lxd
239 + dobin ${bindir}/lxd-benchmark
240 + dobin ${bindir}/lxd-p2c
241 + fi
242 +
243 + if use nls; then
244 + domo po/*.mo
245 + fi
246 +
247 + if use daemon; then
248 + newinitd "${FILESDIR}"/${PN}.initd lxd
249 + newconfd "${FILESDIR}"/${PN}.confd lxd
250 +
251 + systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service
252 + fi
253 +
254 + newbashcomp scripts/bash/lxd-client lxc
255 +
256 + dodoc AUTHORS doc/*
257 +}
258 +
259 +pkg_postinst() {
260 + elog
261 + elog "Consult https://wiki.gentoo.org/wiki/LXD for more information,"
262 + elog "including a Quick Start."
263 +
264 + # The messaging below only applies to daemon installs
265 + use daemon || return 0
266 +
267 + # The control socket will be owned by (and writeable by) this group.
268 + enewgroup lxd
269 +
270 + # Ubuntu also defines an lxd user but it appears unused (the daemon
271 + # must run as root)
272 +
273 + elog
274 + elog "Though not strictly required, some features are enabled at run-time"
275 + elog "when the relevant helper programs are detected:"
276 + elog "- sys-apps/apparmor"
277 + elog "- sys-fs/btrfs-progs"
278 + elog "- sys-fs/lvm2"
279 + elog "- sys-fs/zfs"
280 + elog "- sys-process/criu"
281 + elog
282 + elog "Since these features can't be disabled at build-time they are"
283 + elog "not USE-conditional."
284 + elog
285 + elog "Be sure to add your local user to the lxd group."
286 + elog
287 + elog "Networks with bridge.mode=fan are unsupported due to requiring"
288 + elog "a patched kernel and iproute2."
289 +}
290 +
291 +# TODO:
292 +# - man page, I don't see cobra generating it
293 +# - maybe implement LXD_CLUSTER_UPDATE per
294 +# https://discuss.linuxcontainers.org/t/lxd-3-5-has-been-released/2656
295 +# EM I'm not convinced it's a good design.