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