Gentoo Archives: gentoo-commits

From: Matthias Maier <tamiko@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/libvirt/, app-emulation/libvirt/files/
Date: Mon, 01 Jul 2019 15:07:08
Message-Id: 1561992575.fe85605d7f9563c46de2be1cd3e777659015d8ed.tamiko@gentoo
1 commit: fe85605d7f9563c46de2be1cd3e777659015d8ed
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 1 14:45:25 2019 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 1 14:49:35 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe85605d
7
8 app-emulation/libvirt: version bump to 5.4.0
9
10 - introduce USE=dtrace to avoid an automagic dependency on
11 /usr/bin/dtrace. I skipped the systemtap[libvirt] use-dependency to
12 make initial bootstrapping less annoying.
13
14 - Also synchronize time in openrc domain resume script
15
16 Closes: https://bugs.gentoo.org/675166
17 Closes: https://bugs.gentoo.org/688040
18 Package-Manager: Portage-2.3.68, Repoman-2.3.16
19 Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>
20
21 app-emulation/libvirt/Manifest | 1 +
22 app-emulation/libvirt/files/libvirt-guests.init-r4 | 237 +++++++++++++
23 app-emulation/libvirt/libvirt-5.4.0.ebuild | 390 +++++++++++++++++++++
24 app-emulation/libvirt/metadata.xml | 1 +
25 4 files changed, 629 insertions(+)
26
27 diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest
28 index 9eb1b16233c..2e1cb5c5854 100644
29 --- a/app-emulation/libvirt/Manifest
30 +++ b/app-emulation/libvirt/Manifest
31 @@ -1,2 +1,3 @@
32 DIST libvirt-4.9.0.tar.xz 14744184 BLAKE2B 03ddefc8f505c8688ad506b81ea9b37ee085e4c9c429834c6b6f338981bfc3c6034a5455a79feca604fb36e658de766ee6104aeed690c682ae596d10eb5632a9 SHA512 3cfada940f9de6cc4b0504e089f41aa03d9986f0163344dd3b3ab8e6c4eb556a56996dc8f24bca913b036862c75b256628ea9ab7674ef0a57b87f47c58689e90
33 DIST libvirt-5.2.0.tar.xz 14992888 BLAKE2B d68aedb634a70063a116e112689f252d3fc2fe5369a4cdde8cacd392e806203bf277406bb10c751bae27f34f27a38355fde84573b6221fc4843393f9ae60ae5c SHA512 378dc1552263cce746117487abc0a1f3411e5be149331717158ba23825734ceae7ca474290264d71de798fdd089ad9672026bcb242fa5b3aef87294284d06f04
34 +DIST libvirt-5.4.0.tar.xz 12346896 BLAKE2B 28efa8ddc1b3262cf195bb114d3fad8307e7b4b4578a8dca05c03e36c85c7bffb4a4f6c73f89d156fc5b046f8ff7f27950dc5cadfd944e9f3c1b854ad03f328c SHA512 03fa932d041d147cab79eab200bb33f8db72579be72ec7cbff3305f4a8d574835a80f1b99936eddf67f83d21cc5567f45c86e555209de6cd702f43f91197cfd0
35
36 diff --git a/app-emulation/libvirt/files/libvirt-guests.init-r4 b/app-emulation/libvirt/files/libvirt-guests.init-r4
37 new file mode 100644
38 index 00000000000..b29f04c24a5
39 --- /dev/null
40 +++ b/app-emulation/libvirt/files/libvirt-guests.init-r4
41 @@ -0,0 +1,237 @@
42 +#!/sbin/openrc-run
43 +
44 +description="Virtual Machine Management (libvirt) Guests"
45 +
46 +depend() {
47 + use libvirtd
48 +}
49 +
50 +# set the default to QEMU
51 +[ -z "${LIBVIRT_URIS}" ] && LIBVIRT_URIS="qemu:///system"
52 +
53 +# default to suspending the VM via managedsave
54 +case "${LIBVIRT_SHUTDOWN}" in
55 + managedsave|shutdown|destroy) ;;
56 + *) LIBVIRT_SHUTDOWN="managedsave" ;;
57 +esac
58 +
59 +# default to 500 seconds
60 +[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500
61 +
62 +gueststatefile="/var/lib/libvirt/libvirt-guests.state"
63 +netstatefile="/var/lib/libvirt/libvirt-net.state"
64 +
65 +do_virsh() {
66 + local hvuri=$1
67 + shift
68 +
69 + # if unset, default to qemu
70 + [ -z ${hvuri} ] && hvuri="qemu:///system"
71 + # if only qemu was supplied then correct the value
72 + [ "xqemu" = x${hvuri} ] && hvuri="qemu:///system"
73 +
74 + # Silence errors because virsh always throws an error about
75 + # not finding the hypervisor version when connecting to libvirtd
76 + # lastly strip the blank line at the end
77 + LC_ALL=C virsh -c ${hvuri} "$@" 2>/dev/null | head -n -1
78 +}
79 +
80 +libvirtd_dom_list() {
81 + # Only work with domains by their UUIDs
82 + local hvuri=$1
83 + shift
84 +
85 + # The grep is to remove dom0 for xen domains. Otherwise we never hit 0
86 + do_virsh "${hvuri}" list --uuid $@ | grep -v 00000000-0000-0000-0000-000000000000
87 +}
88 +
89 +libvirtd_dom_count() {
90 + local hvuri=$1
91 + shift
92 +
93 + libvirtd_dom_list "${hvuri}" $@ | wc -l
94 +}
95 +
96 +libvirtd_net_list() {
97 + # Only work with networks by their UUIDs
98 + local hvuri=$1
99 + shift
100 +
101 + do_virsh "${hvuri}" net-list --uuid $@
102 +}
103 +
104 +libvirtd_net_count() {
105 + local hvuri=$1
106 + shift
107 +
108 + libvirtd_net_list "${hvuri}" $@ | wc -l
109 +}
110 +
111 +libvirtd_dom_stop() {
112 + # stops all persistent or transient domains for a given URI
113 + # $1 - uri
114 + # $2 - persisent/transient
115 +
116 + local uri=$1
117 + local persist=$2
118 + local shutdown_type=${LIBVIRT_SHUTDOWN}
119 + local counter=${LIBVIRT_MAXWAIT}
120 + local dom_name=
121 + local dom_as=
122 + local dom_ids=
123 + local uuid=
124 + local dom_count=
125 +
126 + [ "${persist}" = "--transient" ] && shutdown_type="shutdown"
127 + [ -n "${counter}" ] || counter=500
128 +
129 + einfo " Shutting down domain(s) ..."
130 +
131 + # grab all persistent or transient domains running
132 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
133 +
134 + for uuid in ${dom_ids}; do
135 + # Get the name
136 + dom_name=$(do_virsh ${uri} domname ${uuid})
137 + einfo " ${dom_name}"
138 + # Get autostart state
139 + dom_as=$(do_virsh ${uri} dominfo ${uuid} | \
140 + awk '$1 == "Autostart:" { print $2 }')
141 +
142 + if [ "${persist}" = "--persistent" ]; then
143 + # Save our running state only if LIBVIRT_IGNORE_AUTOSTART != yes
144 + if [ "x${LIBVIRT_IGNORE_AUTOSTART}" = "xyes" ] && \
145 + [ ${dom_as} = "enabled" ]; then
146 + :
147 + else
148 + echo "${uri} ${uuid}" >> ${gueststatefile}
149 + fi
150 +
151 + fi
152 +
153 + # Now let's stop it
154 + do_virsh "${uri}" ${shutdown_type} ${uuid} > /dev/null
155 +
156 + done
157 +
158 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
159 + while [ ${dom_count} -gt 0 ] && [ ${counter} -gt 0 ] ; do
160 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
161 + sleep 1
162 + if [ "${shutdown_type}" = "shutdown" ]; then
163 + counter=$((${counter} - 1))
164 + fi
165 + printf "."
166 + done
167 +
168 + if [ "${shutdown_type}" = "shutdown" ]; then
169 + # grab all domains still running
170 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
171 + for uuid in ${dom_ids}; do
172 + dom_name=$(do_virsh ${uri} domname ${uuid})
173 + eerror " ${dom_name} forcibly stopped"
174 + do_virsh "${uri}" destroy ${uuid} > /dev/null
175 + done
176 + fi
177 +}
178 +
179 +libvirtd_net_stop() {
180 + # stops all persistent or transient domains for a given URI
181 + # $1 - uri
182 + # $2 - persisent/transient
183 +
184 + local uri=$1
185 + local persist=$2
186 + local uuid=
187 + local net_name=
188 +
189 + if [ "${LIBVIRT_NET_SHUTDOWN}" != "no" ]; then
190 +
191 + einfo " Shutting down network(s):"
192 + for uuid in $(libvirtd_net_list ${uri} ${persist}); do
193 + net_name=$(do_virsh ${uri} net-name ${uuid})
194 + einfo " ${net_name}"
195 +
196 + if [ "${persist}" = "--persistent" ]; then
197 + # Save our running state
198 + echo "${uri} ${uuid}" >> ${netstatefile}
199 +
200 + fi
201 +
202 + # Actually stop the network
203 + do_virsh qemu net-destroy ${uuid} > /dev/null
204 + done
205 +
206 + fi
207 +}
208 +
209 +start() {
210 + local uri=
211 + local uuid=
212 + local name=
213 +
214 + for uri in ${LIBVIRT_URIS}; do
215 + do_virsh "${uri}" connect
216 + if [ $? -ne 0 ]; then
217 + eerror "Failed to connect to '${uri}'. Domains may not start."
218 + fi
219 + done
220 +
221 + [ ! -e "${netstatefile}" ] && touch "${netstatefile}"
222 + [ ! -e "${gueststatefile}" ] && touch "${gueststatefile}"
223 +
224 + # if the user didn't want to start any guests up then respect their wish
225 + [ "x${LIBVIRT_START}" = "xno" ] && return 0
226 +
227 + # start networks
228 + ebegin "Starting libvirt networks"
229 + while read -r uri uuid
230 + do
231 + # ignore trash
232 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
233 +
234 + name=$(do_virsh "${uri}" net-name ${uuid})
235 + einfo " ${name}"
236 + do_virsh "${uri}" net-start ${uuid} > /dev/null
237 + done <"${netstatefile}"
238 + eend 0
239 +
240 + # start domains
241 + ebegin "Starting libvirt domains"
242 + while read -r uri uuid
243 + do
244 + # ignore trash
245 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
246 +
247 + name=$(do_virsh "${uri}" domname ${uuid})
248 + einfo " ${name}"
249 + do_virsh "${uri}" start ${uuid} > /dev/null
250 + do_virsh "${uri}" domtime --sync ${uuid} > /dev/null
251 + done <"${gueststatefile}"
252 + eend 0
253 +}
254 +
255 +stop() {
256 + local counter=
257 + local dom_name=
258 + local net_name=
259 + local dom_ids=
260 + local uuid=
261 + local dom_count=
262 +
263 + rm -f "${gueststatefile}"
264 + [ $? -ne 0 ] && eerror "Unable to save domain state"
265 + rm -f "${netstatefile}"
266 + [ $? -ne 0 ] && eerror "Unable to save net state"
267 +
268 + for uri in ${LIBVIRT_URIS}; do
269 + einfo "Stopping libvirt domains and networks for ${uri}"
270 +
271 + libvirtd_dom_stop "${uri}" "--persistent"
272 + libvirtd_dom_stop "${uri}" "--transient"
273 + libvirtd_net_stop "${uri}" "--persistent"
274 + libvirtd_net_stop "${uri}" "--transient"
275 +
276 + einfo "Done stopping domains and networks for ${uri}"
277 + done
278 +}
279
280 diff --git a/app-emulation/libvirt/libvirt-5.4.0.ebuild b/app-emulation/libvirt/libvirt-5.4.0.ebuild
281 new file mode 100644
282 index 00000000000..43f6e7a0ec9
283 --- /dev/null
284 +++ b/app-emulation/libvirt/libvirt-5.4.0.ebuild
285 @@ -0,0 +1,390 @@
286 +# Copyright 1999-2019 Gentoo Authors
287 +# Distributed under the terms of the GNU General Public License v2
288 +
289 +EAPI=7
290 +
291 +PYTHON_COMPAT=( python3_{5,6,7} )
292 +
293 +inherit autotools bash-completion-r1 eutils linux-info python-any-r1 readme.gentoo-r1 systemd user
294 +
295 +if [[ ${PV} = *9999* ]]; then
296 + inherit git-r3
297 + EGIT_REPO_URI="https://libvirt.org/git/libvirt.git"
298 + SRC_URI=""
299 + KEYWORDS=""
300 + SLOT="0"
301 +else
302 + SRC_URI="https://libvirt.org/sources/${P}.tar.xz"
303 + KEYWORDS="~amd64 ~arm64 ~x86"
304 + SLOT="0/${PV}"
305 +fi
306 +
307 +DESCRIPTION="C toolkit to manipulate virtual machines"
308 +HOMEPAGE="http://www.libvirt.org/"
309 +LICENSE="LGPL-2.1"
310 +IUSE="
311 + apparmor audit +caps +dbus dtrace firewalld fuse glusterfs iscsi
312 + iscsi-direct +libvirtd lvm libssh lxc +macvtap nfs nls numa openvz
313 + parted pcap phyp policykit +qemu rbd sasl selinux +udev +vepa
314 + virtualbox virt-network wireshark-plugins xen zeroconf zfs
315 +"
316 +
317 +REQUIRED_USE="
318 + firewalld? ( virt-network )
319 + libvirtd? ( || ( lxc openvz qemu virtualbox xen ) )
320 + lxc? ( caps libvirtd )
321 + openvz? ( libvirtd )
322 + policykit? ( dbus )
323 + qemu? ( libvirtd )
324 + vepa? ( macvtap )
325 + virt-network? ( libvirtd )
326 + virtualbox? ( libvirtd )
327 + xen? ( libvirtd )"
328 +
329 +# gettext.sh command is used by the libvirt command wrappers, and it's
330 +# non-optional, so put it into RDEPEND.
331 +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
332 +# package will use 3 by default. Since we don't have slot pinning in an API,
333 +# we must go with the most recent
334 +RDEPEND="
335 + app-misc/scrub
336 + dev-libs/libgcrypt:0
337 + dev-libs/libnl:3
338 + >=dev-libs/libxml2-2.7.6
339 + >=net-analyzer/openbsd-netcat-1.105-r1
340 + >=net-libs/gnutls-1.0.25:0=
341 + net-libs/libssh2
342 + net-libs/libtirpc
343 + net-libs/rpcsvc-proto
344 + >=net-misc/curl-7.18.0
345 + sys-apps/dmidecode
346 + >=sys-apps/util-linux-2.17
347 + sys-devel/gettext
348 + sys-libs/ncurses:0=
349 + sys-libs/readline:=
350 + apparmor? ( sys-libs/libapparmor )
351 + audit? ( sys-process/audit )
352 + caps? ( sys-libs/libcap-ng )
353 + dbus? ( sys-apps/dbus )
354 + dtrace? ( dev-util/systemtap )
355 + firewalld? ( >=net-firewall/firewalld-0.6.3 )
356 + fuse? ( >=sys-fs/fuse-2.8.6:= )
357 + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 )
358 + iscsi? ( sys-block/open-iscsi )
359 + iscsi-direct? ( >=net-libs/libiscsi-1.18.0 )
360 + libssh? ( net-libs/libssh )
361 + lvm? ( >=sys-fs/lvm2-2.02.48-r2[-device-mapper-only(-)] )
362 + nfs? ( net-fs/nfs-utils )
363 + numa? (
364 + >sys-process/numactl-2.0.2
365 + sys-process/numad
366 + )
367 + parted? (
368 + >=sys-block/parted-1.8[device-mapper]
369 + sys-fs/lvm2[-device-mapper-only(-)]
370 + )
371 + pcap? ( >=net-libs/libpcap-1.0.0 )
372 + policykit? ( >=sys-auth/polkit-0.9 )
373 + qemu? (
374 + >=app-emulation/qemu-1.5.0
375 + dev-libs/yajl
376 + )
377 + rbd? ( sys-cluster/ceph )
378 + sasl? ( dev-libs/cyrus-sasl )
379 + selinux? ( >=sys-libs/libselinux-2.0.85 )
380 + virt-network? (
381 + net-dns/dnsmasq[script]
382 + net-firewall/ebtables
383 + >=net-firewall/iptables-1.4.10[ipv6]
384 + net-misc/radvd
385 + sys-apps/iproute2[-minimal]
386 + )
387 + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
388 + wireshark-plugins? ( net-analyzer/wireshark:= )
389 + xen? (
390 + >=app-emulation/xen-4.6.0
391 + app-emulation/xen-tools:=
392 + )
393 + udev? (
394 + virtual/udev
395 + >=x11-libs/libpciaccess-0.10.9
396 + )
397 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
398 + zfs? ( sys-fs/zfs )"
399 +
400 +DEPEND="${RDEPEND}
401 + ${PYTHON_DEPS}
402 + app-text/xhtml1
403 + dev-lang/perl
404 + dev-libs/libxslt
405 + dev-perl/XML-XPath
406 + virtual/pkgconfig"
407 +
408 +PATCHES=(
409 + "${FILESDIR}"/${PN}-5.2.0-do-not-use-sysconf.patch
410 + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch
411 + "${FILESDIR}"/${PN}-5.2.0-fix-paths-for-apparmor.patch
412 + "${FILESDIR}"/${PN}-5.2.0-md-clear.patch
413 +)
414 +
415 +pkg_setup() {
416 + if use qemu; then
417 + enewgroup qemu 77
418 + enewuser qemu 77 -1 -1 "qemu,kvm"
419 + fi
420 +
421 + use policykit && enewgroup libvirt
422 +
423 + # Check kernel configuration:
424 + CONFIG_CHECK=""
425 + use fuse && CONFIG_CHECK+="
426 + ~FUSE_FS"
427 +
428 + use lvm && CONFIG_CHECK+="
429 + ~BLK_DEV_DM
430 + ~DM_MULTIPATH
431 + ~DM_SNAPSHOT"
432 +
433 + use lxc && CONFIG_CHECK+="
434 + ~BLK_CGROUP
435 + ~CGROUP_CPUACCT
436 + ~CGROUP_DEVICE
437 + ~CGROUP_FREEZER
438 + ~CGROUP_NET_PRIO
439 + ~CGROUP_PERF
440 + ~CGROUPS
441 + ~CGROUP_SCHED
442 + ~CPUSETS
443 + ~IPC_NS
444 + ~MACVLAN
445 + ~NAMESPACES
446 + ~NET_CLS_CGROUP
447 + ~NET_NS
448 + ~PID_NS
449 + ~POSIX_MQUEUE
450 + ~SECURITYFS
451 + ~USER_NS
452 + ~UTS_NS
453 + ~VETH
454 + ~!GRKERNSEC_CHROOT_MOUNT
455 + ~!GRKERNSEC_CHROOT_DOUBLE
456 + ~!GRKERNSEC_CHROOT_PIVOT
457 + ~!GRKERNSEC_CHROOT_CHMOD
458 + ~!GRKERNSEC_CHROOT_CAPS"
459 +
460 + kernel_is lt 4 7 && use lxc && CONFIG_CHECK+="
461 + ~DEVPTS_MULTIPLE_INSTANCES"
462 +
463 + use macvtap && CONFIG_CHECK+="
464 + ~MACVTAP"
465 +
466 + use virt-network && CONFIG_CHECK+="
467 + ~BRIDGE_EBT_MARK_T
468 + ~BRIDGE_NF_EBTABLES
469 + ~NETFILTER_ADVANCED
470 + ~NETFILTER_XT_CONNMARK
471 + ~NETFILTER_XT_MARK
472 + ~NETFILTER_XT_TARGET_CHECKSUM
473 + ~IP_NF_FILTER
474 + ~IP_NF_MANGLE
475 + ~IP_NF_NAT
476 + ~IP_NF_TARGET_MASQUERADE
477 + ~IP6_NF_FILTER
478 + ~IP6_NF_MANGLE
479 + ~IP6_NF_NAT"
480 + # Bandwidth Limiting Support
481 + use virt-network && CONFIG_CHECK+="
482 + ~BRIDGE_EBT_T_NAT
483 + ~IP_NF_TARGET_REJECT
484 + ~NET_ACT_POLICE
485 + ~NET_CLS_FW
486 + ~NET_CLS_U32
487 + ~NET_SCH_HTB
488 + ~NET_SCH_INGRESS
489 + ~NET_SCH_SFQ"
490 +
491 + # Handle specific kernel versions for different features
492 + kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
493 + if kernel_is ge 3 6; then
494 + CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP "
495 + kernel_is lt 4 5 && CONFIG_CHECK+=" ~MEMCG_KMEM "
496 + fi
497 +
498 + ERROR_USER_NS="Optional depending on LXC configuration."
499 +
500 + if [[ -n ${CONFIG_CHECK} ]]; then
501 + linux-info_pkg_setup
502 + fi
503 +}
504 +
505 +src_prepare() {
506 + touch "${S}/.mailmap"
507 +
508 + default
509 +
510 + if [[ ${PV} = *9999* ]]; then
511 + # Reinitialize submodules as this is required for gnulib's bootstrap
512 + git submodule init
513 + # git checkouts require bootstrapping to create the configure script.
514 + # Additionally the submodules must be cloned to the right locations
515 + # bug #377279
516 + ./bootstrap || die "bootstrap failed"
517 + (
518 + git submodule status .gnulib | awk '{ print $1 }'
519 + git hash-object bootstrap.conf
520 + git ls-tree -d HEAD gnulib/local | awk '{ print $3 }'
521 + ) >.git-module-status
522 + fi
523 +
524 + # Tweak the init script:
525 + cp "${FILESDIR}/libvirtd.init-r17" "${S}/libvirtd.init" || die
526 + sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \
527 + -e "s/USE_FLAG_AVAHI/$(usex zeroconf 'use avahi-daemon' '')/" \
528 + -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \
529 + -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \
530 + -i "${S}/libvirtd.init" || die "sed failed"
531 +
532 + eautoreconf
533 +}
534 +
535 +src_configure() {
536 + local myeconfargs=(
537 + $(use_with apparmor)
538 + $(use_with apparmor apparmor-profiles)
539 + $(use_with audit)
540 + $(use_with caps capng)
541 + $(use_with dbus)
542 + $(use_with dtrace)
543 + $(use_with firewalld)
544 + $(use_with fuse)
545 + $(use_with glusterfs)
546 + $(use_with glusterfs storage-gluster)
547 + $(use_with iscsi storage-iscsi)
548 + $(use_with iscsi-direct storage-iscsi-direct)
549 + $(use_with libvirtd)
550 + $(use_with libssh)
551 + $(use_with lvm storage-lvm)
552 + $(use_with lvm storage-mpath)
553 + $(use_with lxc)
554 + $(use_with macvtap)
555 + $(use_enable nls)
556 + $(use_with numa numactl)
557 + $(use_with numa numad)
558 + $(use_with openvz)
559 + $(use_with parted storage-disk)
560 + $(use_with pcap libpcap)
561 + $(use_with phyp)
562 + $(use_with policykit polkit)
563 + $(use_with qemu)
564 + $(use_with qemu yajl)
565 + $(use_with rbd storage-rbd)
566 + $(use_with sasl)
567 + $(use_with selinux)
568 + $(use_with udev)
569 + $(use_with vepa virtualport)
570 + $(use_with virt-network network)
571 + $(use_with wireshark-plugins wireshark-dissector)
572 + $(use_with xen libxl)
573 + $(use_with zeroconf avahi)
574 + $(use_with zfs storage-zfs)
575 +
576 + --without-hal
577 + --without-netcf
578 + --without-sanlock
579 +
580 + --with-esx
581 + --with-init-script=systemd
582 + --with-qemu-group=$(usex caps qemu root)
583 + --with-qemu-user=$(usex caps qemu root)
584 + --with-remote
585 + --with-storage-fs
586 + --with-vmware
587 +
588 + --disable-static
589 + --disable-werror
590 +
591 + --with-html-subdir=${PF}/html
592 + --localstatedir=/var
593 + )
594 +
595 + if use virtualbox && has_version app-emulation/virtualbox-ose; then
596 + myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ )
597 + else
598 + myeconfargs+=( $(use_with virtualbox vbox) )
599 + fi
600 +
601 + econf "${myeconfargs[@]}"
602 +
603 + if [[ ${PV} = *9999* ]]; then
604 + # Restore gnulib's config.sub and config.guess
605 + # bug #377279
606 + (cd .gnulib && git reset --hard > /dev/null)
607 + fi
608 +}
609 +
610 +src_test() {
611 + cd "${BUILD_DIR}"
612 +
613 + # remove problematic tests, bug #591416, bug #591418
614 + sed -i -e 's#commandtest$(EXEEXT) # #' \
615 + -e 's#virfirewalltest$(EXEEXT) # #' \
616 + -e 's#nwfilterebiptablestest$(EXEEXT) # #' \
617 + -e 's#nwfilterxml2firewalltest$(EXEEXT)$##' \
618 + tests/Makefile
619 +
620 + export VIR_TEST_DEBUG=1
621 + HOME="${T}" emake check || die "tests failed"
622 +}
623 +
624 +src_install() {
625 + emake DESTDIR="${D}" \
626 + SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
627 +
628 + find "${D}" -name '*.la' -delete || die
629 +
630 + # Remove bogus, empty directories. They are either not used, or
631 + # libvirtd is able to create them on demand
632 + rm -rf "${D}"/etc/sysconfig
633 + rm -rf "${D}"/var
634 +
635 + use libvirtd || return 0
636 + # From here, only libvirtd-related instructions, be warned!
637 +
638 + systemd_install_serviced \
639 + "${FILESDIR}"/libvirtd.service.conf libvirtd.service
640 +
641 + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf
642 +
643 + newinitd "${S}/libvirtd.init" libvirtd || die
644 + newinitd "${FILESDIR}/libvirt-guests.init-r4" libvirt-guests || die
645 + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die
646 + newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die
647 +
648 + newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
649 + newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
650 +
651 + newbashcomp "${S}/tools/bash-completion/vsh" virsh
652 + bashcomp_alias virsh virt-admin
653 +
654 + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
655 + DISABLE_AUTOFORMATTING=true
656 + readme.gentoo_create_doc
657 +}
658 +
659 +pkg_preinst() {
660 + # we only ever want to generate this once
661 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
662 + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
663 + fi
664 +}
665 +
666 +pkg_postinst() {
667 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
668 + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
669 + fi
670 +
671 + use libvirtd || return 0
672 + # From here, only libvirtd-related instructions, be warned!
673 +
674 + readme.gentoo_print_elog
675 +}
676
677 diff --git a/app-emulation/libvirt/metadata.xml b/app-emulation/libvirt/metadata.xml
678 index 63d0a74b30b..88e6c96b8d8 100644
679 --- a/app-emulation/libvirt/metadata.xml
680 +++ b/app-emulation/libvirt/metadata.xml
681 @@ -56,6 +56,7 @@
682 </flag>
683 <!-- Miscellaneous flags -->
684 <flag name="apparmor">Enable AppArmor support</flag>
685 + <flag name="dtrace">Enable dtrace support via <pkg>dev-util/systemtap</pkg></flag>
686 <flag name="fuse">Allow LXC to use <pkg>sys-fs/fuse</pkg> for mount
687 points</flag>
688 <flag name="numa">