Skip to contentSkip to conversation

libvirt: Fix conditional dependencies on polkit

PATCH In review Rob Woolley 2 participants 2 messages Apr 19, 2017 – Apr 25, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvirt: Fix conditional dependencies on polkit

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.

---
 recipes-extended/libvirt/libvirt_1.3.5.bb | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
recipes-extended/libvirt/libvirt_1.3.5.bb +13 -4
index 7b55ead..a8e6f3f 100644
@@ -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

#1 lore raw

merged.

Bruce

Quoted 81 lines · Rob Woolley

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.

---
 recipes-extended/libvirt/libvirt_1.3.5.bb | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
recipes-extended/libvirt/libvirt_1.3.5.bb +2 -1
index 7b55ead..a8e6f3f 100644
@@ -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
 #
recipes-extended/libvirt/libvirt_1.3.5.bb +0 -2
@@ -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 \
recipes-extended/libvirt/libvirt_1.3.5.bb +2 -1
@@ -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"

recipes-extended/libvirt/libvirt_1.3.5.bb +2 -0
@@ -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

recipes-extended/libvirt/libvirt_1.3.5.bb +7 -1
+               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
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end"