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