SHA256
1
0
forked from pool/libvirt
libvirt/libvirt.spec

525 lines
15 KiB
RPMSpec

#
# spec file for package libvirt (Version 0.8.1)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# hypervisor drivers that run on local host
%define with_xen 1
%define with_qemu 1
%define with_lxc 1
%define with_openvz 1
%define with_vbox 1
%define with_uml 0
%define with_one 0
# hypervisor drivers that use a native remote protocol
%define with_phyp 0
%define with_esx 0
# host drivers
%define with_network 1
%define with_storage_fs 1
%define with_storage_lvm 1
%define with_storage_iscsi 1
%define with_storage_disk 1
%define with_storage_mpath 1
%define with_numactl 1
%define with_selinux 1
%define with_apparmor 0
# options
%define with_capng 0
%define with_netcf 0
%define with_udev 0
%define with_hal 0
%define with_yajl 0
# Xen is available only on i386 x86_64
%ifnarch %ix86 x86_64
%define with_xen 0
%endif
# LXC and selinux are not available on anything < openSUSE 11.1
%if 0%{?suse_version} < 1110
%define with_lxc 0
%define with_selinux 0
%endif
# Enable phyp driver for IBM Power systems
%ifarch ppc64
%define with_phyp 1
%endif
# numactl only on x86_64 and ia64
%ifnarch x86_64 ia64
%define with_numactl 0
%endif
# SLES doesn't contain OpenVZ, VBox, UML, OpenNebula, or ESX
%if 0%{?sles_version}
%define with_openvz 0
%define with_vbox 0
%define with_uml 0
%define with_one 0
%define with_esx 0
%endif
%if 0%{?suse_version} > 1110
%define with_udev 1
%else
%define with_hal 1
%endif
Name: libvirt
BuildRequires: bridge-utils cyrus-sasl-devel device-mapper-devel fdupes gettext gnutls-devel iptables-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel python-xml readline-devel util-linux xhtml-dtd
%if %{with_hal}
BuildRequires: hal-devel
%endif
%if %{with_udev}
BuildRequires: libudev-devel >= 145
BuildRequires: libpciaccess0-devel >= 0.10.9
%endif
%if %{with_xen}
BuildRequires: xen-devel
%endif
%if 0%{?suse_version} > 1030
BuildRequires: libavahi-devel
%else
BuildRequires: avahi-devel
%endif
%if %{with_selinux}
BuildRequires: libselinux-devel
%endif
%if %{with_numactl}
BuildRequires: libnuma-devel
%endif
%if 0%{?suse_version} > 1110
BuildRequires: polkit >= 0.9
%else
BuildRequires: PolicyKit-devel >= 0.6
%endif
%if %{with_phyp}
BuildRequires: libssh2-devel
%endif
# Only for directory ownership:
BuildRequires: gtk-doc
Url: http://libvirt.org/
License: LGPLv2.1+
Group: Development/Libraries/C and C++
AutoReqProv: yes
Version: 0.8.1
Release: 3
Summary: A C toolkit to interract with the virtualization capabilities of Linux
# The client side, i.e. shared libs and virsh are in a subpackage
Requires: %{name}-client = %{version}-%{release}
Requires: bridge-utils
Requires: iptables
Requires: lvm2
Requires: parted
Requires: virt-utils
Recommends: logrotate
Requires: dnsmasq
Requires: open-iscsi
Requires: nfs-client
%if %{with_hal}
Requires: hal
%endif
%if 0%{?suse_version} > 1110
Requires: polkit >= 0.9
%else
Requires: PolicyKit >= 0.6
%endif
Source0: %{name}-%{version}.tar.bz2
Source1: libvirtd.init
# Upstream patches
Patch0: remote-rm-unused-field.patch
Patch1: vnc-race-1.patch
Patch2: vnc-race-2.patch
Patch3: vnc-race-3.patch
Patch4: bitmap-alloc.patch
Patch5: bitmap-fixes.patch
Patch6: xend-content-buf.patch
Patch7: xend-content-buf-fix.patch
# Need to go upstream
Patch100: xen-name-for-devid.patch
Patch102: clone.patch
Patch103: xen-pv-cdrom.patch
Patch104: xen-domctl-ver7.patch
Patch105: xen-tap2-support.patch
Patch106: xend-disk-order.patch
# Our patches
Patch200: libvirtd-defaults.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Libvirt is a C toolkit to interact with the virtualization
capabilities of Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurrently
on a single hardware system where the basic resources are driven by a
Linux instance. The library aims to provide long term stable C API
to interact with Linux virtualization technologies.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package client
License: LGPLv2.1+
Summary: Client side library and utilities of the libvirt library
Group: Development/Libraries/C and C++
Requires: readline
Requires: ncurses
# So remote clients can access libvirt over SSH tunnel
# (client invokes 'nc' against the UNIX socket on the server)
Requires: netcat-openbsd
Requires: cyrus-sasl
Recommends: cyrus-sasl-digestmd5
%description client
Libvirt is a C toolkit to interract with the virtualization
capabilities of Linux. The libvirt-client package contains shared
libraries and client binaries needed to access the virtualization
capabilities of recent versions of Linux (and other OSes).
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package devel
License: LGPLv2.1+
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name}-client = %{version}-%{release} libxml2-devel
%if %{with_xen}
Requires: xen-devel
%endif
Requires: pkg-config
%description devel
Libvirt is a C toolkit to interract with the virtualization
capabilities of Linux. The libvirt-devel package contains headers
and libraries needed for developing libvirt applications.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package doc
License: LGPLv2.1+
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name}-client = %{version}-%{release}
%description doc
Libvirt is a C toolkit to interract with the virtualization
capabilities of Linux. The libvirt-doc packages contains documentation
for the libvirt API and tools.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%package python
License: LGPLv2.1+
Summary: A C toolkit to interract with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name}-client = %{version}-%{release}
%py_requires
%description python
Libvirt is a C toolkit to interract with the virtualization
capabilities of Linux. The libvirt-python package provides python
bindings for the libvirt C API.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch100 -p1
%patch102
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch200 -p1
%build
%if ! %{with_xen}
%define _without_xen --without-xen
%endif
%if ! %{with_qemu}
%define _without_qemu --without-qemu
%endif
%if ! %{with_lxc}
%define _without_lxc --without-lxc
%endif
%if ! %{with_openvz}
%define _without_openvz --without-openvz
%endif
%if ! %{with_vbox}
%define _without_vbox --without-vbox
%endif
%if ! %{with_uml}
%define _without_uml --without-uml
%endif
%if ! %{with_one}
%define _without_one --without-one
%endif
%if ! %{with_phyp}
%define _without_phyp --without-phyp
%endif
%if ! %{with_esx}
%define _without_esx --without-esx
%endif
%if ! %{with_numactl}
%define _without_numactl --without-numactl
%endif
%if ! %{with_selinux}
%define _without_selinux --without-selinux
%endif
%if ! %{with_apparmor}
%define _without_apparmor --without-apparmor
%endif
%if ! %{with_capng}
%define _without_capng --without-capng
%endif
%if ! %{with_netcf}
%define _without_netcf --without-netcf
%endif
%if ! %{with_hal}
%define _without_hal --without-hal
%endif
%if ! %{with_udev}
%define _without_udev --without-udev
%endif
%if ! %{with_yajl}
%define _without_yajl --without-yajl
%endif
autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS"
%configure --disable-static --with-pic \
%{?_without_xen} \
%{?_without_qemu} \
%{?_without_lxc} \
%{?_without_openvz} \
%{?_without_vbox} \
%{?_without_uml} \
%{?_without_one} \
%{?_without_phyp} \
%{?_without_esx} \
%{?_without_numactl} \
%{?_with_selinux} \
%{?_without_capng} \
%{?_without_netcf} \
%{?_without_selinux} \
%{?_without_apparmor} \
%{?_without_hal} \
%{?_without_udev} \
%{?_without_yajl} \
--without-xen-proxy \
--libexecdir=%{_libdir}/%{name} \
--with-init-script=none \
--with-remote-pid-file=%{_localstatedir}/run/libvirtd.pid \
ac_cv_path_DNSMASQ=/usr/sbin/dnsmasq \
ac_cv_path_ISCSIADM=/sbin/iscsiadm \
ac_cv_path_MODPROBE=/sbin/modprobe \
ac_cv_path_UDEVADM=/sbin/udevadm \
ac_cv_path_SHOWMOUNT=/usr/sbin/showmount
make %{?jobs:-j%jobs} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
%install
%makeinstall DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
cp -a AUTHORS ChangeLog COPYING NEWS README TODO $RPM_BUILD_ROOT%{_docdir}/%{name}/
cd docs ; cp -a *.html $RPM_BUILD_ROOT%{_docdir}/%{name} ; cp -a *.png $RPM_BUILD_ROOT%{_docdir}/%{name} ; cd ..
# remove currently unsupported locale(s)
rm -rf $RPM_BUILD_ROOT/usr/share/locale/sr@latin
# don't autostart the default network
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/libvirt
rm $RPM_BUILD_ROOT%{_libdir}/*.*a $RPM_BUILD_ROOT%{py_sitedir}/*.*a
%if ! %{with_lxc}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/lxc.conf
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.lxc
%endif
%if ! %{with_qemu}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu.conf
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.qemu
%endif
%if ! %{with_uml}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/libvirtd.uml
%endif
ln_dupes()
{
target=""
fdupes -r "$1" | while read file; do
if [ -z "$file" ] || [ -z "$target" ]; then
target="$file"
continue
fi
ln -sf "${target#.}" "$file"
done
}
(
cd $RPM_BUILD_ROOT
ln_dupes .%{_docdir}/%{name}
ln_dupes ./usr/share/locale
)
# init script
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install %SOURCE1 $RPM_BUILD_ROOT/etc/init.d/libvirtd
ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT/usr/sbin/rclibvirtd
%find_lang %{name}
%clean
rm -rf $RPM_BUILD_ROOT
%post
/sbin/ldconfig
%if 0%{?sles_version}
%{fillup_and_insserv -f -y libvirtd}
%endif
%preun
%stop_on_removal libvirtd
%postun
/sbin/ldconfig
%restart_on_update libvirtd
%insserv_cleanup
%post client -p /sbin/ldconfig
%postun client -p /sbin/ldconfig
%files
%defattr(-, root, root)
%{_sbindir}/libvirtd
%dir %{_libdir}/%{name}
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
%{_sysconfdir}/libvirt/nwfilter/*.xml
%config /etc/init.d/libvirtd
%{_sbindir}/rclibvirtd
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
%config %{_sysconfdir}/libvirt/qemu/networks/default.xml
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
%dir %{_localstatedir}/lib/libvirt/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/images/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/boot/
%dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
%if 0%{?suse_version} > 1110
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
%else
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
%endif
%{_datadir}/augeas
%if %{with_qemu}
%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%endif
%if %{with_lxc}
%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_lxc
%endif
%if %{with_uml}
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
%endif
%if 0%{with_storage_disk}
%{_libdir}/%{name}/libvirt_parthelper
%endif
%files client -f %{name}.lang
%defattr(-, root, root)
%doc %dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/[CNRT]*
%doc %{_docdir}/%{name}/AUTHORS
%doc %{_mandir}/man1/virsh.1*
%doc %{_mandir}/man1/virt-xml-validate.1*
%doc %{_mandir}/man1/virt-pki-validate.1*
%{_bindir}/virsh
%{_bindir}/virt-xml-validate
%{_bindir}/virt-pki-validate
%{_libdir}/lib*.so.*
%dir %{_datadir}/libvirt/
%dir %{_datadir}/libvirt/schemas/
%{_datadir}/libvirt/schemas/domain.rng
%{_datadir}/libvirt/schemas/network.rng
%{_datadir}/libvirt/schemas/storagepool.rng
%{_datadir}/libvirt/schemas/storagevol.rng
%{_datadir}/libvirt/schemas/nodedev.rng
%{_datadir}/libvirt/schemas/capability.rng
%{_datadir}/libvirt/schemas/interface.rng
%{_datadir}/libvirt/schemas/secret.rng
%{_datadir}/libvirt/schemas/storageencryption.rng
%{_datadir}/libvirt/cpu_map.xml
%{_datadir}/libvirt/schemas/nwfilter.rng
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
%files devel
%defattr(-, root, root)
%{_includedir}/libvirt
%{_libdir}/*.so
%{_libdir}/pkgconfig/libvirt.pc
%files doc
%defattr(-, root, root)
%{_datadir}/gtk-doc/html/libvirt
%doc %{_docdir}/%{name}/*.png
%doc %{_docdir}/%{name}/*.html
%doc %{_docdir}/%{name}/html
%files python
%defattr(-, root, root)
%doc %{_docdir}/%{name}-python
%{py_sitedir}/libvirt.py*
%{py_sitedir}/libvirtmod*
%changelog