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