summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Goldstein <cardoe@gentoo.org>2012-10-30 04:43:43 +0000
committerDoug Goldstein <cardoe@gentoo.org>2012-10-30 04:43:43 +0000
commit88778ebd59680a4f604d36783cdc6e3148d65e77 (patch)
tree929ea8bd3e064215e1b27d92b5ddc15e8d1157a9 /app-emulation
parentBump (diff)
downloadhistorical-88778ebd59680a4f604d36783cdc6e3148d65e77.tar.gz
historical-88778ebd59680a4f604d36783cdc6e3148d65e77.tar.bz2
historical-88778ebd59680a4f604d36783cdc6e3148d65e77.zip
Version bump. Tweak to the init script to better support need net in newer OpenRC and to start up init scripts we are dependant on based on USE flags.
Package-Manager: portage-2.1.11.9/cvs/Linux x86_64
Diffstat (limited to 'app-emulation')
-rw-r--r--app-emulation/libvirt/ChangeLog9
-rw-r--r--app-emulation/libvirt/Manifest6
-rw-r--r--app-emulation/libvirt/files/libvirtd.confd-r443
-rw-r--r--app-emulation/libvirt/files/libvirtd.init-r10129
-rw-r--r--app-emulation/libvirt/libvirt-0.10.2.1.ebuild405
5 files changed, 590 insertions, 2 deletions
diff --git a/app-emulation/libvirt/ChangeLog b/app-emulation/libvirt/ChangeLog
index 19ef8f6865e8..d226683bc43d 100644
--- a/app-emulation/libvirt/ChangeLog
+++ b/app-emulation/libvirt/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for app-emulation/libvirt
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/ChangeLog,v 1.225 2012/10/29 07:16:29 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/ChangeLog,v 1.226 2012/10/30 04:43:42 cardoe Exp $
+
+*libvirt-0.10.2.1 (30 Oct 2012)
+
+ 30 Oct 2012; Doug Goldstein <cardoe@gentoo.org> +libvirt-0.10.2.1.ebuild,
+ +files/libvirtd.confd-r4, +files/libvirtd.init-r10:
+ Version bump. Tweak to the init script to better support need net in newer
+ OpenRC and to start up init scripts we are dependant on based on USE flags.
29 Oct 2012; Doug Goldstein <cardoe@gentoo.org> libvirt-0.10.2-r3.ebuild:
Handle kernel CONFIG option rename for 3.6 and newer. Clean up kernel CONFIG
diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest
index 1ad5d969a986..8ee5b7c3a2b1 100644
--- a/app-emulation/libvirt/Manifest
+++ b/app-emulation/libvirt/Manifest
@@ -1,12 +1,16 @@
AUX libvirtd.confd-r3 1757 SHA256 60f341dcf33ca8d55b6394ba6cf8e22f5133393e47f827b88cef1243c255f15c SHA512 f65484ab52a5c4d0f7f1e6e7be9c379617d773b18e81ac875d628a0d9a2b5ae68d256dc1e29ca756d5216d52728bdc80da1afdd89977e6670da3a6dbd3aecc78 WHIRLPOOL 34e98b2cd72466a1152e41ea7b34533337e4aec3cf347cd75e766143b576462110bdb2ee691268ceaea0cfe6aba2a5b6bcdedc662ae6a66cc14e0099523c8e20
+AUX libvirtd.confd-r4 2015 SHA256 c2ca5d9a2d4ed433e91bd215c2ca678109cc981072897a497955e36760dc3b9f SHA512 b3e1d2433be7838a35386747422a8f98f2a7f6a92a03089f9472eb8ee2efb7d10d2becd363fea7cdaf8771da31b58cd60d192b25e089b6257ad5341b1074e540 WHIRLPOOL 284e72e704b759433d5ddc1a3e4019164dda6b48cb2734ea9a6780747938bba2855a99dcf1b125ab3f500a6145315cafa4a3531ff6938c0c62e5b1a6f99ea9b3
+AUX libvirtd.init-r10 3635 SHA256 5a7f42c7642290fd06114d2cc28f252b0a607f49ac016760e1fbf10d3e4e5be8 SHA512 c163bd854291d5deca1705aa6227fdd2960fb1a581905f39dc0cdbeaa98d1227a503da21e14d292ae946cf6ac61b21d53623328b4b1667fb209f718071772e41 WHIRLPOOL 9407205a2bc1b8467bfc1a899e86c5843e3f213b926874489fa90590c0c6e1d55604db77892ccd7ddcd6baf196e8927ce91d12d2dd4ec43b686d7c878277a920
AUX libvirtd.init-r8 3630 SHA256 2156b91662bfc9a6c668130c5f562ff79101f0ba579a86b7048d1851e8ef7968 SHA512 1f4e500bed8fad3c5fa0999f8710e1d788910d44548c0a494ffb27047e1d0b328017bd895fa5474c27364a8dcf98181159f962568d896a5bb296da93f4240dc5 WHIRLPOOL 2580754a2edd461c38aeacbc5e60c34df3d84611fe5c04b08fbfe6d9cfd4956697c4edc2df3ce86016716ab74ce574ec24498a55ff3e851d637893e2d512e17b
AUX libvirtd.init-r9 3605 SHA256 53383c6da34a9e5348c02df09d6671ce37a1661dc446ac6c5875a77824e7bbb3 SHA512 357e4a1d2e13adea3e7aaea46560d4fa460790024d8ff324107a8574b088451eb24ab29284bca91d75a3a51dd4205d04fdf35be27cde50129bff6d5a4414c206 WHIRLPOOL 78e14db80fd08f632ec3a5594827e7fe7e3fe56b1078c66f87cf2bbac0baa102a376f9540f329e787ad9b94344dcffe5e2bf8c952925dd28ef12cfd7fdef39e2
DIST libvirt-0.10.2-85e8c146.tar.xz 9096 SHA256 df88922446f4667051348c6919bbbb79697661e95d3fc952c273272356fef5ed SHA512 f4f4344289b590dc32a1d8cbc0173d05a3e64aa675ab3721b32381147db74fb77dab23100dbc19d433b043379992a278eb922e14fef33d4c899133ccb8bf111b WHIRLPOOL d763e2d97be476d1e5133105972dcaefcad763705043d504d1608ce1df1967940b26668410685ae9bb7fd1df06ef0dda884235642ee984c85ce00a91bba1e8ba
+DIST libvirt-0.10.2.1.tar.gz 21300749 SHA256 449628d798b82cb2f24416ef2e38c2d06f1eb68926a2cb3b24aa456dc7a4fa5b SHA512 8f05b266c9cb327adbcd986bc7d728e12578b84104c28353f1c46a6869ce53a3e58d65eb35c3f54be1f155ff6ce2af64aabf5964f4a0074b4ece87eb8291ed72 WHIRLPOOL 75829821e2135ea14beee7cd978fb11c25bf6ed0f6e337c00604094a50723bad1056864f7135ae2c293fc3f9979576ee7223f54a8aad6278b33593abcfeca41e
DIST libvirt-0.10.2.tar.gz 21916817 SHA256 1fe69ae1268a097cc0cf83563883b51780d528c6493efe3e7d94c4160cc46977 SHA512 b0e784ebedf1c6694792ae9d7672101669441e08ad0352be3d57eaae03d6cd99527c2826ea41e3edcf069eab6f2168200b198bca9504d8d63375d20ecbead120 WHIRLPOOL 4a1651be688aabc3b175da762cc88dfe8b61268bf42bb731d7e74ab8b51cf2c1793c77eff6b5d7696b2a4d5bb1103f40d5fbe544d8784dc80e6899c28e2d3f50
DIST libvirt-0.9.13-bp-1.tar.xz 6160 SHA256 dfb91f17d999f1aaf17e9cb59b64227631851ccfabaa24f0ba217dd5f4ae8f51 SHA512 9d7b7d9106fa217d1d6a218196b4692c6f560ffa2824de2b0e04ca35e8eb9ee6abeb02fece3720aa649128596c0990613d7914ab7dadfc7c8e830208882a2e1b WHIRLPOOL 54d96823526d569f081805569fa94947a0843c45cbefa83492e0da19741474fe6d07e212c5dadf93fa2d9123e05c21ab30cec9d8fff3f1ccff6dba8b41f23c8d
DIST libvirt-0.9.13.tar.gz 20276757 SHA256 d124e9915c88c195da9c008a6d855e53e555dca5816052e163dda61388359d5b SHA512 d275cf6dd6c5700eeee701ff4d28a1483137f8c7525496069438b9e81727761066f1d4b1504bf170f6a3f457ecc203f6b5e7b367fe931803cb7592cccceb7f71 WHIRLPOOL 26a5c660c07516c3736f7bd818b6b4b06c98d78181ba991139818f321ace43a33dcc7d095ce6f02b94f7b3aea7c556bb5388cea34ef801576e4d86f9c08712f7
EBUILD libvirt-0.10.2-r3.ebuild 10955 SHA256 9d539ab966334f71c569ce98ccf2b0d5e1e9b789866b517761de246d455306c3 SHA512 90f3a6f7df603fb196ea847624800ab9afa3fba966884277f0a801132cdb71243b3ecc470a941df0e95e081f38b8d26efaa980957d4337b0321c3d2ba45d9802 WHIRLPOOL ce7fb89ecb31d5062bdf17f890a919993044dcb076da045c7786e5bcd7315a2a04218267608a676666c95ac6e65b1c895aef3f1cb37195c1107fe43b4eead83a
+EBUILD libvirt-0.10.2.1.ebuild 11415 SHA256 32baabdce007f6d3b8b15aa2107df9429826b6cc907e8643a5720b4c562335e1 SHA512 5e2634f0a166b448cdb8dfa52e8c85d8860354aa964503250ab97fc705bb8a2279b68513e77b570cb2bef30b3007c2d7e429dd109f879d8b54ae75e2b0726335 WHIRLPOOL f8043b3fd3bd587eddff844e3a1ce9357c11c98dfb8de8a2ac385bc787040e87ed10ecb1f80bf78017d26d9a76485709553d3731ac45541341ea4290d7f078fa
EBUILD libvirt-0.9.13-r1.ebuild 10769 SHA256 c04a4fbd49ca663eb2762247629a3a84aa46cdfe0b49e9098522b8353572d334 SHA512 a818f43e63cb6aa409e9a8ecad6d1ad718151e758533bc2cd5292abbf5ac943dc980fbbee3b241401e2dc2fcf6379f79109bb156afd1f30f4df96ff6543e4c82 WHIRLPOOL 5e2c29bc51a9b5e48ce81eb5f2a3fa47e3d57ea3361ab7260dc5225b545647ab1b65c759fce3edb0a814de6df8f285500c6f0d8a1ceb33e0a0b262618803f763
EBUILD libvirt-9999.ebuild 10353 SHA256 ff2ddc2632f5b5238e877091ce98cd9ee265fee1bf34c8be73174eb651269fd4 SHA512 ab43bd2b15bf6773cd790dd65a736163031073fb924ed07eff8da818499af53b83996af4eb731c713380bcf6f1126191893fe47730e149808d98d2e6206c4657 WHIRLPOOL b0f320dec564d2d0d490bbc05f860864f894716cc2f3f49eb8dd86696fadb77f613322e17983a4968b3a9950af16652a6f68be75a0a08f55494a3fcb5a32a07d
-MISC ChangeLog 43981 SHA256 c6ec0b98019e4d4f9ea92962defafcb9013f8fb3182f7b3ad03d05e2f4ba4552 SHA512 211d11d45b174522f894573845adb7df195b4cf1b16e50d5e52da71b3800598492c5f10ea3b76aa0ef3aedd7bbbeddf16b09a3ad237deba73a0a2107bf1637fc WHIRLPOOL 69fd04c314b9d9b56ebd444f9c74644786d2f7b8b6f4d7be3b01178e60df9b444960375d16fb5e0a0c4c3822ae536f5bd8214cee3a9ff1894cdf13fd32309580
+MISC ChangeLog 44300 SHA256 8fb7152640a7e576dc203277b0aebe184cd772dd41659a7a8e0d7d31b925d713 SHA512 bea7e88ea2cca771a8f879ffc765760597cdf7a4562633a5dc9a6dda58ae0b8514e414b9282cceb39ac4691653d3a6cd3cf5841c18c8a672f2854838ce8bd859 WHIRLPOOL 6a9822476bd83cc59cba417cb1e4fd79184964da1d1e51b35a64f66b905865ca731577070bb84ebb08bf118f875dc59755083d67e39d1d6c5fdafc3b378a1c1f
MISC metadata.xml 3307 SHA256 677bb13ab5f99946bd4dce20bfe9c26739fd312fda5671f7080839ffc048f957 SHA512 b9dd812a97f3d698089fdd8314bab93586e9d954653f3fe90672e636c51de097bb7d211f25bbd706d71029b8f68d31cfe053b3ee2ddf035fb55ad2b3a5029089 WHIRLPOOL 707d7c1bff3c8f69fa3f3ad1dbc14c01ae313bbc16d1a27be8de314f351c1bcf8ab192eb131bb833e274dcce50f2f862f13ff784f151ab6dd8c38ea07363a0e2
diff --git a/app-emulation/libvirt/files/libvirtd.confd-r4 b/app-emulation/libvirt/files/libvirtd.confd-r4
new file mode 100644
index 000000000000..48ab1252e3bf
--- /dev/null
+++ b/app-emulation/libvirt/files/libvirtd.confd-r4
@@ -0,0 +1,43 @@
+# /etc/conf.d/libvirtd
+
+# Startup dependency
+# libvirtd typically requires all networks to be up and settled which
+# is what rc_need="net" provides. However if you only use specific networks
+# for libvirtd, you may override this. Or if you only use libvirtd locally.
+rc_need="net"
+
+# LIBVIRTD_OPTS
+# You may want to add '--listen' to have libvirtd listen for tcp/ip connections
+# if you want to use libvirt for remote control
+# Please consult 'libvirtd --help' for more options
+#LIBVIRTD_OPTS="--listen"
+
+# LIBVIRTD_KVM_SHUTDOWN
+# Valid options:
+# * shutdown - Sends an ACPI shutdown (think when you tap the power button
+# on your machine and it begins a graceful shutdown). If your
+# VM ignores this, it will have the power yanked out from under
+# it in LIBVIRTD_KVM_SHUTDOWN_MAXWAIT seconds.
+# * managedsave - Performs a state save external to the VM. qemu-kvm will stop
+# stop the CPU and save off all state to a separate file. When
+# the machine is started again, it will resume like nothing ever
+# happened. This is guarenteed to always successfully stop your
+# machine and restart it. However it may take some time to finish.
+# * none - No attempts will be made to stop any VMs. If you are restarting your
+# machine the qemu-kvm process will be simply killed, which may result
+# in your VMs having disk corruption.
+LIBVIRTD_KVM_SHUTDOWN="managedsave"
+
+# LIBVIRTD_KVM_SHUTDOWN_MAXWAIT
+# Timeout in seconds until stopping libvirtd and "pulling the plug" on the
+# remaining VM's still in a running state
+#LIBVIRTD_KVM_SHUTDOWN_MAXWAIT="500"
+
+# LIBVIRTD_KVM_NET_SHUTDOWN
+# If libvirtd created networks for you (e.g. NATed networks) then this init
+# script will shut them down for you if this is set to 'yes'. Otherwise,
+# the networks will be left running once libvirt is shutdown. For this
+# option to be useful you must have enabled the 'virt-network' USE flag and
+# have had libvirt create a NATed network for you.
+# Valid values: 'yes' or 'no'
+#LIBVIRTD_KVM_NET_SHUTDOWN="yes"
diff --git a/app-emulation/libvirt/files/libvirtd.init-r10 b/app-emulation/libvirt/files/libvirtd.init-r10
new file mode 100644
index 000000000000..ecfbf5a16749
--- /dev/null
+++ b/app-emulation/libvirt/files/libvirtd.init-r10
@@ -0,0 +1,129 @@
+#!/sbin/runscript
+
+description="Virtual Machine Management daemon (libvirt)"
+extra_started_commands="reload halt"
+description_halt="Stops the libvirt daemon without stopping your VMs"
+description_reload="Restarts the libvirt daemon without stopping your VMs"
+
+depend() {
+ USE_FLAG_AVAHI
+ use USE_FLAG_ISCSI USE_FLAG_RBD
+ after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig
+}
+
+libvirtd_virsh() {
+ local mode=$1
+ shift
+
+ # Silence errors because virsh always throws an error about
+ # not finding the hypervisor version when connecting to libvirtd
+ LC_ALL=C virsh -c ${mode}:///system "$@" 2>/dev/null
+}
+
+libvirtd_dom_list() {
+ # Make sure that it wouldn't be confused if the domain name
+ # contains the word running.
+ libvirtd_virsh $1 list | awk '$3 == "running" { print $1 }'
+}
+
+libvirtd_dom_count() {
+ # Make sure that it wouldn't be confused if the domain name
+ # contains the word running.
+ libvirtd_virsh $1 list | awk 'BEGIN { count = 0 } \
+ $3 == "running" { count++ } \
+ END { print count }'
+}
+
+libvirtd_net_list() {
+ # The purpose of the awk is to avoid networks with 'active' in the name
+ libvirtd_virsh $1 net-list | awk '$2 == "active" { print $1 }'
+}
+
+libvirtd_net_count() {
+ # The purpose of the awk is to avoid networks with 'active' in the name
+ libvirtd_virsh $1 net-list | awk 'BEGIN { count = 0 } \
+ $2 == "active" { count++ } \
+ END { print count }'
+}
+
+
+start() {
+ ebegin "Starting libvirtd"
+ start-stop-daemon --start \
+ --env KRB5_KTNAME=/etc/libvirt/krb5.tab \
+ --exec /usr/sbin/libvirtd -- -d ${LIBVIRTD_OPTS}
+ eend $?
+}
+
+stop() {
+ local counter=
+ local vm_name=
+ local net_name=
+ local dom_id=
+
+ ebegin "Stopping libvirtd"
+ # try to shutdown all (KVM/Qemu) domains
+ if [ "${LIBVIRTD_KVM_SHUTDOWN}" != "none" ] \
+ && [ "$(libvirtd_dom_count qemu)" != "0" ] ; then
+
+ einfo " Shutting down domain(s):"
+ for dom_id in $(libvirtd_dom_list qemu) ; do
+ vm_name="$(libvirtd_virsh qemu domname ${dom_id} | head -n 1)"
+ einfo " ${vm_name}"
+ libvirtd_virsh qemu ${LIBVIRTD_KVM_SHUTDOWN} ${dom_id} > /dev/null
+ done
+
+ if [ -n "${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" ] ; then
+ counter="${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}"
+ else
+ counter=500
+ fi
+
+ if [ "${LIBVIRTD_KVM_SHUTDOWN}" = "shutdown" ]; then
+ einfo " Waiting ${counter} seconds while domains shutdown ..."
+ DOM_COUNT="$(libvirtd_dom_count qemu)"
+ while [ ${DOM_COUNT} -gt 0 ] && [ ${counter} -gt 0 ] ; do
+ DOM_COUNT="$(libvirtd_dom_count qemu)"
+ sleep 1
+ counter=$((${counter} - 1))
+ echo -n "."
+ done
+ fi
+
+ if [ "$(libvirtd_dom_count qemu)" != "0" ] ; then
+ eerror " !!! Some guests are still running, stopping anyway"
+ fi
+
+ fi
+
+ if [ "${LIBVIRTD_KVM_NET_SHUTDOWN}" != "no" ] \
+ && [ "$(libvirtd_net_count qemu)" != "0" ]; then
+
+ einfo " Shutting down network(s):"
+ for net_name in $(libvirtd_net_list qemu); do
+ einfo " ${net_name}"
+ libvirtd_virsh qemu net-destroy ${net_name} > /dev/null
+ done
+
+ if [ "$(libvirtd_net_count qemu)" != "0" ]; then
+ eerror " !!! Some networks are still active, stopping anyway"
+ fi
+ fi
+
+ # Now actually stop the daemon
+ start-stop-daemon --stop --quiet --exec \
+ /usr/sbin/libvirtd --pidfile=/var/run/libvirtd.pid
+ eend $?
+}
+
+halt() {
+ ebegin "Stopping libvirtd without shutting down your VMs"
+ start-stop-daemon --stop --quiet --exec \
+ /usr/sbin/libvirtd --pidfile=/var/run/libvirtd.pid
+ eend $?
+}
+
+reload() {
+ halt
+ start
+}
diff --git a/app-emulation/libvirt/libvirt-0.10.2.1.ebuild b/app-emulation/libvirt/libvirt-0.10.2.1.ebuild
new file mode 100644
index 000000000000..01003974bf26
--- /dev/null
+++ b/app-emulation/libvirt/libvirt-0.10.2.1.ebuild
@@ -0,0 +1,405 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/libvirt-0.10.2.1.ebuild,v 1.1 2012/10/30 04:43:42 cardoe Exp $
+
+EAPI=4
+
+#BACKPORTS=85e8c146
+AUTOTOOLIZE=yes
+
+MY_P="${P/_rc/-rc}"
+
+PYTHON_DEPEND="python? 2:2.5"
+#RESTRICT_PYTHON_ABIS="3.*"
+#SUPPORT_PYTHON_ABIS="1"
+
+inherit eutils python user autotools linux-info
+
+if [[ ${PV} = *9999* ]]; then
+ inherit git-2
+ EGIT_REPO_URI="git://libvirt.org/libvirt.git"
+ AUTOTOOLIZE=yes
+ SRC_URI=""
+ KEYWORDS=""
+else
+ SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz
+ ftp://libvirt.org/libvirt/stable_updates/${MY_P}.tar.gz
+ ${BACKPORTS:+
+ http://dev.gentoo.org/~cardoe/distfiles/${MY_P}-${BACKPORTS}.tar.xz}"
+ KEYWORDS="~amd64 ~x86"
+fi
+S="${WORKDIR}/${P%_rc*}"
+
+DESCRIPTION="C toolkit to manipulate virtual machines"
+HOMEPAGE="http://www.libvirt.org/"
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="audit avahi +caps debug iscsi +libvirtd lvm +lxc +macvtap nfs \
+ nls numa openvz parted pcap phyp policykit python qemu rbd sasl \
+ selinux +udev uml +vepa virtualbox virt-network xen elibc_glibc"
+REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
+ lxc? ( caps libvirtd )
+ openvz? ( libvirtd )
+ qemu? ( libvirtd )
+ uml? ( libvirtd )
+ vepa? ( macvtap )
+ virtualbox? ( libvirtd )
+ xen? ( libvirtd )"
+
+# gettext.sh command is used by the libvirt command wrappers, and it's
+# non-optional, so put it into RDEPEND.
+# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
+# package will use 3 by default. Since we don't have slot pinning in an API,
+# we must go with the most recent
+RDEPEND="sys-libs/readline
+ sys-libs/ncurses
+ >=net-misc/curl-7.18.0
+ dev-libs/libgcrypt
+ >=dev-libs/libxml2-2.7.6
+ dev-libs/libnl:3
+ >=net-libs/gnutls-1.0.25
+ net-libs/libssh2
+ sys-apps/dmidecode
+ >=sys-apps/util-linux-2.17
+ sys-devel/gettext
+ >=net-analyzer/netcat6-1.0-r2
+ app-misc/scrub
+ audit? ( sys-process/audit )
+ avahi? ( >=net-dns/avahi-0.6[dbus] )
+ caps? ( sys-libs/libcap-ng )
+ iscsi? ( sys-block/open-iscsi )
+ lxc? ( sys-power/pm-utils )
+ lvm? ( >=sys-fs/lvm2-2.02.48-r2 )
+ nfs? ( net-fs/nfs-utils )
+ numa? (
+ >sys-process/numactl-2.0.2
+ sys-process/numad
+ )
+ openvz? ( sys-kernel/openvz-sources )
+ parted? (
+ >=sys-block/parted-1.8[device-mapper]
+ sys-fs/lvm2
+ )
+ pcap? ( >=net-libs/libpcap-1.0.0 )
+ policykit? ( >=sys-auth/polkit-0.9 )
+ qemu? (
+ >=app-emulation/qemu-0.13.0
+ dev-libs/yajl
+ sys-power/pm-utils
+ )
+ rbd? ( sys-cluster/ceph )
+ sasl? ( dev-libs/cyrus-sasl )
+ selinux? ( >=sys-libs/libselinux-2.0.85 )
+ virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
+ xen? ( app-emulation/xen-tools app-emulation/xen )
+ udev? ( >=sys-fs/udev-145 >=x11-libs/libpciaccess-0.10.9 )
+ virt-network? ( net-dns/dnsmasq
+ >=net-firewall/iptables-1.4.10
+ net-misc/radvd
+ net-firewall/ebtables
+ sys-apps/iproute2[-minimal] )
+ elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )"
+# one? ( dev-libs/xmlrpc-c )
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ app-text/xhtml1
+ dev-libs/libxslt
+ =dev-lang/python-2*"
+
+LXC_CONFIG_CHECK="
+ ~CGROUPS
+ ~CGROUP_FREEZER
+ ~CGROUP_DEVICE
+ ~CPUSETS
+ ~CGROUP_CPUACCT
+ ~RESOURCE_COUNTERS
+ ~CGROUP_SCHED
+ ~BLK_CGROUP
+ ~NAMESPACES
+ ~UTS_NS
+ ~IPC_NS
+ ~PID_NS
+ ~NET_NS
+ ~DEVPTS_MULTIPLE_INSTANCES
+ ~VETH
+ ~MACVLAN
+ ~POSIX_MQUEUE
+ ~!GRKERNSEC_CHROOT_MOUNT
+ ~!GRKERNSEC_CHROOT_DOUBLE
+ ~!GRKERNSEC_CHROOT_PIVOT
+ ~!GRKERNSEC_CHROOT_CHMOD
+ ~!GRKERNSEC_CHROOT_CAPS
+"
+
+VIRTNET_CONFIG_CHECK="
+ ~BRIDGE_NF_EBTABLES
+ ~NETFILTER_ADVANCED
+ ~NETFILTER_XT_TARGET_CHECKSUM
+"
+
+MACVTAP_CONFIG_CHECK="~MACVTAP"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+
+ enewgroup qemu 77
+ enewuser qemu 77 -1 -1 qemu kvm
+
+ # Some people used the masked ebuild which was not adding the qemu
+ # user to the kvm group originally. This results in VMs failing to
+ # start for some users. bug #430808
+ egetent group kvm | grep -q qemu
+ if [[ $? -ne 0 ]]; then
+ gpasswd -a qemu kvm
+ fi
+
+ # Handle specific kernel versions for different features
+ kernel_is lt 3 5 && LXC_CONFIG_CHECK+=" ~USER_NS"
+ kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" || \
+ LXC_CONFIG_CHECK+=" ~MEMCG"
+
+ CONFIG_CHECK=""
+ use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}"
+ use macvtap && CONFIG_CHECK+="${MACVTAP}"
+ use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}"
+ if [[ -n ${CONFIG_CHECK} ]]; then
+ linux-info_pkg_setup
+ fi
+}
+
+src_prepare() {
+ touch "${S}/.mailmap"
+ [[ -n ${BACKPORTS} ]] && \
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
+ epatch
+
+ if [[ ${PV} = *9999* ]]; then
+
+ # git checkouts require bootstrapping to create the configure script.
+ # Additionally the submodules must be cloned to the right locations
+ # bug #377279
+ ./bootstrap || die "bootstrap failed"
+ (
+ git submodule status | sed 's/^[ +-]//;s/ .*//'
+ git hash-object bootstrap.conf
+ ) >.git-module-status
+ fi
+
+ epatch_user
+
+ [[ -n ${AUTOTOOLIZE} ]] && eautoreconf
+
+ # Tweak the init script
+ local avahi_init=
+ local iscsi_init=
+ local rbd_init=
+ cp "${FILESDIR}/libvirtd.init-r10" "${S}/libvirtd.init"
+ use avahi && avahi_init='need avahi-daemon'
+ use iscsi && iscsi_init='iscsid'
+ use rbd && rbd_init='ceph'
+
+ sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init"
+ sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init"
+ sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init"
+}
+
+src_configure() {
+ local myconf=""
+
+ myconf="${myconf} $(use_enable debug)"
+
+ ## enable/disable daemon, otherwise client only utils
+ myconf="${myconf} $(use_with libvirtd)"
+
+ ## enable/disable the daemon using avahi to find VMs
+ myconf="${myconf} $(use_with avahi)"
+
+ ## hypervisors on the local host
+ myconf="${myconf} $(use_with xen) $(use_with xen xen-inotify)"
+ # leave it automagic as it depends on the version of xen used.
+ use xen || myconf+=" --without-libxl"
+ use xen || myconf+=" --without-xenapi"
+ myconf="${myconf} $(use_with openvz)"
+ myconf="${myconf} $(use_with lxc)"
+ if use virtualbox && has_version app-emulation/virtualbox-ose; then
+ myconf="${myconf} --with-vbox=/usr/lib/virtualbox-ose/"
+ else
+ myconf="${myconf} $(use_with virtualbox vbox)"
+ fi
+ myconf="${myconf} $(use_with uml)"
+ myconf="${myconf} $(use_with qemu)"
+ myconf="${myconf} $(use_with qemu yajl)" # Use QMP over HMP
+ myconf="${myconf} $(use_with phyp)"
+ myconf="${myconf} --with-esx"
+ myconf="${myconf} --with-vmware"
+
+ ## additional host drivers
+ myconf="${myconf} $(use_with virt-network network)"
+ myconf="${myconf} --with-storage-fs"
+ myconf="${myconf} $(use_with lvm storage-lvm)"
+ myconf="${myconf} $(use_with iscsi storage-iscsi)"
+ myconf="${myconf} $(use_with parted storage-disk)"
+ myconf="${myconf} $(use_with lvm storage-mpath)"
+ myconf="${myconf} $(use_with rbd storage-rbd)"
+ myconf="${myconf} $(use_with numa numactl)"
+ myconf="${myconf} $(use_with numa numad)"
+ myconf="${myconf} $(use_with selinux)"
+
+ # udev for device support details
+ myconf="${myconf} $(use_with udev)"
+
+ # linux capability support so we don't need privileged accounts
+ myconf="${myconf} $(use_with caps capng)"
+
+ ## auth stuff
+ myconf="${myconf} $(use_with policykit polkit)"
+ myconf="${myconf} $(use_with sasl)"
+
+ # network bits
+ myconf="${myconf} $(use_with macvtap)"
+ myconf="${myconf} $(use_with pcap libpcap)"
+ myconf="${myconf} $(use_with vepa virtualport)"
+
+ ## other
+ myconf="${myconf} $(use_enable nls)"
+ myconf="${myconf} $(use_with python)"
+
+ # user privilege bits fir qemu/kvm
+ if use caps; then
+ myconf="${myconf} --with-qemu-user=qemu"
+ myconf="${myconf} --with-qemu-group=qemu"
+ else
+ myconf="${myconf} --with-qemu-user=root"
+ myconf="${myconf} --with-qemu-group=root"
+ fi
+
+ # audit support
+ myconf="${myconf} $(use_with audit)"
+
+ ## stuff we don't yet support
+ myconf="${myconf} --without-netcf"
+
+ # we use udev over hal
+ myconf="${myconf} --without-hal"
+
+ # locking support
+ myconf="${myconf} --without-sanlock"
+
+ # this is a nasty trick to work around the problem in bug
+ # #275073. The reason why we don't solve this properly is that
+ # it'll require us to rebuild autotools (and we don't really want
+ # to do that right now). The proper solution has been sent
+ # upstream and should hopefully land in 0.7.7, in the mean time,
+ # mime the same functionality with this.
+ case ${CHOST} in
+ *cygwin* | *mingw* )
+ ;;
+ *)
+ ac_cv_prog_WINDRES=no
+ ;;
+ esac
+
+ econf \
+ ${myconf} \
+ --disable-static \
+ --docdir=/usr/share/doc/${PF} \
+ --with-remote \
+ --localstatedir=/var
+
+ if [[ ${PV} = *9999* ]]; then
+ # Restore gnulib's config.sub and config.guess
+ # bug #377279
+ (cd .gnulib && git reset --hard > /dev/null)
+ fi
+}
+
+src_test() {
+ # Explicitly allow parallel build of tests
+ HOME="${T}" emake check || die "tests failed"
+}
+
+src_install() {
+ emake install \
+ DESTDIR="${D}" \
+ HTML_DIR=/usr/share/doc/${PF}/html \
+ DOCS_DIR=/usr/share/doc/${PF}/python \
+ EXAMPLE_DIR=/usr/share/doc/${PF}/python/examples \
+ || die "emake install failed"
+
+ find "${D}" -name '*.la' -delete || die
+
+ use libvirtd || return 0
+ # From here, only libvirtd-related instructions, be warned!
+
+ newinitd "${S}/libvirtd.init" libvirtd || die
+ newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die
+
+ keepdir /var/lib/libvirt/images
+}
+
+pkg_preinst() {
+ # we only ever want to generate this once
+ if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
+ rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
+ fi
+
+ # We really don't want to use or support old PolicyKit cause it
+ # screws with the new polkit integration
+ if has_version sys-auth/policykit; then
+ rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy
+ fi
+
+ # Only sysctl files ending in .conf work
+ mv "${D}"/etc/sysctl.d/libvirtd "${D}"/etc/sysctl.d/libvirtd.conf
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize libvirt.py
+
+ # support for dropped privileges
+ if use qemu; then
+ fperms 0750 "${EROOT}/var/lib/libvirt/qemu"
+ fperms 0750 "${EROOT}/var/cache/libvirt/qemu"
+ fi
+
+ if use caps && use qemu; then
+ fowners -R qemu:qemu "${EROOT}/var/lib/libvirt/qemu"
+ fowners -R qemu:qemu "${EROOT}/var/cache/libvirt/qemu"
+ elif use qemu; then
+ fowners -R root:root "${EROOT}/var/lib/libvirt/qemu"
+ fowners -R root:root "${EROOT}/var/cache/libvirt/qemu"
+ fi
+
+ if ! use policykit; then
+ elog "To allow normal users to connect to libvirtd you must change the"
+ elog "unix sock group and/or perms in /etc/libvirt/libvirtd.conf"
+ fi
+
+ use libvirtd || return 0
+ # From here, only libvirtd-related instructions, be warned!
+
+ elog
+ elog "For the basic networking support (bridged and routed networks)"
+ elog "you don't need any extra software. For more complex network modes"
+ elog "including but not limited to NATed network, you can enable the"
+ elog "'virt-network' USE flag."
+ elog
+ if has_version net-dns/dnsmasq; then
+ ewarn "If you have a DNS server setup on your machine, you will have"
+ ewarn "to configure /etc/dnsmasq.conf to enable the following settings: "
+ ewarn " bind-interfaces"
+ ewarn " interface or except-interface"
+ ewarn
+ ewarn "Otherwise you might have issues with your existing DNS server."
+ fi
+
+ if use caps && use qemu; then
+ elog "libvirt will now start qemu/kvm VMs with non-root privileges."
+ elog "Ensure any resources your VMs use are accessible by qemu:qemu"
+ fi
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup libvirt.py
+}