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