Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/lxd/
Date: Fri, 26 Jun 2020 08:13:21
Message-Id: 1593159182.38736cb4eba180269edac353c4120c4e645db242.juippis@gentoo
1 commit: 38736cb4eba180269edac353c4120c4e645db242
2 Author: Joonas Niilola <juippis <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 26 08:11:46 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 26 08:13:02 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38736cb4
7
8 app-emulation/lxd: 4.0.2 bump
9
10 - update kernel config checks, #703874
11
12 Closes: https://bugs.gentoo.org/703874
13 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
14
15 app-emulation/lxd/Manifest | 2 +-
16 app-emulation/lxd/lxd-4.0.2.ebuild | 204 +++++++++++++++++++++++++++++++++++++
17 2 files changed, 205 insertions(+), 1 deletion(-)
18
19 diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest
20 index f5bd47450bf..621644c18ae 100644
21 --- a/app-emulation/lxd/Manifest
22 +++ b/app-emulation/lxd/Manifest
23 @@ -1,2 +1,2 @@
24 -DIST lxd-3.14.tar.gz 26141949 BLAKE2B 69004501012c9a873eef77a60df7e5dba25c692224d27b02cd2d2b27533012e71bd7562cb64a17920234746e8be2819bb773365c01422c0b776dd2b7c36b69fe SHA512 3d2d4e61298fc9fde49defad776a398fcccf7639485e810173c9c7f7d939c354a9ad8112a4a631b0850f6eb54435012d289236ff61839416caf95434eb23c8ff
25 DIST lxd-4.0.1.tar.gz 25027762 BLAKE2B 1154a427558ad5eda62b63501a2f62a5c3a1b740fac061432b06a1034b75cb906f38d6c43e8215cab8ae0bed328d75a7612c1bb7af3272cdbe3f93235d5bb920 SHA512 1f47f8239cc1d3425fc4cd075487678e219e94deddec10f52a1cd18fbdc0515f54b67552e7b41d0052803c317a861b34cfc83a25776eae7b9673b5c5fd50d70f
26 +DIST lxd-4.0.2.tar.gz 25350601 BLAKE2B 2abecb61759a1a717960671516157dc7b7a36865ecdbcec1f211e5b653b2b4afc41932a4a289430de0dd4ac1e2c777de471ab26e31dbf2b8d1855f67d03886ad SHA512 6c1c668055e9677850f24e142e6741cb6b5aa8d4d9cce29af566e8090c28e04b4baf973f486aef28b7f6b34be5b9ab9bb45e77956879ff7feff6bec8e4db3077
27
28 diff --git a/app-emulation/lxd/lxd-4.0.2.ebuild b/app-emulation/lxd/lxd-4.0.2.ebuild
29 new file mode 100644
30 index 00000000000..8317a5bc6fb
31 --- /dev/null
32 +++ b/app-emulation/lxd/lxd-4.0.2.ebuild
33 @@ -0,0 +1,204 @@
34 +# Copyright 1999-2020 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +inherit autotools bash-completion-r1 eutils linux-info systemd
40 +
41 +DESCRIPTION="Fast, dense and secure container management"
42 +HOMEPAGE="https://linuxcontainers.org/lxd/introduction/ https://github.com/lxc/lxd"
43 +SRC_URI="https://linuxcontainers.org/downloads/${PN}/${P}.tar.gz"
44 +
45 +# Needs to include licenses for all bundled programs and libraries.
46 +LICENSE="Apache-2.0 BSD BSD-2 LGPL-3 MIT MPL-2.0"
47 +SLOT="0"
48 +KEYWORDS="~amd64"
49 +IUSE="+ipv6 nls"
50 +
51 +DEPEND="app-arch/xz-utils
52 + >=app-emulation/lxc-3.0.0[seccomp]
53 + dev-lang/tcl
54 + dev-libs/libuv
55 + dev-libs/lzo
56 + net-dns/dnsmasq[dhcp,ipv6?]"
57 +RDEPEND="${DEPEND}
58 + acct-group/lxd
59 + net-firewall/ebtables
60 + net-firewall/iptables[ipv6?]
61 + sys-apps/iproute2[ipv6?]
62 + sys-fs/fuse:0=
63 + sys-fs/lxcfs
64 + sys-fs/squashfs-tools
65 + virtual/acl"
66 +BDEPEND="dev-lang/go
67 + nls? ( sys-devel/gettext )"
68 +
69 +CONFIG_CHECK="
70 + ~BRIDGE
71 + ~DUMMY
72 + ~IP6_NF_NAT
73 + ~IP6_NF_TARGET_MASQUERADE
74 + ~IPV6
75 + ~IP_NF_NAT
76 + ~IP_NF_TARGET_MASQUERADE
77 + ~MACVLAN
78 + ~NETFILTER_XT_MATCH_COMMENT
79 + ~NET_IPGRE
80 + ~NET_IPGRE_DEMUX
81 + ~NET_IPIP
82 + ~NF_NAT_MASQUERADE_IPV4
83 + ~VSOCKETS
84 + ~VXLAN
85 +"
86 +
87 +# Uses internet connection.
88 +RESTRICT="test"
89 +
90 +# Go magic.
91 +QA_PREBUILT="/usr/lib/lxd/libdqlite.so.0.0.1
92 + /usr/bin/fuidshift
93 + /usr/bin/lxc
94 + /usr/bin/lxc-to-lxd
95 + /usr/bin/lxd-agent
96 + /usr/bin/lxd-benchmark
97 + /usr/bin/lxd-p2c
98 + /usr/sbin/lxd"
99 +
100 +EGO_PN="github.com/lxc/lxd"
101 +GOPATH="${S}/_dist" # this seems to reset every now and then, though
102 +
103 +common_op() {
104 + local i
105 + for i in dqlite raft; do
106 + cd "${GOPATH}"/deps/${i} || die "failed to switch dir to ${i}"
107 + "${@}"
108 + cd "${S}" || die "failed to switch dir back from ${i} to ${S}"
109 + done
110 +}
111 +
112 +src_prepare() {
113 + default
114 +
115 + export GOPATH="${S}/_dist"
116 +
117 + sed -i \
118 + -e "s:\./configure:./configure --prefix=/usr --libdir=${EPREFIX}/usr/lib/lxd:g" \
119 + -e "s:make:make ${MAKEOPTS}:g" \
120 + Makefile || die
121 +
122 + sed -i 's#lib$#lib/lxd#' "${GOPATH}"/deps/libco/Makefile || die
123 + sed -i 's#zfs version 2>/dev/null | cut -f 2 -d - | head -1#< /sys/module/zfs/version cut -f 1#' "${GOPATH}"/deps/raft/configure.ac || die
124 +
125 + common_op eautoreconf
126 +}
127 +
128 +src_configure() {
129 + export GOPATH="${S}/_dist"
130 +
131 + export CO_CFLAGS="-I${GOPATH}/deps/libco/"
132 + export CO_LIBS="${GOPATH}/deps/libco/"
133 +
134 + export RAFT_CFLAGS="-I${GOPATH}/deps/raft/include/"
135 + export RAFT_LIBS="${GOPATH}/deps/raft/.libs"
136 +
137 + export SQLITE_CFLAGS="-I${GOPATH}/deps/sqlite"
138 + export SQLITE_LIBS="${GOPATH}/deps/sqlite/.libs"
139 +
140 + export PKG_CONFIG_PATH="${GOPATH}/sqlite/:${GOPATH}/libco/:${GOPATH}/raft/"
141 +
142 + cd "${GOPATH}/deps/sqlite" || die
143 + econf --enable-replication --disable-amalgamation --disable-tcl --libdir="${EPREFIX}/usr/lib/lxd"
144 +
145 + common_op econf --libdir="${EPREFIX}"/usr/lib/lxd
146 +}
147 +
148 +src_compile() {
149 + export GOPATH="${S}/_dist"
150 +
151 + export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ -I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ -I${GOPATH}/deps/libco/"
152 + 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"
153 + export LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}"
154 +
155 + local j
156 + for j in sqlite raft libco; do
157 + cd "${GOPATH}"/deps/${j} || die
158 + emake
159 + done
160 +
161 + ln -s libco.so.0.1.0 libco.so || die
162 +
163 + cd "${GOPATH}/deps/dqlite" || die
164 + emake CFLAGS="-I${GOPATH}/deps/sqlite -I${GOPATH}/deps/raft/include" LDFLAGS="-L${GOPATH}/deps/sqlite -L${GOPATH}/deps/raft"
165 +
166 + cd "${S}" || die
167 +
168 + for k in fuidshift lxd-agent lxd-benchmark lxd-p2c lxc lxc-to-lxd; do
169 + go install -v -x ${EGO_PN}/${k} || die "failed compiling ${k}"
170 + done
171 +
172 + go install -v -x -tags libsqlite3 ${EGO_PN}/lxd || die "Failed to build the daemon"
173 +
174 + use nls && emake build-mo
175 +}
176 +
177 +src_test() {
178 + export GOPATH="${S}/_dist"
179 +
180 + # This is mostly a copy/paste from the Makefile's "check" rule, but
181 + # patching the Makefile to work in a non "fully-qualified" go namespace
182 + # was more complicated than this modest copy/paste.
183 + # Also: sorry, for now a network connection is needed to run tests.
184 + # Will properly bundle test dependencies later.
185 + go get -v -x github.com/rogpeppe/godeps || die
186 + go get -v -x github.com/remyoudompheng/go-misc/deadcode || die
187 + go get -v -x github.com/golang/lint/golint || die
188 + go test -v ${EGO_PN}/lxd || die
189 +}
190 +
191 +src_install() {
192 + local bindir="_dist/bin"
193 + export GOPATH="${S}/_dist"
194 +
195 + dosbin ${bindir}/lxd
196 +
197 + for l in fuidshift lxd-agent lxd-benchmark lxd-p2c lxc lxc-to-lxd; do
198 + dobin ${bindir}/${l}
199 + done
200 +
201 + for m in dqlite libco raft sqlite; do
202 + cd "${GOPATH}"/deps/${m} || die "failed switching into ${GOPATH}/${m}"
203 + emake DESTDIR="${D}" install
204 + done
205 +
206 + cd "${S}" || die
207 +
208 + # We only need libraries, and we don't want anything to link against these.
209 + rm "${ED}"/usr/bin/sqlite3 || die
210 + rm -r "${ED}"/usr/include || die
211 + rm -r "${ED}"/usr/lib/lxd/*.a || die
212 + rm -r "${ED}"/usr/lib/lxd/pkgconfig || die
213 +
214 + newbashcomp scripts/bash/lxd-client lxc
215 +
216 + newconfd "${FILESDIR}"/${PN}-4.0.0.confd lxd
217 + newinitd "${FILESDIR}"/${PN}-4.0.0.initd lxd
218 +
219 + systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service
220 +
221 + dodoc AUTHORS doc/*
222 + use nls && domo po/*.mo
223 +}
224 +
225 +pkg_postinst() {
226 + elog
227 + elog "Consult https://wiki.gentoo.org/wiki/LXD for more information,"
228 + elog "including a Quick Start."
229 + elog
230 + elog "Optional features:"
231 + optfeature "apparmor support" app-emulation/lxc[apparmor]
232 + optfeature "btrfs storage backend" sys-fs/btrfs-progs
233 + optfeature "lvm2 storage backend" sys-fs/lvm2
234 + optfeature "zfs storage backend" sys-fs/zfs
235 + elog
236 + elog "Be sure to add your local user to the lxd group."
237 +}