blob: 42066c1fec190973497b66de31ef467d905b5ea7 [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001DESCRIPTION = "A toolkit to interact with the virtualization capabilities of recent versions of Linux."
2HOMEPAGE = "http://libvirt.org"
3LICENSE = "LGPLv2.1+"
4LICENSE_${PN}-ptest = "GPLv2+ & LGPLv2.1"
5LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
6 file://COPYING.LESSER;md5=4b54a1fd55a448865a0b32d41598759d"
7SECTION = "console/tools"
8PR = "r1"
9
10DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \
11 iptables dnsmasq readline libtasn1 libxslt-native"
12
13# libvirt-guests.sh needs gettext.sh
14#
15RDEPENDS_${PN} = "gettext-runtime"
16
17RDEPENDS_${PN}-ptest += "make gawk"
18
19RDEPENDS_libvirt-libvirtd += "bridge-utils iptables pm-utils dnsmasq netcat-openbsd"
20RDEPENDS_libvirt-libvirtd_append_x86-64 = " dmidecode"
21RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode"
22
23#connman blocks the 53 port and libvirtd can't start its DNS service
24RCONFLICTS_${PN}_libvirtd = "connman"
25
26SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
27 file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \
28 file://libvirtd.sh \
29 file://libvirtd.conf \
30 file://runptest.patch \
31 file://run-ptest \
32 file://tests-allow-separated-src-and-build-dirs.patch \
33 file://libvirt-use-pkg-config-to-locate-libcap.patch \
34 file://0001-to-fix-build-error.patch \
35 file://Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch \
36 "
37
38SRC_URI[libvirt.md5sum] = "b48b06bbc7efbe9973ed0f3f223d6da2"
39SRC_URI[libvirt.sha256sum] = "e3c6fc2683178660b371efb3ac7a1103a3f4b78efac7ffe560bc5917974ccf05"
40
41inherit autotools gettext update-rc.d pkgconfig ptest systemd
42
43CACHED_CONFIGUREVARS += "\
44ac_cv_path_XMLLINT=/usr/bin/xmllint \
45ac_cv_path_XMLCATLOG=/usr/bin/xmlcatalog \
46ac_cv_path_AUGPARSE=/usr/bin/augparse \
47ac_cv_path_DNSMASQ=/usr/bin/dnsmasq \
48ac_cv_path_BRCTL=/usr/sbin/brctl \
49ac_cv_path_TC=/sbin/tc \
50ac_cv_path_UDEVADM=/sbin/udevadm \
51ac_cv_path_MODPROBE=/sbin/modprobe \
52ac_cv_path_IP_PATH=/bin/ip \
53ac_cv_path_IPTABLES_PATH=/usr/sbin/iptables \
54ac_cv_path_IP6TABLES_PATH=/usr/sbin/ip6tables \
55ac_cv_path_MOUNT=/bin/mount \
56ac_cv_path_UMOUNT=/bin/umount \
57ac_cv_path_MKFS=/usr/sbin/mkfs \
58ac_cv_path_SHOWMOUNT=/usr/sbin/showmount \
59ac_cv_path_PVCREATE=/usr/sbin/pvcreate \
60ac_cv_path_VGCREATE=/usr/sbin/vgcreate \
61ac_cv_path_LVCREATE=/usr/sbin/lvcreate \
62ac_cv_path_PVREMOVE=/usr/sbin/pvremove \
63ac_cv_path_VGREMOVE=/usr/sbin/vgremove \
64ac_cv_path_LVREMOVE=/usr/sbin/lvremove \
65ac_cv_path_LVCHANGE=/usr/sbin/lvchange \
66ac_cv_path_VGCHANGE=/usr/sbin/vgchange \
67ac_cv_path_VGSCAN=/usr/sbin/vgscan \
68ac_cv_path_PVS=/usr/sbin/pvs \
69ac_cv_path_VGS=/usr/sbin/vgs \
70ac_cv_path_LVS=/usr/sbin/lvs \
71ac_cv_path_PARTED=/usr/sbin/parted \
72ac_cv_path_DMSETUP=/usr/sbin/dmsetup"
73
74# Ensure that libvirt uses polkit rather than policykit, whether the host has
75# pkcheck installed or not, and ensure the path is correct per our config.
76CACHED_CONFIGUREVARS += "ac_cv_path_PKCHECK_PATH=${bindir}/pkcheck"
77
78# Some other possible paths we are not yet setting
79#ac_cv_path_RPCGEN=
80#ac_cv_path_XSLTPROC=
81#ac_cv_path_RADVD=
82#ac_cv_path_UDEVSETTLE=
83#ac_cv_path_EBTABLES_PATH=
84#ac_cv_path_PKG_CONFIG=
85#ac_cv_path_ac_pt_PKG_CONFIG
86#ac_cv_path_POLKIT_AUTH=
87#ac_cv_path_DTRACE=
88#ac_cv_path_ISCSIADM=
89#ac_cv_path_MSGFMT=
90#ac_cv_path_GMSGFMT=
91#ac_cv_path_XGETTEXT=
92#ac_cv_path_MSGMERGE=
93#ac_cv_path_SCRUB=
94#ac_cv_path_PYTHON=
95
96ALLOW_EMPTY_${PN} = "1"
97
98PACKAGES =+ "${PN}-libvirtd ${PN}-virsh"
99
100ALLOW_EMPTY_${PN}-libvirtd = "1"
101
102FILES_${PN}-libvirtd = " \
103 ${sysconfdir}/init.d \
104 ${sysconfdir}/sysctl.d \
105 ${sysconfdir}/logrotate.d \
106 ${sysconfdir}/libvirt/libvirtd.conf \
107 /usr/lib/sysctl.d/60-libvirtd.conf \
108 ${sbindir}/libvirtd \
109 ${systemd_unitdir}/system/* \
110 ${@base_contains('DISTRO_FEATURES', 'sysvinit', '', '${libexecdir}/libvirt-guests.sh', d)} \
111 "
112
113FILES_${PN}-virsh = "${bindir}/virsh"
114FILES_${PN} += "${libdir}/libvirt/connection-driver \
115 ${datadir}/augeas \
116 ${datadir}/polkit-1"
117
118FILES_${PN}-dbg += "${libdir}/libvirt/connection-driver/.debug ${libdir}/libvirt/lock-driver/.debug"
119FILES_${PN}-staticdev += "${libdir}/*.a ${libdir}/libvirt/connection-driver/*.a ${libdir}/libvirt/lock-driver/*.a"
120
121CONFFILES_${PN} += "${sysconfdir}/libvirt/libvirt.conf \
122 ${sysconfdir}/libvirt/lxc.conf \
123 ${sysconfdir}/libvirt/qemu-lockd.conf \
124 ${sysconfdir}/libvirt/qemu.conf \
125 ${sysconfdir}/libvirt/virt-login-shell.conf \
126 ${sysconfdir}/libvirt/virtlockd.conf"
127
128CONFFILES_${PN}-libvirtd = "${sysconfdir}/logrotate.d/libvirt ${sysconfdir}/logrotate.d/libvirt.lxc \
129 ${sysconfdir}/logrotate.d/libvirt.qemu ${sysconfdir}/logrotate.d/libvirt.uml \
130 ${sysconfdir}/libvirt/libvirtd.conf \
131 /usr/lib/sysctl.d/libvirtd.conf"
132
133INITSCRIPT_PACKAGES = "${PN}-libvirtd"
134INITSCRIPT_NAME_${PN}-libvirtd = "libvirtd"
135INITSCRIPT_PARAMS_${PN}-libvirtd = "defaults 72"
136
137SYSTEMD_PACKAGES = "${PN}-libvirtd"
138SYSTEMD_SERVICE_${PN}-libvirtd = " \
139 libvirtd.socket \
140 libvirtd.service \
141 virtlockd.service \
142 libvirt-guests.service \
143 virtlockd.socket \
144 "
145
146
147PRIVATE_LIBS_${PN}-ptest = " \
148 libvirt-lxc.so.0 \
149 libvirt.so.0 \
150 libvirt-qemu.so.0 \
151 lockd.so \
152 libvirt_driver_secret.so \
153 libvirt_driver_nodedev.so \
154 libvirt_driver_vbox.so \
155 libvirt_driver_interface.so \
156 libvirt_driver_uml.so \
157 libvirt_driver_network.so \
158 libvirt_driver_nwfilter.so \
159 libvirt_driver_qemu.so \
160 libvirt_driver_storage.so \
161 libvirt_driver_lxc.so \
162 "
163
164# xen-minimal config
165#PACKAGECONFIG ??= "xen libxl xen-inotify test remote libvirtd"
166
167# full config
168PACKAGECONFIG ??= "qemu yajl uml openvz vmware vbox esx iproute2 lxc test \
169 remote macvtap libvirtd netcf udev python ebtables \
170 ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux audit libcap-ng', '', d)} \
171 ${@base_contains('DISTRO_FEATURES', 'xen', 'xen libxl xen-inotify', '', d)} \
172 ${@base_contains('DISTRO_FEATURES', 'x11', 'polkit', '', d)} \
173 "
174
175# enable,disable,depends,rdepends
176#
177PACKAGECONFIG[qemu] = "--with-qemu,--without-qemu,qemu,"
178PACKAGECONFIG[yajl] = "--with-yajl,--without-yajl,yajl,yajl"
179PACKAGECONFIG[xen] = "--with-xen,--without-xen,xen,"
180PACKAGECONFIG[xenapi] = "--with-xenapi,--without-xenapi,,"
181PACKAGECONFIG[libxl] = "--with-libxl=${STAGING_DIR_TARGET}/lib,--without-libxl,libxl,"
182PACKAGECONFIG[xen-inotify] = "--with-xen-inotify,--without-xen-inotify,xen,"
183PACKAGECONFIG[uml] = "--with-uml, --without-uml,,"
184PACKAGECONFIG[openvz] = "--with-openvz,--without-openvz,,"
185PACKAGECONFIG[vmware] = "--with-vmware,--without-vmware,,"
186PACKAGECONFIG[phyp] = "--with-phyp,--without-phyp,,"
187PACKAGECONFIG[vbox] = "--with-vbox,--without-vbox,,"
188PACKAGECONFIG[esx] = "--with-esx,--without-esx,,"
189PACKAGECONFIG[hyperv] = "--with-hyperv,--without-hyperv,,"
190PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit,polkit"
191PACKAGECONFIG[lxc] = "--with-lxc,--without-lxc, lxc,"
192PACKAGECONFIG[test] = "--with-test=yes,--with-test=no,,"
193PACKAGECONFIG[remote] = "--with-remote,--without-remote,,"
194PACKAGECONFIG[macvtap] = "--with-macvtap=yes,--with-macvtap=no,libnl,libnl"
195PACKAGECONFIG[libvirtd] = "--with-libvirtd,--without-libvirtd,,"
196PACKAGECONFIG[netcf] = "--with-netcf,--without-netcf,netcf,netcf"
197PACKAGECONFIG[dtrace] = "--with-dtrace,--without-dtrace,,"
198PACKAGECONFIG[udev] = "--with-udev --with-pciaccess,--without-udev,udev libpciaccess,"
199PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux,"
200PACKAGECONFIG[ebtables] = "ac_cv_path_EBTABLES_PATH=/sbin/ebtables,ac_cv_path_EBTABLES_PATH=,ebtables,ebtables"
201PACKAGECONFIG[python] = ",,python,"
202PACKAGECONFIG[sasl] = "--with-sasl,--without-sasl,cyrus-sasl,cyrus-sasl"
203PACKAGECONFIG[iproute2] = "ac_cv_path_IP_PATH=/sbin/ip,ac_cv_path_IP_PATH=,iproute2,iproute2"
204PACKAGECONFIG[numactl] = "--with-numactl,--without-numactl,numactl,"
205PACKAGECONFIG[fuse] = "--with-fuse,--without-fuse,fuse,"
206PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit,"
207PACKAGECONFIG[libcap-ng] = "--with-capng,--without-capng,libcap-ng,"
208
209# Enable the Python tool support
210require libvirt-python.inc
211
212do_install_append() {
213 install -d ${D}/etc/init.d
214 install -d ${D}/etc/libvirt
215
216 install -m 0755 ${WORKDIR}/libvirtd.sh ${D}/etc/init.d/libvirtd
217 install -m 0644 ${WORKDIR}/libvirtd.conf ${D}/etc/libvirt/libvirtd.conf
218
219 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
220 # This will wind up in the libvirtd package, but will NOT be invoked by default.
221 #
222 mv ${D}/${libexecdir}/libvirt-guests.sh ${D}/${sysconfdir}/init.d
223 fi
224
225 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
226 # This variable is used by libvirtd.service to start libvirtd in the right mode
227 sed -i '/#LIBVIRTD_ARGS="--listen"/a LIBVIRTD_ARGS="--listen --daemon"' ${D}/${sysconfdir}/sysconfig/libvirtd
228
229 # We can't use 'notify' when we don't support 'sd_notify' dbus capabilities.
230 sed -i -e 's/Type=notify/Type=forking/' \
231 -e '/Type=forking/a PIDFile=${localstatedir}/run/libvirtd.pid' \
232 ${D}/${systemd_unitdir}/system/libvirtd.service
233 fi
234
235 # The /var/run/libvirt directories created by the Makefile
236 # are wiped out in volatile, we need to create these at boot.
237 rm -rf ${D}${localstatedir}/run
238 install -d ${D}${sysconfdir}/default/volatiles
239 echo "d root root 0755 ${localstatedir}/run/libvirt none" \
240 > ${D}${sysconfdir}/default/volatiles/99_libvirt
241 echo "d root root 0755 ${localstatedir}/run/libvirt/lockd none" \
242 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
243 echo "d root root 0755 ${localstatedir}/run/libvirt/lxc none" \
244 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
245 echo "d root root 0755 ${localstatedir}/run/libvirt/network none" \
246 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
247 echo "d root root 0755 ${localstatedir}/run/libvirt/qemu none" \
248 >> ${D}${sysconfdir}/default/volatiles/99_libvirt
249
250 # Add hook support for libvirt
251 mkdir -p ${D}/etc/libvirt/hooks
252
253 # remove .la references to our working diretory
254 for i in `find ${D}${libdir} -type f -name *.la`; do
255 sed -i -e 's#-L${B}/src/.libs##g' $i
256 done
257}
258
259EXTRA_OECONF += " \
260 --with-init-script=systemd \
261 "
262
263EXTRA_OEMAKE = "BUILD_DIR=${B} DEST_DIR=${D}${PTEST_PATH} PTEST_DIR=${PTEST_PATH}"
264
265do_compile_ptest() {
266 oe_runmake -C tests buildtest-TESTS
267}
268
269do_install_ptest() {
270 oe_runmake -C tests install-ptest
271
272 # remove .la files for ptest, they aren't required and can trigger QA errors
273 for i in `find ${D}${PTEST_PATH} -type f -name *.la`; do
274 rm -f $i
275 done
276}
277
278pkg_postinst_libvirt() {
279 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
280 /etc/init.d/populate-volatile.sh update
281 fi
282}
283
284python () {
285 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
286 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
287}