Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/libvirt/files/, app-emulation/libvirt/
Date: Thu, 09 May 2019 19:33:56
Message-Id: 1557430398.18caec2e8900630fd5f4951e5b8db56876ec327a.williamh@gentoo
1 commit: 18caec2e8900630fd5f4951e5b8db56876ec327a
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Thu May 9 19:06:10 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu May 9 19:33:18 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18caec2e
7
8 app-emulation/libvirt: 5.2.0-r1 bump
9
10 This allows the qemu and storage directories under /etc/libvirt to be
11 symbolic links so they can be stored on another file system.
12
13 Closes: https://bugs.gentoo.org/685008
14 Copyright: Sony Interactive Entertainment Inc.
15 Package-Manager: Portage-2.3.62, Repoman-2.3.12
16 Acked-by: tamiko <AT> gentoo.org
17 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
18
19 app-emulation/libvirt/files/libvirtd.init-r17 | 36 +++
20 app-emulation/libvirt/libvirt-5.2.0-r1.ebuild | 392 ++++++++++++++++++++++++++
21 2 files changed, 428 insertions(+)
22
23 diff --git a/app-emulation/libvirt/files/libvirtd.init-r17 b/app-emulation/libvirt/files/libvirtd.init-r17
24 new file mode 100644
25 index 00000000000..ca3f872e14e
26 --- /dev/null
27 +++ b/app-emulation/libvirt/files/libvirtd.init-r17
28 @@ -0,0 +1,36 @@
29 +#!/sbin/openrc-run
30 +# Copyright 1999-2019 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +description="Virtual Machine Management daemon (libvirt)"
34 +
35 +LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"}
36 +LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"}
37 +
38 +command="/usr/sbin/libvirtd"
39 +command_args="-d ${LIBVIRTD_OPTS}"
40 +start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab"
41 +pidfile="/var/run/libvirtd.pid"
42 +retry="${LIBVIRTD_TERMTIMEOUT}"
43 +
44 +depend() {
45 + need virtlogd
46 + use dbus virtlockd
47 + after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig xenconsoled
48 + USE_FLAG_FIREWALLD
49 + USE_FLAG_AVAHI
50 + USE_FLAG_ISCSI
51 + USE_FLAG_RBD
52 +}
53 +
54 +start_pre() {
55 + # Test configuration directories in /etc/libvirt/ to be either not
56 + # present or a directory, i.e. not a regular file, bug #532892
57 +
58 + checkpath --directory /etc/libvirt/lxc || return 1
59 + checkpath --directory /etc/libvirt/nwfilter || return 1
60 + [ -L /etc/libvirt/qemu ] ||
61 + checkpath --directory /etc/libvirt/qemu || return 1
62 + [ -L /etc/libvirt/storage ] ||
63 + checkpath --directory /etc/libvirt/storage || return 1
64 +}
65
66 diff --git a/app-emulation/libvirt/libvirt-5.2.0-r1.ebuild b/app-emulation/libvirt/libvirt-5.2.0-r1.ebuild
67 new file mode 100644
68 index 00000000000..78ac8a38d3d
69 --- /dev/null
70 +++ b/app-emulation/libvirt/libvirt-5.2.0-r1.ebuild
71 @@ -0,0 +1,392 @@
72 +# Copyright 1999-2019 Gentoo Authors
73 +# Distributed under the terms of the GNU General Public License v2
74 +
75 +EAPI=7
76 +
77 +PYTHON_COMPAT=( python3_{5,6,7} )
78 +
79 +inherit autotools bash-completion-r1 eutils linux-info python-any-r1 readme.gentoo-r1 systemd user
80 +
81 +if [[ ${PV} = *9999* ]]; then
82 + inherit git-r3
83 + EGIT_REPO_URI="https://libvirt.org/git/libvirt.git"
84 + SRC_URI=""
85 + KEYWORDS=""
86 + SLOT="0"
87 +else
88 + # Versions with 4 numbers are stable updates:
89 + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then
90 + SRC_URI="https://libvirt.org/sources/stable_updates/${P}.tar.xz"
91 + else
92 + SRC_URI="https://libvirt.org/sources/${P}.tar.xz"
93 + fi
94 + KEYWORDS="~amd64 ~arm64 ~x86"
95 + SLOT="0/${PV}"
96 +fi
97 +
98 +DESCRIPTION="C toolkit to manipulate virtual machines"
99 +HOMEPAGE="http://www.libvirt.org/"
100 +LICENSE="LGPL-2.1"
101 +IUSE="
102 + apparmor audit +caps +dbus firewalld fuse glusterfs iscsi iscsi-direct
103 + +libvirtd lvm libssh lxc +macvtap nfs nls numa openvz parted pcap phyp
104 + policykit +qemu rbd sasl selinux +udev +vepa virtualbox virt-network
105 + wireshark-plugins xen zeroconf zfs
106 +"
107 +
108 +REQUIRED_USE="
109 + firewalld? ( virt-network )
110 + libvirtd? ( || ( lxc openvz qemu virtualbox xen ) )
111 + lxc? ( caps libvirtd )
112 + openvz? ( libvirtd )
113 + policykit? ( dbus )
114 + qemu? ( libvirtd )
115 + vepa? ( macvtap )
116 + virt-network? ( libvirtd )
117 + virtualbox? ( libvirtd )
118 + xen? ( libvirtd )"
119 +
120 +# gettext.sh command is used by the libvirt command wrappers, and it's
121 +# non-optional, so put it into RDEPEND.
122 +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
123 +# package will use 3 by default. Since we don't have slot pinning in an API,
124 +# we must go with the most recent
125 +RDEPEND="
126 + app-misc/scrub
127 + dev-libs/libgcrypt:0
128 + dev-libs/libnl:3
129 + >=dev-libs/libxml2-2.7.6
130 + >=net-analyzer/openbsd-netcat-1.105-r1
131 + >=net-libs/gnutls-1.0.25:0=
132 + net-libs/libssh2
133 + net-libs/libtirpc
134 + net-libs/rpcsvc-proto
135 + >=net-misc/curl-7.18.0
136 + sys-apps/dmidecode
137 + >=sys-apps/util-linux-2.17
138 + sys-devel/gettext
139 + sys-libs/ncurses:0=
140 + sys-libs/readline:=
141 + apparmor? ( sys-libs/libapparmor )
142 + audit? ( sys-process/audit )
143 + caps? ( sys-libs/libcap-ng )
144 + dbus? ( sys-apps/dbus )
145 + firewalld? ( >=net-firewall/firewalld-0.6.3 )
146 + fuse? ( >=sys-fs/fuse-2.8.6:= )
147 + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 )
148 + iscsi? ( sys-block/open-iscsi )
149 + iscsi-direct? ( >=net-libs/libiscsi-1.18.0 )
150 + libssh? ( net-libs/libssh )
151 + lvm? ( >=sys-fs/lvm2-2.02.48-r2[-device-mapper-only(-)] )
152 + nfs? ( net-fs/nfs-utils )
153 + numa? (
154 + >sys-process/numactl-2.0.2
155 + sys-process/numad
156 + )
157 + parted? (
158 + >=sys-block/parted-1.8[device-mapper]
159 + sys-fs/lvm2[-device-mapper-only(-)]
160 + )
161 + pcap? ( >=net-libs/libpcap-1.0.0 )
162 + policykit? ( >=sys-auth/polkit-0.9 )
163 + qemu? (
164 + >=app-emulation/qemu-1.5.0
165 + dev-libs/yajl
166 + )
167 + rbd? ( sys-cluster/ceph )
168 + sasl? ( dev-libs/cyrus-sasl )
169 + selinux? ( >=sys-libs/libselinux-2.0.85 )
170 + virt-network? (
171 + net-dns/dnsmasq[script]
172 + net-firewall/ebtables
173 + >=net-firewall/iptables-1.4.10[ipv6]
174 + net-misc/radvd
175 + sys-apps/iproute2[-minimal]
176 + )
177 + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
178 + wireshark-plugins? ( net-analyzer/wireshark:= )
179 + xen? (
180 + >=app-emulation/xen-4.6.0
181 + app-emulation/xen-tools:=
182 + )
183 + udev? (
184 + virtual/udev
185 + >=x11-libs/libpciaccess-0.10.9
186 + )
187 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
188 + zfs? ( sys-fs/zfs )"
189 +
190 +DEPEND="${RDEPEND}
191 + ${PYTHON_DEPS}
192 + app-text/xhtml1
193 + dev-lang/perl
194 + dev-libs/libxslt
195 + dev-perl/XML-XPath
196 + virtual/pkgconfig"
197 +
198 +PATCHES=(
199 + "${FILESDIR}"/${PN}-5.2.0-do-not-use-sysconf.patch
200 + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch
201 + "${FILESDIR}"/${PN}-5.0.0-fix-paths-for-apparmor.patch
202 +)
203 +
204 +pkg_setup() {
205 + if use qemu; then
206 + enewgroup qemu 77
207 + enewuser qemu 77 -1 -1 "qemu,kvm"
208 + fi
209 +
210 + use policykit && enewgroup libvirt
211 +
212 + # Check kernel configuration:
213 + CONFIG_CHECK=""
214 + use fuse && CONFIG_CHECK+="
215 + ~FUSE_FS"
216 +
217 + use lvm && CONFIG_CHECK+="
218 + ~BLK_DEV_DM
219 + ~DM_MULTIPATH
220 + ~DM_SNAPSHOT"
221 +
222 + use lxc && CONFIG_CHECK+="
223 + ~BLK_CGROUP
224 + ~CGROUP_CPUACCT
225 + ~CGROUP_DEVICE
226 + ~CGROUP_FREEZER
227 + ~CGROUP_NET_PRIO
228 + ~CGROUP_PERF
229 + ~CGROUPS
230 + ~CGROUP_SCHED
231 + ~CPUSETS
232 + ~IPC_NS
233 + ~MACVLAN
234 + ~NAMESPACES
235 + ~NET_CLS_CGROUP
236 + ~NET_NS
237 + ~PID_NS
238 + ~POSIX_MQUEUE
239 + ~SECURITYFS
240 + ~USER_NS
241 + ~UTS_NS
242 + ~VETH
243 + ~!GRKERNSEC_CHROOT_MOUNT
244 + ~!GRKERNSEC_CHROOT_DOUBLE
245 + ~!GRKERNSEC_CHROOT_PIVOT
246 + ~!GRKERNSEC_CHROOT_CHMOD
247 + ~!GRKERNSEC_CHROOT_CAPS"
248 +
249 + kernel_is lt 4 7 && use lxc && CONFIG_CHECK+="
250 + ~DEVPTS_MULTIPLE_INSTANCES"
251 +
252 + use macvtap && CONFIG_CHECK+="
253 + ~MACVTAP"
254 +
255 + use virt-network && CONFIG_CHECK+="
256 + ~BRIDGE_EBT_MARK_T
257 + ~BRIDGE_NF_EBTABLES
258 + ~NETFILTER_ADVANCED
259 + ~NETFILTER_XT_CONNMARK
260 + ~NETFILTER_XT_MARK
261 + ~NETFILTER_XT_TARGET_CHECKSUM
262 + ~IP_NF_FILTER
263 + ~IP_NF_MANGLE
264 + ~IP_NF_NAT
265 + ~IP_NF_TARGET_MASQUERADE
266 + ~IP6_NF_FILTER
267 + ~IP6_NF_MANGLE
268 + ~IP6_NF_NAT"
269 + # Bandwidth Limiting Support
270 + use virt-network && CONFIG_CHECK+="
271 + ~BRIDGE_EBT_T_NAT
272 + ~IP_NF_TARGET_REJECT
273 + ~NET_ACT_POLICE
274 + ~NET_CLS_FW
275 + ~NET_CLS_U32
276 + ~NET_SCH_HTB
277 + ~NET_SCH_INGRESS
278 + ~NET_SCH_SFQ"
279 +
280 + # Handle specific kernel versions for different features
281 + kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
282 + if kernel_is ge 3 6; then
283 + CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP "
284 + kernel_is lt 4 5 && CONFIG_CHECK+=" ~MEMCG_KMEM "
285 + fi
286 +
287 + ERROR_USER_NS="Optional depending on LXC configuration."
288 +
289 + if [[ -n ${CONFIG_CHECK} ]]; then
290 + linux-info_pkg_setup
291 + fi
292 +}
293 +
294 +src_prepare() {
295 + touch "${S}/.mailmap"
296 +
297 + default
298 +
299 + if [[ ${PV} = *9999* ]]; then
300 + # Reinitialize submodules as this is required for gnulib's bootstrap
301 + git submodule init
302 + # git checkouts require bootstrapping to create the configure script.
303 + # Additionally the submodules must be cloned to the right locations
304 + # bug #377279
305 + ./bootstrap || die "bootstrap failed"
306 + (
307 + git submodule status .gnulib | awk '{ print $1 }'
308 + git hash-object bootstrap.conf
309 + git ls-tree -d HEAD gnulib/local | awk '{ print $3 }'
310 + ) >.git-module-status
311 + fi
312 +
313 + # Tweak the init script:
314 + cp "${FILESDIR}/libvirtd.init-r17" "${S}/libvirtd.init" || die
315 + sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \
316 + -e "s/USE_FLAG_AVAHI/$(usex zeroconf 'use avahi-daemon' '')/" \
317 + -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \
318 + -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \
319 + -i "${S}/libvirtd.init" || die "sed failed"
320 +
321 + eautoreconf
322 +}
323 +
324 +src_configure() {
325 + local myeconfargs=(
326 + $(use_with apparmor)
327 + $(use_with apparmor apparmor-profiles)
328 + $(use_with audit)
329 + $(use_with caps capng)
330 + $(use_with dbus)
331 + $(use_with firewalld)
332 + $(use_with fuse)
333 + $(use_with glusterfs)
334 + $(use_with glusterfs storage-gluster)
335 + $(use_with iscsi storage-iscsi)
336 + $(use_with iscsi-direct storage-iscsi-direct)
337 + $(use_with libvirtd)
338 + $(use_with libssh)
339 + $(use_with lvm storage-lvm)
340 + $(use_with lvm storage-mpath)
341 + $(use_with lxc)
342 + $(use_with macvtap)
343 + $(use_enable nls)
344 + $(use_with numa numactl)
345 + $(use_with numa numad)
346 + $(use_with openvz)
347 + $(use_with parted storage-disk)
348 + $(use_with pcap libpcap)
349 + $(use_with phyp)
350 + $(use_with policykit polkit)
351 + $(use_with qemu)
352 + $(use_with qemu yajl)
353 + $(use_with rbd storage-rbd)
354 + $(use_with sasl)
355 + $(use_with selinux)
356 + $(use_with udev)
357 + $(use_with vepa virtualport)
358 + $(use_with virt-network network)
359 + $(use_with wireshark-plugins wireshark-dissector)
360 + $(use_with xen libxl)
361 + $(use_with zeroconf avahi)
362 + $(use_with zfs storage-zfs)
363 +
364 + --without-hal
365 + --without-netcf
366 + --without-sanlock
367 +
368 + --with-esx
369 + --with-init-script=systemd
370 + --with-qemu-group=$(usex caps qemu root)
371 + --with-qemu-user=$(usex caps qemu root)
372 + --with-remote
373 + --with-storage-fs
374 + --with-vmware
375 +
376 + --disable-static
377 + --disable-werror
378 +
379 + --with-html-subdir=${PF}/html
380 + --localstatedir=/var
381 + )
382 +
383 + if use virtualbox && has_version app-emulation/virtualbox-ose; then
384 + myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ )
385 + else
386 + myeconfargs+=( $(use_with virtualbox vbox) )
387 + fi
388 +
389 + econf "${myeconfargs[@]}"
390 +
391 + if [[ ${PV} = *9999* ]]; then
392 + # Restore gnulib's config.sub and config.guess
393 + # bug #377279
394 + (cd .gnulib && git reset --hard > /dev/null)
395 + fi
396 +}
397 +
398 +src_test() {
399 + cd "${BUILD_DIR}"
400 +
401 + # remove problematic tests, bug #591416, bug #591418
402 + sed -i -e 's#commandtest$(EXEEXT) # #' \
403 + -e 's#virfirewalltest$(EXEEXT) # #' \
404 + -e 's#nwfilterebiptablestest$(EXEEXT) # #' \
405 + -e 's#nwfilterxml2firewalltest$(EXEEXT)$##' \
406 + tests/Makefile
407 +
408 + export VIR_TEST_DEBUG=1
409 + HOME="${T}" emake check || die "tests failed"
410 +}
411 +
412 +src_install() {
413 + emake DESTDIR="${D}" \
414 + SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
415 +
416 + find "${D}" -name '*.la' -delete || die
417 +
418 + # Remove bogus, empty directories. They are either not used, or
419 + # libvirtd is able to create them on demand
420 + rm -rf "${D}"/etc/sysconfig
421 + rm -rf "${D}"/var
422 +
423 + use libvirtd || return 0
424 + # From here, only libvirtd-related instructions, be warned!
425 +
426 + systemd_install_serviced \
427 + "${FILESDIR}"/libvirtd.service.conf libvirtd.service
428 +
429 + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf
430 +
431 + newinitd "${S}/libvirtd.init" libvirtd || die
432 + newinitd "${FILESDIR}/libvirt-guests.init-r3" libvirt-guests || die
433 + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die
434 + newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die
435 +
436 + newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
437 + newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
438 +
439 + newbashcomp "${S}/tools/bash-completion/vsh" virsh
440 + bashcomp_alias virsh virt-admin
441 +
442 + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
443 + DISABLE_AUTOFORMATTING=true
444 + readme.gentoo_create_doc
445 +}
446 +
447 +pkg_preinst() {
448 + # we only ever want to generate this once
449 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
450 + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
451 + fi
452 +}
453 +
454 +pkg_postinst() {
455 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
456 + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
457 + fi
458 +
459 + use libvirtd || return 0
460 + # From here, only libvirtd-related instructions, be warned!
461 +
462 + readme.gentoo_print_elog
463 +}