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: Fri, 29 Jun 2018 04:50:38
Message-Id: 1530245813.0bf491bcef90eebd7d111056dd3daee32a4b00e8.tamiko@gentoo
1 commit: 0bf491bcef90eebd7d111056dd3daee32a4b00e8
2 Author: Matthias Maier <tamiko <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 29 04:15:49 2018 +0000
4 Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 29 04:16:53 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bf491bc
7
8 app-emulation/libvirt: version bump to 4.4.0
9
10 Closes: https://bugs.gentoo.org/657666
11
12 Package-Manager: Portage-2.3.41, Repoman-2.3.9
13
14 app-emulation/libvirt/Manifest | 1 +
15 .../files/libvirt-4.4.0-do_not_use_sysconf.patch | 216 ++++++++++++
16 app-emulation/libvirt/libvirt-4.4.0.ebuild | 381 +++++++++++++++++++++
17 3 files changed, 598 insertions(+)
18
19 diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest
20 index a62d33f2a7b..2733e11b04b 100644
21 --- a/app-emulation/libvirt/Manifest
22 +++ b/app-emulation/libvirt/Manifest
23 @@ -1 +1,2 @@
24 DIST libvirt-4.3.0.tar.xz 14667860 BLAKE2B bd4dfbcfba3b11036be979caf938ec7ca4fc04cc4bd6dfd5eec05c054ba4ebf953c0e86a080e65ab8a880f2bcc2f4d018283e870afcb64bd0b750247f3c96357 SHA512 cc61497121931019a8cc3fa8234d7cf95b0f0e1d77ab6fcd089db92759617b099eb83c57aa91768ae6ccf92c345cf72e1d9b202acb5132a159476fb86f1a6999
25 +DIST libvirt-4.4.0.tar.xz 14668912 BLAKE2B 04f7a48618924bb8bbe1621572d260a01626687c66ed45d1a08d745210fc522fba63387a0433c0c55e41a5655267c094c16b7ff97f9e45b17419dfc83f465c79 SHA512 725b9b093a2aaeab6fdcb8df341a400ab363bcd50af8400dfd0593c41d8fbc8352f89147be9fbfde2e8418cc7298e090fe07ec7255b0aff1f0d001b93322f93f
26
27 diff --git a/app-emulation/libvirt/files/libvirt-4.4.0-do_not_use_sysconf.patch b/app-emulation/libvirt/files/libvirt-4.4.0-do_not_use_sysconf.patch
28 new file mode 100644
29 index 00000000000..3e430cba1d2
30 --- /dev/null
31 +++ b/app-emulation/libvirt/files/libvirt-4.4.0-do_not_use_sysconf.patch
32 @@ -0,0 +1,216 @@
33 +From a365e2d5b4af1ab2be743773412fe265579a9a0b Mon Sep 17 00:00:00 2001
34 +Message-Id: <a365e2d5b4af1ab2be743773412fe265579a9a0b.1529989118.git.mprivozn@××××××.com>
35 +From: Michal Privoznik <mprivozn@××××××.com>
36 +Date: Tue, 26 Jun 2018 06:51:06 +0200
37 +Subject: [PATCH] gentoo: do not use sysconf
38 +
39 +Signed-off-by: Michal Privoznik <mprivozn@××××××.com>
40 +---
41 + src/Makefile.am | 29 ++++++-----------------------
42 + src/locking/virtlockd.service.in | 3 +--
43 + src/logging/virtlogd.service.in | 3 +--
44 + src/remote/libvirtd.service.in | 3 +--
45 + tools/Makefile.am | 17 ++++-------------
46 + tools/libvirt-guests.service.in | 2 +-
47 + tools/libvirt-guests.sysconf | 7 +++++++
48 + 7 files changed, 21 insertions(+), 43 deletions(-)
49 +
50 +diff --git a/src/Makefile.am b/src/Makefile.am
51 +index db8c8ebd1a..63d7a9ca46 100644
52 +--- a/src/Makefile.am
53 ++++ b/src/Makefile.am
54 +@@ -757,23 +757,6 @@ endif WITH_SETUID_RPC_CLIENT
55 +
56 + EXTRA_DIST += $(SYSCONF_FILES)
57 +
58 +-install-sysconfig:
59 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
60 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
61 +- do \
62 +- tgt=`basename $$f`; \
63 +- $(INSTALL_DATA) $(srcdir)/$$f.sysconf \
64 +- $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
65 +- done
66 +-
67 +-uninstall-sysconfig:
68 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
69 +- do \
70 +- tgt=`basename $$f`; \
71 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
72 +- done
73 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
74 +-
75 + SYSVINIT_FILES_IN += \
76 + locking/virtlockd.init.in \
77 + $(NULL)
78 +@@ -814,14 +797,14 @@ uninstall-logrotate:
79 + endif ! WITH_LIBVIRTD
80 +
81 + if LIBVIRT_INIT_SCRIPT_RED_HAT
82 +-install-init:: $(SYSVINIT_FILES) install-sysconfig
83 ++install-init:: $(SYSVINIT_FILES)
84 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
85 + for f in $(SYSVINIT_FILES:%.init=%) ; \
86 + do \
87 + $(INSTALL_SCRIPT) $$f.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/$$f; \
88 + done
89 +
90 +-uninstall-init:: uninstall-sysconfig
91 ++uninstall-init::
92 + rm -f $(SYSVINIT_FILES:%.init=$(DESTDIR)$(sysconfdir)/rc.d/init.d/%)
93 + rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
94 +
95 +@@ -859,14 +842,14 @@ SYSTEMD_UNIT_FILES = $(notdir $(SYSTEMD_UNIT_FILES_IN:%.in=%))
96 + BUILT_SOURCES += $(SYSTEMD_UNIT_FILES)
97 + DISTCLEANFILES += $(SYSTEMD_UNIT_FILES)
98 +
99 +-install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
100 ++install-systemd: $(SYSTEMD_UNIT_FILES)
101 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
102 + for f in $(SYSTEMD_UNIT_FILES); \
103 + do \
104 + $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
105 + done
106 +
107 +-uninstall-systemd: uninstall-sysconfig
108 ++uninstall-systemd:
109 + rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
110 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
111 + else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
112 +@@ -884,7 +867,7 @@ EXTRA_DIST += $(UPSTART_FILES)
113 + if WITH_LIBVIRTD
114 + if LIBVIRT_INIT_SCRIPT_UPSTART
115 +
116 +-install-upstart: install-sysconfig
117 ++install-upstart:
118 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
119 + for f in $(UPSTART_FILES:%.upstart=%); \
120 + do \
121 +@@ -893,7 +876,7 @@ install-upstart: install-sysconfig
122 + $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
123 + done
124 +
125 +-uninstall-upstart: uninstall-sysconfig
126 ++uninstall-upstart:
127 + for f in $(UPSTART_FILES:%.upstart=%); \
128 + do \
129 + tgt=`basename $$f` ; \
130 +diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
131 +index 3c9d587032..2449b201d9 100644
132 +--- a/src/locking/virtlockd.service.in
133 ++++ b/src/locking/virtlockd.service.in
134 +@@ -7,8 +7,7 @@ Documentation=man:virtlockd(8)
135 + Documentation=https://libvirt.org
136 +
137 + [Service]
138 +-EnvironmentFile=-/etc/sysconfig/virtlockd
139 +-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
140 ++ExecStart=@sbindir@/virtlockd
141 + ExecReload=/bin/kill -USR1 $MAINPID
142 + # Loosing the locks is a really bad thing that will
143 + # cause the machine to be fenced (rebooted), so make
144 +diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
145 +index 3d9ae36150..43736191d5 100644
146 +--- a/src/logging/virtlogd.service.in
147 ++++ b/src/logging/virtlogd.service.in
148 +@@ -7,8 +7,7 @@ Documentation=man:virtlogd(8)
149 + Documentation=https://libvirt.org
150 +
151 + [Service]
152 +-EnvironmentFile=-/etc/sysconfig/virtlogd
153 +-ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
154 ++ExecStart=@sbindir@/virtlogd
155 + ExecReload=/bin/kill -USR1 $MAINPID
156 + # Loosing the logs is a really bad thing that will
157 + # cause the machine to be fenced (rebooted), so make
158 +diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
159 +index 7f689e08a8..239beeced9 100644
160 +--- a/src/remote/libvirtd.service.in
161 ++++ b/src/remote/libvirtd.service.in
162 +@@ -22,8 +22,7 @@ Documentation=https://libvirt.org
163 +
164 + [Service]
165 + Type=notify
166 +-EnvironmentFile=-/etc/sysconfig/libvirtd
167 +-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
168 ++ExecStart=@sbindir@/libvirtd
169 + ExecReload=/bin/kill -HUP $MAINPID
170 + KillMode=process
171 + Restart=on-failure
172 +diff --git a/tools/Makefile.am b/tools/Makefile.am
173 +index 1452d984a0..cef08741cb 100644
174 +--- a/tools/Makefile.am
175 ++++ b/tools/Makefile.am
176 +@@ -336,15 +336,6 @@ install-data-local: install-init install-systemd install-nss \
177 + uninstall-local: uninstall-init uninstall-systemd uninstall-nss \
178 + uninstall-bash-completion
179 +
180 +-install-sysconfig:
181 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
182 +- $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
183 +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
184 +-
185 +-uninstall-sysconfig:
186 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
187 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
188 +-
189 + EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
190 +
191 + install-initscript: libvirt-guests.init
192 +@@ -359,8 +350,8 @@ uninstall-initscript:
193 +
194 + if LIBVIRT_INIT_SCRIPT_RED_HAT
195 + BUILT_SOURCES += libvirt-guests.init
196 +-install-init: install-sysconfig install-initscript
197 +-uninstall-init: uninstall-sysconfig uninstall-initscript
198 ++install-init: install-initscript
199 ++uninstall-init: uninstall-initscript
200 + else ! LIBVIRT_INIT_SCRIPT_RED_HAT
201 + install-init:
202 + uninstall-init:
203 +@@ -391,12 +382,12 @@ EXTRA_DIST += libvirt-guests.service.in
204 + SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
205 +
206 + if LIBVIRT_INIT_SCRIPT_SYSTEMD
207 +-install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
208 ++install-systemd: libvirt-guests.service libvirt-guests.sh
209 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
210 + $(INSTALL_DATA) libvirt-guests.service \
211 + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
212 +
213 +-uninstall-systemd: uninstall-sysconfig
214 ++uninstall-systemd:
215 + rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
216 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
217 +
218 +diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
219 +index 491ca62138..f0f417bffb 100644
220 +--- a/tools/libvirt-guests.service.in
221 ++++ b/tools/libvirt-guests.service.in
222 +@@ -10,7 +10,7 @@ Documentation=man:libvirtd(8)
223 + Documentation=https://libvirt.org
224 +
225 + [Service]
226 +-EnvironmentFile=-/etc/sysconfig/libvirt-guests
227 ++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf
228 + # Hack just call traditional service until we factor
229 + # out the code
230 + ExecStart=@libexecdir@/libvirt-guests.sh start
231 +diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
232 +index 669b046507..45b0b9ea46 100644
233 +--- a/tools/libvirt-guests.sysconf
234 ++++ b/tools/libvirt-guests.sysconf
235 +@@ -1,3 +1,10 @@
236 ++#
237 ++# Warning: This configuration file is only sourced by the systemd
238 ++# libvirt-guests.service unit. The coresponding openrc facility is in
239 ++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd
240 ++#
241 ++
242 ++
243 + # URIs to check for running guests
244 + # example: URIS='default xen:///system vbox+tcp://host/system lxc:///system'
245 + #URIS=default
246 +--
247 +2.16.4
248 +
249
250 diff --git a/app-emulation/libvirt/libvirt-4.4.0.ebuild b/app-emulation/libvirt/libvirt-4.4.0.ebuild
251 new file mode 100644
252 index 00000000000..7a238888fab
253 --- /dev/null
254 +++ b/app-emulation/libvirt/libvirt-4.4.0.ebuild
255 @@ -0,0 +1,381 @@
256 +# Copyright 1999-2018 Gentoo Foundation
257 +# Distributed under the terms of the GNU General Public License v2
258 +
259 +EAPI=6
260 +
261 +inherit autotools eutils user linux-info systemd readme.gentoo-r1 bash-completion-r1
262 +
263 +if [[ ${PV} = *9999* ]]; then
264 + inherit git-r3
265 + EGIT_REPO_URI="git://libvirt.org/libvirt.git"
266 + SRC_URI=""
267 + KEYWORDS="amd64 x86"
268 + SLOT="0"
269 +else
270 + # Versions with 4 numbers are stable updates:
271 + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then
272 + SRC_URI="http://libvirt.org/sources/stable_updates/${P}.tar.xz"
273 + else
274 + SRC_URI="http://libvirt.org/sources/${P}.tar.xz"
275 + fi
276 + KEYWORDS="~amd64 ~arm64 ~x86"
277 + SLOT="0/${PV}"
278 +fi
279 +
280 +DESCRIPTION="C toolkit to manipulate virtual machines"
281 +HOMEPAGE="http://www.libvirt.org/"
282 +LICENSE="LGPL-2.1"
283 +IUSE="
284 + apparmor audit +caps +dbus firewalld fuse glusterfs iscsi +libvirtd lvm
285 + libssh lxc +macvtap nfs nls numa openvz parted pcap phyp policykit
286 + +qemu rbd sasl selinux +udev uml +vepa virtualbox virt-network
287 + wireshark-plugins xen zeroconf zfs
288 +"
289 +
290 +REQUIRED_USE="
291 + firewalld? ( virt-network )
292 + libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
293 + lxc? ( caps libvirtd )
294 + openvz? ( libvirtd )
295 + policykit? ( dbus )
296 + qemu? ( libvirtd )
297 + uml? ( libvirtd )
298 + vepa? ( macvtap )
299 + virt-network? ( libvirtd )
300 + virtualbox? ( libvirtd )
301 + xen? ( libvirtd )"
302 +
303 +# gettext.sh command is used by the libvirt command wrappers, and it's
304 +# non-optional, so put it into RDEPEND.
305 +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
306 +# package will use 3 by default. Since we don't have slot pinning in an API,
307 +# we must go with the most recent
308 +RDEPEND="
309 + app-misc/scrub
310 + dev-libs/libgcrypt:0
311 + dev-libs/libnl:3
312 + >=dev-libs/libxml2-2.7.6
313 + || ( >=net-analyzer/netcat6-1.0-r2 >=net-analyzer/openbsd-netcat-1.105-r1 )
314 + >=net-libs/gnutls-1.0.25:0=
315 + net-libs/libssh2
316 + net-libs/libtirpc
317 + net-libs/rpcsvc-proto
318 + >=net-misc/curl-7.18.0
319 + sys-apps/dmidecode
320 + >=sys-apps/util-linux-2.17
321 + sys-devel/gettext
322 + sys-libs/ncurses:0=
323 + sys-libs/readline:=
324 + apparmor? ( sys-libs/libapparmor )
325 + audit? ( sys-process/audit )
326 + caps? ( sys-libs/libcap-ng )
327 + dbus? ( sys-apps/dbus )
328 + firewalld? ( net-firewall/firewalld )
329 + fuse? ( >=sys-fs/fuse-2.8.6:= )
330 + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 )
331 + iscsi? ( sys-block/open-iscsi )
332 + libssh? ( net-libs/libssh )
333 + lvm? ( >=sys-fs/lvm2-2.02.48-r2[-device-mapper-only(-)] )
334 + nfs? ( net-fs/nfs-utils )
335 + numa? (
336 + >sys-process/numactl-2.0.2
337 + sys-process/numad
338 + )
339 + parted? (
340 + >=sys-block/parted-1.8[device-mapper]
341 + sys-fs/lvm2[-device-mapper-only(-)]
342 + )
343 + pcap? ( >=net-libs/libpcap-1.0.0 )
344 + policykit? ( >=sys-auth/polkit-0.9 )
345 + qemu? (
346 + >=app-emulation/qemu-0.13.0
347 + dev-libs/yajl
348 + )
349 + rbd? ( sys-cluster/ceph )
350 + sasl? ( dev-libs/cyrus-sasl )
351 + selinux? ( >=sys-libs/libselinux-2.0.85 )
352 + virt-network? (
353 + net-dns/dnsmasq[script]
354 + net-firewall/ebtables
355 + >=net-firewall/iptables-1.4.10[ipv6]
356 + net-misc/radvd
357 + sys-apps/iproute2[-minimal]
358 + )
359 + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
360 + wireshark-plugins? ( net-analyzer/wireshark:= )
361 + xen? (
362 + app-emulation/xen
363 + app-emulation/xen-tools:=
364 + )
365 + udev? (
366 + virtual/udev
367 + >=x11-libs/libpciaccess-0.10.9
368 + )
369 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
370 + zfs? ( sys-fs/zfs )"
371 +
372 +DEPEND="${RDEPEND}
373 + app-text/xhtml1
374 + dev-lang/perl
375 + dev-libs/libxslt
376 + dev-perl/XML-XPath
377 + virtual/pkgconfig"
378 +
379 +PATCHES=(
380 + "${FILESDIR}"/${PN}-4.2.0-do_not_use_sysconf.patch
381 + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch
382 + "${FILESDIR}"/${PN}-3.10.0-r2-fix_paths_for_apparmor.patch
383 +)
384 +
385 +pkg_setup() {
386 + if use qemu; then
387 + enewgroup qemu 77
388 + enewuser qemu 77 -1 -1 "qemu,kvm"
389 + fi
390 +
391 + use policykit && enewgroup libvirt
392 +
393 + # Check kernel configuration:
394 + CONFIG_CHECK=""
395 + use fuse && CONFIG_CHECK+="
396 + ~FUSE_FS"
397 +
398 + use lvm && CONFIG_CHECK+="
399 + ~BLK_DEV_DM
400 + ~DM_MULTIPATH
401 + ~DM_SNAPSHOT"
402 +
403 + use lxc && CONFIG_CHECK+="
404 + ~BLK_CGROUP
405 + ~CGROUP_CPUACCT
406 + ~CGROUP_DEVICE
407 + ~CGROUP_FREEZER
408 + ~CGROUP_NET_PRIO
409 + ~CGROUP_PERF
410 + ~CGROUPS
411 + ~CGROUP_SCHED
412 + ~CPUSETS
413 + ~IPC_NS
414 + ~MACVLAN
415 + ~NAMESPACES
416 + ~NET_CLS_CGROUP
417 + ~NET_NS
418 + ~PID_NS
419 + ~POSIX_MQUEUE
420 + ~SECURITYFS
421 + ~USER_NS
422 + ~UTS_NS
423 + ~VETH
424 + ~!GRKERNSEC_CHROOT_MOUNT
425 + ~!GRKERNSEC_CHROOT_DOUBLE
426 + ~!GRKERNSEC_CHROOT_PIVOT
427 + ~!GRKERNSEC_CHROOT_CHMOD
428 + ~!GRKERNSEC_CHROOT_CAPS"
429 +
430 + kernel_is lt 4 7 && use lxc && CONFIG_CHECK+="
431 + ~DEVPTS_MULTIPLE_INSTANCES"
432 +
433 + use macvtap && CONFIG_CHECK+="
434 + ~MACVTAP"
435 +
436 + use virt-network && CONFIG_CHECK+="
437 + ~BRIDGE_EBT_MARK_T
438 + ~BRIDGE_NF_EBTABLES
439 + ~NETFILTER_ADVANCED
440 + ~NETFILTER_XT_CONNMARK
441 + ~NETFILTER_XT_MARK
442 + ~NETFILTER_XT_TARGET_CHECKSUM"
443 + # Bandwidth Limiting Support
444 + use virt-network && CONFIG_CHECK+="
445 + ~BRIDGE_EBT_T_NAT
446 + ~NET_ACT_POLICE
447 + ~NET_CLS_FW
448 + ~NET_CLS_U32
449 + ~NET_SCH_HTB
450 + ~NET_SCH_INGRESS
451 + ~NET_SCH_SFQ"
452 +
453 + # Handle specific kernel versions for different features
454 + kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
455 + if kernel_is ge 3 6; then
456 + CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP "
457 + kernel_is lt 4 5 && CONFIG_CHECK+=" ~MEMCG_KMEM "
458 + fi
459 +
460 + ERROR_USER_NS="Optional depending on LXC configuration."
461 +
462 + if [[ -n ${CONFIG_CHECK} ]]; then
463 + linux-info_pkg_setup
464 + fi
465 +}
466 +
467 +src_prepare() {
468 + touch "${S}/.mailmap"
469 +
470 + default
471 +
472 + if [[ ${PV} = *9999* ]]; then
473 + # git checkouts require bootstrapping to create the configure script.
474 + # Additionally the submodules must be cloned to the right locations
475 + # bug #377279
476 + ./bootstrap || die "bootstrap failed"
477 + (
478 + git submodule status | sed 's/^[ +-]//;s/ .*//'
479 + git hash-object bootstrap.conf
480 + ) >.git-module-status
481 + fi
482 +
483 + # Tweak the init script:
484 + cp "${FILESDIR}/libvirtd.init-r16" "${S}/libvirtd.init" || die
485 + sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \
486 + -e "s/USE_FLAG_AVAHI/$(usex zeroconf 'use avahi-daemon' '')/" \
487 + -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \
488 + -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \
489 + -i "${S}/libvirtd.init" || die "sed failed"
490 +
491 + eautoreconf
492 +}
493 +
494 +src_configure() {
495 + local myeconfargs=(
496 + $(use_with apparmor)
497 + $(use_with apparmor apparmor-profiles)
498 + $(use_with audit)
499 + $(use_with caps capng)
500 + $(use_with dbus)
501 + $(use_with firewalld)
502 + $(use_with fuse)
503 + $(use_with glusterfs)
504 + $(use_with glusterfs storage-gluster)
505 + $(use_with iscsi storage-iscsi)
506 + $(use_with libvirtd)
507 + $(use_with libssh)
508 + $(use_with lvm storage-lvm)
509 + $(use_with lvm storage-mpath)
510 + $(use_with lxc)
511 + $(use_with macvtap)
512 + $(use_enable nls)
513 + $(use_with numa numactl)
514 + $(use_with numa numad)
515 + $(use_with openvz)
516 + $(use_with parted storage-disk)
517 + $(use_with pcap libpcap)
518 + $(use_with phyp)
519 + $(use_with policykit polkit)
520 + $(use_with qemu)
521 + $(use_with qemu yajl)
522 + $(use_with rbd storage-rbd)
523 + $(use_with sasl)
524 + $(use_with selinux)
525 + $(use_with udev)
526 + $(use_with uml)
527 + $(use_with vepa virtualport)
528 + $(use_with virt-network network)
529 + $(use_with wireshark-plugins wireshark-dissector)
530 + $(use_with xen)
531 + $(use_with xen xen-inotify)
532 + $(use_with xen libxl)
533 + $(use_with zeroconf avahi)
534 + $(use_with zfs storage-zfs)
535 +
536 + --without-hal
537 + --without-netcf
538 + --without-sanlock
539 + --without-xenapi
540 +
541 + --with-esx
542 + --with-init-script=systemd
543 + --with-qemu-group=$(usex caps qemu root)
544 + --with-qemu-user=$(usex caps qemu root)
545 + --with-remote
546 + --with-storage-fs
547 + --with-vmware
548 +
549 + --disable-static
550 + --disable-werror
551 +
552 + --with-html-subdir=${PF}/html
553 + --localstatedir=/var
554 + )
555 +
556 + if use virtualbox && has_version app-emulation/virtualbox-ose; then
557 + myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ )
558 + else
559 + myeconfargs+=( $(use_with virtualbox vbox) )
560 + fi
561 +
562 + econf "${myeconfargs[@]}"
563 +
564 + if [[ ${PV} = *9999* ]]; then
565 + # Restore gnulib's config.sub and config.guess
566 + # bug #377279
567 + (cd .gnulib && git reset --hard > /dev/null)
568 + fi
569 +}
570 +
571 +src_test() {
572 + cd "${BUILD_DIR}"
573 +
574 + # remove problematic tests, bug #591416, bug #591418
575 + sed -i -e 's#commandtest$(EXEEXT) # #' \
576 + -e 's#virfirewalltest$(EXEEXT) # #' \
577 + -e 's#nwfilterebiptablestest$(EXEEXT) # #' \
578 + -e 's#nwfilterxml2firewalltest$(EXEEXT)$##' \
579 + tests/Makefile
580 +
581 + export VIR_TEST_DEBUG=1
582 + HOME="${T}" emake check || die "tests failed"
583 +}
584 +
585 +src_install() {
586 + emake DESTDIR="${D}" \
587 + SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
588 +
589 + find "${D}" -name '*.la' -delete || die
590 +
591 + # Remove bogus, empty directories. They are either not used, or
592 + # libvirtd is able to create them on demand
593 + rm -rf "${D}"/etc/sysconfig
594 + rm -rf "${D}"/var
595 +
596 + use libvirtd || return 0
597 + # From here, only libvirtd-related instructions, be warned!
598 +
599 + systemd_install_serviced \
600 + "${FILESDIR}"/libvirtd.service.conf libvirtd.service
601 +
602 + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf
603 +
604 + newinitd "${S}/libvirtd.init" libvirtd || die
605 + newinitd "${FILESDIR}/libvirt-guests.init-r2" libvirt-guests || die
606 + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die
607 + newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die
608 +
609 + newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
610 + newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
611 +
612 + newbashcomp "${S}/tools/bash-completion/vsh" vsh
613 + bashcomp_alias vsh virsh virt-admin
614 +
615 + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
616 + DISABLE_AUTOFORMATTING=true
617 + readme.gentoo_create_doc
618 +}
619 +
620 +pkg_preinst() {
621 + # we only ever want to generate this once
622 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
623 + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
624 + fi
625 +}
626 +
627 +pkg_postinst() {
628 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
629 + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
630 + fi
631 +
632 + use libvirtd || return 0
633 + # From here, only libvirtd-related instructions, be warned!
634 +
635 + readme.gentoo_print_elog
636 +}