From f516638b7fe9592837389826a6152a7e1b251c54 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 30 May 2020 11:44:06 +0100 Subject: gentoo resync : 30.05.2020 --- app-emulation/lxd/Manifest | 6 +- app-emulation/lxd/files/lxd-4.0.0.confd | 23 +++ app-emulation/lxd/files/lxd-4.0.0.initd | 54 +++++++ app-emulation/lxd/lxd-3.16-r1.ebuild | 266 -------------------------------- app-emulation/lxd/lxd-4.0.1.ebuild | 204 ++++++++++++++++++++++++ 5 files changed, 285 insertions(+), 268 deletions(-) create mode 100644 app-emulation/lxd/files/lxd-4.0.0.confd create mode 100644 app-emulation/lxd/files/lxd-4.0.0.initd delete mode 100644 app-emulation/lxd/lxd-3.16-r1.ebuild create mode 100644 app-emulation/lxd/lxd-4.0.1.ebuild (limited to 'app-emulation/lxd') diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest index f4bd642818eb..4d38dedd79c5 100644 --- a/app-emulation/lxd/Manifest +++ b/app-emulation/lxd/Manifest @@ -1,9 +1,11 @@ AUX de-translation-newline-1.patch 432 BLAKE2B 2b546cd7200f0d736bffd255bbb79d4e997241a35159e052598d4b9da77ca402a0eb90fcb6fae74ac7d9dca9b8383843fd67fb88b6cab474e547d892ac414d4b SHA512 2857ec4e4856d47340163c10644805ee7a65a0095539c7fdc422b874d1af645187a1de0aff4844d9ed0387cebbd82dbb33da32a839b6dda02df4c3d741e88d76 +AUX lxd-4.0.0.confd 582 BLAKE2B 88ce8ec99eb50174bffea7d3b8bddc67b50fe6677d54df115c9069311b5fb59a72170a15988f50714740074f7ec4f2cd32fb47b6d8c52cf69b8c6fa332162a06 SHA512 96d922ae81677eebace3f8d2dff7f67d58701c40c09e2435677f9289cca89fe260c0d9526059d3772c3405a5b8ec52466bf7d7a920dcdd7551f1b3f01f2fc9c4 +AUX lxd-4.0.0.initd 1097 BLAKE2B 8cd967f37edc7c87a5d225dc77a39e6696596fb9d53829289b75b3f136572aaaaede5ad78360c0ca2055bcf23627fd75102616ff9da604785bdcbdcb57ae81ff SHA512 5a40f0e7a6fe5e8b301f8fc22344fed64fe8b8894a175600e938f147f49ccf4fa71c75fdfe25ba936c65435fcabdc5f7a606993093e5ffdb7dbc4e0b9f03621d AUX lxd.confd 538 BLAKE2B f020d83375bddc3e88f752d4be49c65893901893eaa572f212c655f4d3c5631b41238ed917c70f16b4c092d82ced13011edd6e91140cda251ebf8745591cd886 SHA512 9ea61647a8da82bc595f78882adf5a6c71483c7adf8965d7d32016a67a0da6510f8dc3d09fd29f77d5f6d5f18282bca3b3b5c2abffaa67265a4fd4ddb07f31a8 AUX lxd.initd 853 BLAKE2B 0b48de1a596767db356850adcb5682c5c351e7477b0d49d81aebf857a01e4eb75067087d323ba4b5d6fbf8765a76cf161ad2cfaa0eba480fb86e91fdb95b0e79 SHA512 960aceb2845cc3b454b2f916c73273f4b1ec6f87e5d569c27c8c58e0db153c084e03addbdcc91dc8761fc6f0e306261d87db73f8610fda197e55f9ec6756fd56 AUX lxd.service 174 BLAKE2B 8686d57a79fbc3a9ec2e1a3197012599a5d6b81b62188e779cdb9a86f9f413fa485090c79dab8c4aa8891e0e35604b85fb1cdb1da313918b34a974b61699b24a SHA512 6f9d71d5c08c49653f28511bc793d1365604af6bf105789caea27f4685d721fbb283f888e3b7310997b73ff2fc5bb1a47e7500c4678cb3d39124cab723523140 DIST lxd-3.14.tar.gz 26141949 BLAKE2B 69004501012c9a873eef77a60df7e5dba25c692224d27b02cd2d2b27533012e71bd7562cb64a17920234746e8be2819bb773365c01422c0b776dd2b7c36b69fe SHA512 3d2d4e61298fc9fde49defad776a398fcccf7639485e810173c9c7f7d939c354a9ad8112a4a631b0850f6eb54435012d289236ff61839416caf95434eb23c8ff -DIST lxd-3.16.tar.gz 24863601 BLAKE2B 0087c00d86ea3f623ea31bc008176e4232bb432f5c431c288f5c5ff3e1658abe4e310509088ddc6b23d8db68f8e93997522b8a5c0b19fd243abee13e11d3deb9 SHA512 11c6c5c49ceb23c31979829937e1baad340b8920481ef5b89b2b6d0b6b05967ec1f446f8b0330c11008f6fecea077eed0858af7fe802c50b52148757584fdfb9 +DIST lxd-4.0.1.tar.gz 25027762 BLAKE2B 1154a427558ad5eda62b63501a2f62a5c3a1b740fac061432b06a1034b75cb906f38d6c43e8215cab8ae0bed328d75a7612c1bb7af3272cdbe3f93235d5bb920 SHA512 1f47f8239cc1d3425fc4cd075487678e219e94deddec10f52a1cd18fbdc0515f54b67552e7b41d0052803c317a861b34cfc83a25776eae7b9673b5c5fd50d70f EBUILD lxd-3.14.ebuild 6865 BLAKE2B 56a86d6bb704c3c562654d01953b566f34e9d57abf915972899b663b61e8d9fe1e50523a439a406b013e7396c3286e104859bf4ca23106306ee719ef41810d80 SHA512 aadb152acac7f5784028bbd89c8ebc105992dd6898e22ed36b26889969b7ce1cffdb79e8db1c0e0a43ca98cae7feee3f133165c3f624b87611dfed1dbe0c8511 -EBUILD lxd-3.16-r1.ebuild 8076 BLAKE2B 051b4da2220e7badf1a5b298ec47e9ce855e115d7dac17643c8e4f15f8537c10329986fe2f7f160fd90b388989ae7227a5926ed7946f6930755340af93261ad9 SHA512 4f631def5be1699989e9c63d36f32816e966be0b4e3724a7fbd41c3e3f2645a1ca84b92e58f2562430ff3c3d6354831bd947a63c0815cb98f10cb0e91a2375bb +EBUILD lxd-4.0.1.ebuild 5667 BLAKE2B 0d264505373865191a0db35f39e93a02783696904f1e254e8e4eb4b698652db207bc22e222f7c70337a9db648f0af3d64f3faad0b21541a158e73cbf0bc7179d SHA512 6ce8d93d08af5f15984d4f0a099edb478a3bc42ea13a4028b01288e8436de0352e97f78a35edc8451f5f8399bb37faaf9fef5c110b71fc0ef5cb53fee36c8fd5 MISC metadata.xml 925 BLAKE2B 74a89f515bf441f62686a9a2fc2576ec8986705b681e52c9e8267acd6839b06fdafe82dd27df43c39b5e09bba87e63bbb27cc4da18ed31931393946b90add05b SHA512 e4fc6d70a790e164366349e4980f5161db0ca1b4d1996c1ce32223a75926a38ea46f8e08e6c708c6f41c2c81aebde3dbe0d0ce5c63f9340f7ae6f895b5fde144 diff --git a/app-emulation/lxd/files/lxd-4.0.0.confd b/app-emulation/lxd/files/lxd-4.0.0.confd new file mode 100644 index 000000000000..68cf344995be --- /dev/null +++ b/app-emulation/lxd/files/lxd-4.0.0.confd @@ -0,0 +1,23 @@ +# Group which owns the shared socket +LXD_OPTIONS+=" --group lxd" + +# Enable cpu profiling into the specified file +#LXD_OPTIONS+=" --cpuprofile /tmp/lxc_cpu_profile" + +# Enable memory profiling into the specified file +#LXD_OPTIONS+=" --memprofile /tmp/lxc_mem_profile" + +# Enable debug mode +#LXD_OPTIONS+=" --debug" + +# For debugging, print a complete stack trace every n seconds +#LXD_OPTIONS+=" --print-goroutines-every 5" + +# Enable verbose mode +#LXD_OPTIONS+=" -v" + +# Logfile to log to +#LXD_OPTIONS+=" --logfile /var/log/lxd/lxd.log" + +# Enable syslog logging +#LXD_OPTIONS+=" --syslog" diff --git a/app-emulation/lxd/files/lxd-4.0.0.initd b/app-emulation/lxd/files/lxd-4.0.0.initd new file mode 100644 index 000000000000..03ec12e44f56 --- /dev/null +++ b/app-emulation/lxd/files/lxd-4.0.0.initd @@ -0,0 +1,54 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +DAEMON=/usr/sbin/lxd +PIDFILE=/run/lxd.pid +TIMEOUT=10 + +extra_commands="stopall" + +depend() { + need net + need lxcfs +} + +start() { + ebegin "Starting lxd service" + + modprobe -f loop > /dev/null 2>&1 + + # fix permissions on /var/lib/lxd and make sure it exists + install -d /var/lib/lxd --group lxd --owner root --mode 0775 + start-stop-daemon --start \ + --pidfile ${PIDFILE} \ + --exec ${DAEMON} \ + --background \ + --make-pidfile \ + -- \ + ${LXD_OPTIONS} + eend ${?} +} + +stop() { + if [[ ${RC_GOINGDOWN} = YES ]] || [[ ${RC_REBOOT} = YES ]]; then + stopall + else + ebegin "Stopping lxd service (but not containers)." + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + eend ${?} + fi +} + +stopall() { + ebegin "Stopping lxd service and containers." + lxc stop --all --timeout $TIMEOUT >/dev/null 2>&1 + if [[ ${?} -ne 0 ]]; then + lxc stop --all --force || eerror "Could not stop all containers." + fi + if "${DAEMON}" shutdown; then + rm -f ${PIDFILE} + eend 0 + fi + eend ${?} +} diff --git a/app-emulation/lxd/lxd-3.16-r1.ebuild b/app-emulation/lxd/lxd-3.16-r1.ebuild deleted file mode 100644 index 6f15ebbce927..000000000000 --- a/app-emulation/lxd/lxd-3.16-r1.ebuild +++ /dev/null @@ -1,266 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -DESCRIPTION="Fast, dense and secure container management" -HOMEPAGE="https://linuxcontainers.org/lxd/introduction/" - -LICENSE="Apache-2.0 BSD BSD-2 LGPL-3 MIT MPL-2.0" -SLOT="0" -KEYWORDS="~amd64" - -IUSE="+daemon +ipv6 +dnsmasq nls test tools" -RESTRICT="!test? ( test )" - -inherit autotools bash-completion-r1 linux-info systemd user - -SRC_URI="https://linuxcontainers.org/downloads/${PN}/${P}.tar.gz" - -DEPEND=" - dev-lang/tcl - >=dev-lang/go-1.9.4 - dev-libs/libuv - dev-libs/protobuf - nls? ( sys-devel/gettext ) - test? ( - app-misc/jq - net-misc/curl - sys-devel/gettext - ) -" - -RDEPEND=" - daemon? ( - app-arch/xz-utils - >=app-emulation/lxc-2.0.7[seccomp] - dev-libs/libuv - dev-libs/lzo - dev-util/xdelta:3 - dnsmasq? ( - net-dns/dnsmasq[dhcp,ipv6?] - ) - net-firewall/ebtables - net-firewall/iptables[ipv6?] - net-libs/libnfnetlink - net-libs/libnsl:0= - net-misc/rsync[xattr] - sys-apps/iproute2[ipv6?] - sys-fs/fuse:0= - sys-fs/lxcfs - sys-fs/squashfs-tools - virtual/acl - ) -" - -CONFIG_CHECK=" - ~BRIDGE - ~DUMMY - ~IP6_NF_NAT - ~IP6_NF_TARGET_MASQUERADE - ~IPV6 - ~IP_NF_NAT - ~IP_NF_TARGET_MASQUERADE - ~MACVLAN - ~NETFILTER_XT_MATCH_COMMENT - ~NET_IPGRE - ~NET_IPGRE_DEMUX - ~NET_IPIP - ~NF_NAT_MASQUERADE_IPV4 - ~NF_NAT_MASQUERADE_IPV6 - ~VXLAN -" - -ERROR_BRIDGE="BRIDGE: needed for network commands" -ERROR_DUMMY="DUMMY: needed for network commands" -ERROR_IP6_NF_NAT="IP6_NF_NAT: needed for network commands" -ERROR_IP6_NF_TARGET_MASQUERADE="IP6_NF_TARGET_MASQUERADE: needed for network commands" -ERROR_IPV6="IPV6: needed for network commands" -ERROR_IP_NF_NAT="IP_NF_NAT: needed for network commands" -ERROR_IP_NF_TARGET_MASQUERADE="IP_NF_TARGET_MASQUERADE: needed for network commands" -ERROR_MACVLAN="MACVLAN: needed for network commands" -ERROR_NETFILTER_XT_MATCH_COMMENT="NETFILTER_XT_MATCH_COMMENT: needed for network commands" -ERROR_NET_IPGRE="NET_IPGRE: needed for network commands" -ERROR_NET_IPGRE_DEMUX="NET_IPGRE_DEMUX: needed for network commands" -ERROR_NET_IPIP="NET_IPIP: needed for network commands" -ERROR_NF_NAT_MASQUERADE_IPV4="NF_NAT_MASQUERADE_IPV4: needed for network commands" -ERROR_NF_NAT_MASQUERADE_IPV6="NF_NAT_MASQUERADE_IPV6: needed for network commands" -ERROR_VXLAN="VXLAN: needed for network commands" - -EGO_PN="github.com/lxc/lxd" - -src_prepare() { - eapply_user - eapply "${FILESDIR}/de-translation-newline-1.patch" - - cd "${S}/_dist/deps/raft" || die "Can't cd to raft dir" - # Workaround for " * ACCESS DENIED: open_wr: /dev/zfs" - 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" - eautoreconf - - cd "${S}/_dist/deps/dqlite" || die "Can't cd to dqlite dir" - eautoreconf - -} - -src_configure() { - export GOPATH="${S}/_dist" - cd "${GOPATH}/deps/sqlite" || die "Can't cd to sqlite dir" - econf --enable-replication --disable-amalgamation --disable-tcl --libdir="${EPREFIX}/usr/lib/lxd" - - cd "${GOPATH}/deps/raft" || die "Can't cd to raft dir" - PKG_CONFIG_PATH="${GOPATH}/raft/" econf --libdir=${EPREFIX}/usr/lib/lxd - - cd "${GOPATH}/deps/dqlite" || die "Can't cd to dqlite dir" - export RAFT_CFLAGS="-I${GOPATH}/deps/raft/include/" - export RAFT_LIBS="${GOPATH}/deps/raft/.libs" - export CO_CFLAGS="-I${GOPATH}/deps/libco/" - export CO_LIBS="${GOPATH}/deps/libco/" - PKG_CONFIG_PATH="${GOPATH}/sqlite/" econf --libdir=${EPREFIX}/usr/lib/lxd -} - -src_compile() { - export GOPATH="${S}/_dist" - - cd "${GOPATH}/deps/sqlite" || die "Can't cd to sqlite dir" - emake - - cd "${GOPATH}/deps/raft" || die "Can't cd to raft dir" - emake - - cd "${GOPATH}/deps/libco" || die "Can't cd to libco dir" - emake - - cd "${GOPATH}/deps/dqlite" || die "Can't cd to dqlite dir" - emake CFLAGS="-I${GOPATH}/deps/sqlite -I${GOPATH}/deps/raft/include" LDFLAGS="-L${GOPATH}/deps/sqlite -L${GOPATH}/deps/raft" - - # We don't use the Makefile here because it builds targets with the - # assumption that `pwd` is in a deep gopath namespace, which we're not. - # It's simpler to manually call "go install" than patching the Makefile. - cd "${S}" - go install -v -x ${EGO_PN}/lxc || die "Failed to build the client" - - if use daemon; then - - # LXD depends on a patched, bundled sqlite with replication - # capabilities. - export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ -I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ -I${GOPATH}/deps/libco/" - 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" - export LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}" - - go install -v -x -tags libsqlite3 ${EGO_PN}/lxd || die "Failed to build the daemon" - fi - - if use tools; then - go install -v -x ${EGO_PN}/fuidshift || die "Failed to build fuidshift" - go install -v -x ${EGO_PN}/lxc-to-lxd || die "Failed to build lxc-to-lxd" - go install -v -x ${EGO_PN}/lxd-benchmark || die "Failed to build lxd-benchmark" - go install -v -x ${EGO_PN}/lxd-p2c || die "Failed to build lxd-p2c" - fi - - use nls && emake build-mo -} - -src_test() { - if use daemon; then - export GOPATH="${S}/_dist" - # This is mostly a copy/paste from the Makefile's "check" rule, but - # patching the Makefile to work in a non "fully-qualified" go namespace - # was more complicated than this modest copy/paste. - # Also: sorry, for now a network connection is needed to run tests. - # Will properly bundle test dependencies later. - go get -v -x github.com/rogpeppe/godeps - go get -v -x github.com/remyoudompheng/go-misc/deadcode - go get -v -x github.com/golang/lint/golint - go test -v ${EGO_PN}/lxd - else - einfo "No tests to run for client-only builds" - fi -} - -src_install() { - local bindir="_dist/bin" - dobin ${bindir}/lxc - if use daemon; then - - export GOPATH="${S}/_dist" - cd "${GOPATH}/deps/sqlite" || die "Can't cd to sqlite dir" - emake DESTDIR="${D}" install - - cd "${GOPATH}/deps/raft" || die "Can't cd to raft dir" - emake DESTDIR="${D}" install - - cd "${GOPATH}/deps/libco" || die "Can't cd to libco dir" - dolib.so libco.so - - cd "${GOPATH}/deps/dqlite" || die "Can't cd to dqlite dir" - emake DESTDIR="${D}" install - - # Must only install libs - rm "${D}/usr/bin/sqlite3" || die "Can't remove custom sqlite3 binary" - rm -r "${D}/usr/include" || die "Can't remove include directory" - - cd "${S}" || die "Can't cd to \${S}" - dosbin ${bindir}/lxd - fi - - if use tools; then - dobin ${bindir}/fuidshift - dobin ${bindir}/lxc-to-lxd - dobin ${bindir}/lxd-benchmark - dobin ${bindir}/lxd-p2c - fi - - if use nls; then - domo po/*.mo - fi - - if use daemon; then - newinitd "${FILESDIR}"/${PN}.initd lxd - newconfd "${FILESDIR}"/${PN}.confd lxd - - systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service - fi - - newbashcomp scripts/bash/lxd-client lxc - - dodoc AUTHORS doc/* -} - -pkg_postinst() { - elog - elog "Consult https://wiki.gentoo.org/wiki/LXD for more information," - elog "including a Quick Start." - - # The messaging below only applies to daemon installs - use daemon || return 0 - - # The control socket will be owned by (and writeable by) this group. - enewgroup lxd - - # Ubuntu also defines an lxd user but it appears unused (the daemon - # must run as root) - - elog - elog "Though not strictly required, some features are enabled at run-time" - elog "when the relevant helper programs are detected:" - elog "- sys-apps/apparmor" - elog "- sys-fs/btrfs-progs" - elog "- sys-fs/lvm2" - elog "- sys-fs/zfs" - elog "- sys-process/criu" - elog - elog "Since these features can't be disabled at build-time they are" - elog "not USE-conditional." - elog - elog "Be sure to add your local user to the lxd group." - elog - elog "Networks with bridge.mode=fan are unsupported due to requiring" - elog "a patched kernel and iproute2." -} - -# TODO: -# - man page, I don't see cobra generating it -# - maybe implement LXD_CLUSTER_UPDATE per -# https://discuss.linuxcontainers.org/t/lxd-3-5-has-been-released/2656 -# EM I'm not convinced it's a good design. diff --git a/app-emulation/lxd/lxd-4.0.1.ebuild b/app-emulation/lxd/lxd-4.0.1.ebuild new file mode 100644 index 000000000000..21a6fcee0663 --- /dev/null +++ b/app-emulation/lxd/lxd-4.0.1.ebuild @@ -0,0 +1,204 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools bash-completion-r1 eutils linux-info systemd + +DESCRIPTION="Fast, dense and secure container management" +HOMEPAGE="https://linuxcontainers.org/lxd/introduction/ https://github.com/lxc/lxd" +SRC_URI="https://linuxcontainers.org/downloads/${PN}/${P}.tar.gz" + +# Needs to include licenses for all bundled programs. +LICENSE="Apache-2.0 BSD BSD-2 LGPL-3 MIT MPL-2.0" +SLOT="0" +KEYWORDS="~amd64" +IUSE="+ipv6 nls" + +DEPEND="app-arch/xz-utils + >=app-emulation/lxc-3.0.0[seccomp] + dev-lang/tcl + dev-libs/libuv + dev-libs/lzo + net-dns/dnsmasq[dhcp,ipv6?]" +RDEPEND="${DEPEND} + acct-group/lxd + net-firewall/ebtables + net-firewall/iptables[ipv6?] + sys-apps/iproute2[ipv6?] + sys-fs/fuse:0= + sys-fs/lxcfs + sys-fs/squashfs-tools + virtual/acl" +BDEPEND="dev-lang/go + nls? ( sys-devel/gettext )" + +CONFIG_CHECK=" + ~BRIDGE + ~DUMMY + ~IP6_NF_NAT + ~IP6_NF_TARGET_MASQUERADE + ~IPV6 + ~IP_NF_NAT + ~IP_NF_TARGET_MASQUERADE + ~MACVLAN + ~NETFILTER_XT_MATCH_COMMENT + ~NET_IPGRE + ~NET_IPGRE_DEMUX + ~NET_IPIP + ~NF_NAT_MASQUERADE_IPV4 + ~NF_NAT_MASQUERADE_IPV6 + ~VXLAN +" + +# To no one's surprise uses internet connection. +RESTRICT="test" + +# Go magic. +QA_PREBUILT="/usr/lib/lxd/libdqlite.so.0.0.1 + /usr/bin/fuidshift + /usr/bin/lxc + /usr/bin/lxc-to-lxd + /usr/bin/lxd-agent + /usr/bin/lxd-benchmark + /usr/bin/lxd-p2c + /usr/sbin/lxd" + +EGO_PN="github.com/lxc/lxd" +GOPATH="${S}/_dist" # this seems to reset every now and then, though + +common_op() { + local i + for i in dqlite raft; do + cd "${GOPATH}"/deps/${i} || die "failed to switch dir to ${i}" + "${@}" + cd "${S}" || die "failed to switch dir back from ${i} to ${S}" + done +} + +src_prepare() { + default + + export GOPATH="${S}/_dist" + + sed -i \ + -e "s:\./configure:./configure --prefix=/usr --libdir=${EPREFIX}/usr/lib/lxd:g" \ + -e "s:make:make ${MAKEOPTS}:g" \ + Makefile || die + + sed -i 's#lib$#lib/lxd#' "${GOPATH}"/deps/libco/Makefile || die + 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 + + common_op eautoreconf +} + +src_configure() { + export GOPATH="${S}/_dist" + + export CO_CFLAGS="-I${GOPATH}/deps/libco/" + export CO_LIBS="${GOPATH}/deps/libco/" + + export RAFT_CFLAGS="-I${GOPATH}/deps/raft/include/" + export RAFT_LIBS="${GOPATH}/deps/raft/.libs" + + export SQLITE_CFLAGS="-I${GOPATH}/deps/sqlite" + export SQLITE_LIBS="${GOPATH}/deps/sqlite/.libs" + + export PKG_CONFIG_PATH="${GOPATH}/sqlite/:${GOPATH}/libco/:${GOPATH}/raft/" + + cd "${GOPATH}/deps/sqlite" || die + econf --enable-replication --disable-amalgamation --disable-tcl --libdir="${EPREFIX}/usr/lib/lxd" + + common_op econf --libdir="${EPREFIX}"/usr/lib/lxd +} + +src_compile() { + export GOPATH="${S}/_dist" + + export CGO_CFLAGS="${CGO_CFLAGS} -I${GOPATH}/deps/sqlite/ -I${GOPATH}/deps/dqlite/include/ -I${GOPATH}/deps/raft/include/ -I${GOPATH}/deps/libco/" + 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" + export LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/:${GOPATH}/deps/raft/.libs:${GOPATH}/deps/libco/:${LD_LIBRARY_PATH}" + + local j + for j in sqlite raft libco; do + cd "${GOPATH}"/deps/${j} || die + emake + done + + ln -s libco.so.0.1.0 libco.so || die + + cd "${GOPATH}/deps/dqlite" || die + emake CFLAGS="-I${GOPATH}/deps/sqlite -I${GOPATH}/deps/raft/include" LDFLAGS="-L${GOPATH}/deps/sqlite -L${GOPATH}/deps/raft" + + cd "${S}" || die + + for k in fuidshift lxd-agent lxd-benchmark lxd-p2c lxc lxc-to-lxd; do + go install -v -x ${EGO_PN}/${k} || die "failed compiling ${k}" + done + + go install -v -x -tags libsqlite3 ${EGO_PN}/lxd || die "Failed to build the daemon" + + use nls && emake build-mo +} + +src_test() { + export GOPATH="${S}/_dist" + + # This is mostly a copy/paste from the Makefile's "check" rule, but + # patching the Makefile to work in a non "fully-qualified" go namespace + # was more complicated than this modest copy/paste. + # Also: sorry, for now a network connection is needed to run tests. + # Will properly bundle test dependencies later. + go get -v -x github.com/rogpeppe/godeps || die + go get -v -x github.com/remyoudompheng/go-misc/deadcode || die + go get -v -x github.com/golang/lint/golint || die + go test -v ${EGO_PN}/lxd || die +} + +src_install() { + local bindir="_dist/bin" + export GOPATH="${S}/_dist" + + dosbin ${bindir}/lxd + + for l in fuidshift lxd-agent lxd-benchmark lxd-p2c lxc lxc-to-lxd; do + dobin ${bindir}/${l} + done + + for m in dqlite libco raft sqlite; do + cd "${GOPATH}"/deps/${m} || die "failed switching into ${GOPATH}/${m}" + emake DESTDIR="${D}" install + done + + cd "${S}" || die + + # We only need libraries, and we don't want anything to link against these. + rm "${ED}"/usr/bin/sqlite3 || die + rm -r "${ED}"/usr/include || die + rm -r "${ED}"/usr/lib/lxd/*.a || die + rm -r "${ED}"/usr/lib/lxd/pkgconfig || die + + newbashcomp scripts/bash/lxd-client lxc + + newconfd "${FILESDIR}"/${PN}-4.0.0.confd lxd + newinitd "${FILESDIR}"/${PN}-4.0.0.initd lxd + + systemd_newunit "${FILESDIR}"/${PN}.service ${PN}.service + + dodoc AUTHORS doc/* + use nls && domo po/*.mo +} + +pkg_postinst() { + elog + elog "Consult https://wiki.gentoo.org/wiki/LXD for more information," + elog "including a Quick Start." + elog + elog "Optional features:" + optfeature "apparmor support" app-emulation/lxc[apparmor] + optfeature "btrfs storage backend" sys-fs/btrfs-progs + optfeature "lvm2 storage backend" sys-fs/lvm2 + optfeature "zfs storage backend" sys-fs/zfs + elog + elog "Be sure to add your local user to the lxd group." +} -- cgit v1.2.3