[meta-virtualization] [PATCH] libvirt: Fix conditional dependencies on polkit

Rob Woolley rob.woolley at windriver.com
Wed Apr 19 07:42:20 PDT 2017


The DIRFILES variable was a temporary workaround to resolve a do_rootfs
RPM package conflict between libvirt and polkit.

This happened because of the different permissions and ownership that the
packages placed on ${datadir}/usr/share/polkit-1/rules.d.

The behaviour is now conditional based on how PACKAGECONFIG is set.  The
polkit rules will be removed from the package if polkit is not enabled.
If polkit is enabled the permissions and ownership are set to match those
set by the polkit recipe.

This uses the useradd enhancements for RSS.  It requires that shadow-native
be included as a DEPENDS to provide the useradd command in the native
sysroot.

Signed-off-by: Rob Woolley <rob.woolley at windriver.com>
---
 recipes-extended/libvirt/libvirt_1.3.5.bb | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/recipes-extended/libvirt/libvirt_1.3.5.bb b/recipes-extended/libvirt/libvirt_1.3.5.bb
index 7b55ead..a8e6f3f 100644
--- a/recipes-extended/libvirt/libvirt_1.3.5.bb
+++ b/recipes-extended/libvirt/libvirt_1.3.5.bb
@@ -7,7 +7,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 SECTION = "console/tools"
 
 DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \
-	   iptables dnsmasq readline libtasn1 libxslt-native acl"
+	   iptables dnsmasq readline libtasn1 libxslt-native acl \
+	   ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'shadow-native', '', d)}"
 
 # libvirt-guests.sh needs gettext.sh
 #
@@ -22,8 +23,6 @@ RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode"
 #connman blocks the 53 port and libvirtd can't start its DNS service
 RCONFLICTS_${PN}_libvirtd = "connman"
 
-DIRFILES = ""
-
 SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
            file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \
            file://libvirtd.sh \
@@ -120,7 +119,8 @@ FILES_${PN}-libvirtd = " \
 FILES_${PN}-virsh = "${bindir}/virsh"
 FILES_${PN} += "${libdir}/libvirt/connection-driver \
 	    ${datadir}/augeas \
-	    ${datadir}/polkit-1"
+	    ${@bb.utils.contains('PACKAGECONFIG', 'polkit', '${datadir}/polkit-1', '', d)} \
+	    "
 
 FILES_${PN}-dbg += "${libdir}/libvirt/connection-driver/.debug ${libdir}/libvirt/lock-driver/.debug"
 FILES_${PN}-staticdev += "${libdir}/*.a ${libdir}/libvirt/connection-driver/*.a ${libdir}/libvirt/lock-driver/*.a"
@@ -254,6 +254,15 @@ do_install_append() {
 	echo "d root root 0755 ${localstatedir}/run/libvirt/qemu none" \
 	     >> ${D}${sysconfdir}/default/volatiles/99_libvirt
 
+	# Manually set permissions and ownership to match polkit recipe
+	if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
+		install -d -m 0700 ${D}/${datadir}/polkit-1/rules.d
+		chown polkitd ${D}/${datadir}/polkit-1/rules.d
+		chgrp root ${D}/${datadir}/polkit-1/rules.d
+	else
+		rm -rf ${D}/${datadir}/polkit-1
+	fi
+
 	# Add hook support for libvirt
 	mkdir -p ${D}/etc/libvirt/hooks
 
-- 2.11.0



More information about the meta-virtualization mailing list