summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Mackdanz <stasibear@gentoo.org>2018-08-19 17:20:07 -0500
committerErik Mackdanz <stasibear@gentoo.org>2018-08-19 17:20:07 -0500
commit7f091e8001253dfcd84e81d263d7db319b63aabf (patch)
tree530628c0720796091a05ac6f83a96c127caf9b57
parentnet-wireless/dump1090: Fix ebuild. (diff)
downloadgentoo-7f091e8001253dfcd84e81d263d7db319b63aabf.tar.gz
gentoo-7f091e8001253dfcd84e81d263d7db319b63aabf.tar.bz2
gentoo-7f091e8001253dfcd84e81d263d7db319b63aabf.zip
app-emulation/lxd: Bump to version 3.4
Add some dependencies used by upstream, fully build custom sqlite, move tools to IUSE. Closes: https://bugs.gentoo.org/show_bug.cgi?id=628346 Package-Manager: Portage-2.3.46, Repoman-2.3.10
-rw-r--r--app-emulation/lxd/Manifest1
-rw-r--r--app-emulation/lxd/files/lxd.initd.147
-rw-r--r--app-emulation/lxd/lxd-3.4.ebuild232
-rw-r--r--app-emulation/lxd/metadata.xml5
4 files changed, 284 insertions, 1 deletions
diff --git a/app-emulation/lxd/Manifest b/app-emulation/lxd/Manifest
index a59667370be7..12ef79ec012c 100644
--- a/app-emulation/lxd/Manifest
+++ b/app-emulation/lxd/Manifest
@@ -45,3 +45,4 @@ DIST lxd-2.21.tar.gz 882352 BLAKE2B 80542bcc03c05667ee0207dfbfd2bf41c5a6ef69178a
DIST lxd-3.1.tar.gz 27979442 BLAKE2B 0b74e3f76a7ab835b042b52b469a6fe11e7077d567e0658d13fab2192fd25d99518d65ba319c981a2e4677319e280cccae26f70ef99e9911264dc028ca5628fd SHA512 61f64d08dd80f7f676f386912f4dfc0d0af38cce0287de7865123b9da667b54ab91d22b76ffe03480e04ae0fbd8dc837d7d519d0e34409377c3d7e6624bf636c
DIST lxd-3.2.tar.gz 28183660 BLAKE2B 9aabc9fd0bd66d3b4e0178448a65ca39c69e4e7a14d01309e0e023501de1c17b2b7887a9da5b84fcfde27db3f521cce3451beace9955232da9bd5e5136bc0043 SHA512 82c37e87d75e328a29b1f2876a24fedec43a253bb72f3ea55fa9cdb928d11947eda723a01e758f90ef77ed4492f86ec6dd5f1f88240d05e771d926dfdc9888fb
DIST lxd-3.3.tar.gz 28414680 BLAKE2B 7f3eecf400761548935e6e3c81d894379cd667ffbe6d8ef67a7dd3ad4f1c13846f524fcefc4cdc306674fb990706bda0b2c4ef390f320c41561fa86cf610586c SHA512 ed5d792c1080f2be7f48f34051fbfa28d138b4ccb5405edb13cd630776ec34312da491a1881f77dddbe1a121e589b44952e73ce1e61f2cba72243f3b8f4c0177
+DIST lxd-3.4.tar.gz 24313641 BLAKE2B 6f2db8a690474d020a0d43366e940760c0886c8af60e17ecc6bf1f9747d8454d09d619b723b1794bec503dda82028f7d81edc2d0c33216cbad9c810f2657198d SHA512 f041878fcfd2b45f594d97e748272d44c517f28e181861a604bef23f858c4bd59cc93ac56c24cce6d353743428b66940f11df268ff9f66e83a5c8f1fb95dc3aa
diff --git a/app-emulation/lxd/files/lxd.initd.1 b/app-emulation/lxd/files/lxd.initd.1
new file mode 100644
index 000000000000..b6d3cd4eb264
--- /dev/null
+++ b/app-emulation/lxd/files/lxd.initd.1
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+DAEMON=/usr/sbin/lxd
+PIDFILE=/run/lxd.pid
+
+extra_commands="stopall"
+
+depend() {
+ need net
+ use lxcfs
+}
+
+start() {
+ ebegin "Starting lxd service"
+
+ start-stop-daemon --start \
+ --pidfile ${PIDFILE} \
+ --exec ${DAEMON} \
+ --background \
+ --make-pidfile \
+ --env LD_LIBRARY_PATH="/usr/lib/lxd" \
+ -- \
+ ${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"
+ if "${DAEMON}" shutdown; then
+ /etc/init.d/lxd zap
+ rm -f ${PIDFILE}
+ fi
+ eend $?
+}
diff --git a/app-emulation/lxd/lxd-3.4.ebuild b/app-emulation/lxd/lxd-3.4.ebuild
new file mode 100644
index 000000000000..32dc9abda4ac
--- /dev/null
+++ b/app-emulation/lxd/lxd-3.4.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+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"
+
+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/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/lzo
+ dev-util/xdelta:3
+ dnsmasq? (
+ net-dns/dnsmasq[dhcp,ipv6?]
+ )
+ net-firewall/ebtables
+ net-firewall/iptables[ipv6?]
+ net-libs/libnfnetlink
+ net-misc/rsync[xattr]
+ sys-apps/iproute2[ipv6?]
+ sys-fs/fuse
+ 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.patch"
+
+ cd "${S}/dist/dqlite" || die "Can't cd to dqlite dir"
+ eautoreconf
+}
+
+src_configure() {
+ export GOPATH="${S}/dist"
+ cd "${GOPATH}/sqlite" || die "Can't cd to sqlite dir"
+ econf --enable-replication --disable-amalgamation --disable-tcl --libdir=/usr/lib/lxd
+
+ cd "${GOPATH}/dqlite" || die "Can't cd to dqlite dir"
+ PKG_CONFIG_PATH="${GOPATH}/sqlite/" econf --libdir=/usr/lib/lxd
+}
+
+src_compile() {
+ export GOPATH="${S}/dist"
+
+ cd "${GOPATH}/sqlite" || die "Can't cd to sqlite dir"
+ emake
+
+ cd "${GOPATH}/dqlite" || die "Can't cd to dqlite dir"
+ emake CFLAGS="-I${GOPATH}/sqlite"
+
+ # 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="-I${GOPATH}/sqlite/ -I${GOPATH}/dqlite/include/"
+ export CGO_LDFLAGS="-L${GOPATH}/sqlite/.libs/ -L${GOPATH}/dqlite/.libs/"
+ export LD_LIBRARY_PATH="${GOPATH}/sqlite/.libs/:${GOPATH}/dqlite/.libs/"
+
+ 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"
+ 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}/sqlite" || die "Can't cd to sqlite dir"
+ emake DESTDIR="${D}" install
+
+ cd "${GOPATH}/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
+ fi
+
+ if use nls; then
+ domo po/*.mo
+ fi
+
+ if use daemon; then
+ newinitd "${FILESDIR}"/${PN}.initd.1 lxd
+ newconfd "${FILESDIR}"/${PN}.confd.1 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
diff --git a/app-emulation/lxd/metadata.xml b/app-emulation/lxd/metadata.xml
index de08da5ec7d6..3896143698f3 100644
--- a/app-emulation/lxd/metadata.xml
+++ b/app-emulation/lxd/metadata.xml
@@ -27,7 +27,10 @@
Build the system daemon, not just the client tool
</flag>
<flag name="dnsmasq">
- Depend on dnsmasq to provide DHCP and DNS.
+ Depend on dnsmasq to provide DHCP and DNS
+ </flag>
+ <flag name="tools">
+ Build and install optional tools
</flag>
</use>
</pkgmetadata>