SHA256
1
0
forked from pool/libvirt
libvirt/libvirt.spec
James Fehlig 13d485c1ee - Unconditionally build sanlock support
bnc#799262

- Fix interface management functions that were broken when
  rebasing libvirt-suse-netcontrol.patch
  bnc#799444 (SLES bug that affect Factory too)

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=240
2013-01-22 04:02:42 +00:00

1133 lines
34 KiB
RPMSpec

#
# spec file for package libvirt
#
# Copyright (c) 2013 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/
#
# For now, default to a full server + client build
%define client_only 0
# Disable all server side drivers if client only build requested
%if %{client_only}
%define server_drivers 0
%else
%define server_drivers 1
%endif
# Do not build with dlopen'd modules for now
%define with_driver_modules 0
# Now set the defaults for all the important features, independent
# of any particular OS
# First the daemon itself
%define with_libvirtd 0%{!?_without_libvirtd:%{server_drivers}}
%define with_avahi 0%{!?_without_avahi:%{server_drivers}}
# Then the hypervisor drivers that run in libvirtd
%define with_xen 0%{!?_without_xen:%{server_drivers}}
%define with_qemu 0%{!?_without_qemu:%{server_drivers}}
%define with_lxc 0%{!?_without_lxc:%{server_drivers}}
%define with_uml 0%{!?_without_uml:%{server_drivers}}
%define with_libxl 0%{!?_without_libxl:%{server_drivers}}
# Then the hypervisor drivers that run outside libvirtd, in libvirt.so
%define with_openvz 0%{!?_without_openvz:%{server_drivers}}
%define with_vbox 0%{!?_without_vbox:%{server_drivers}}
%define with_vmware 0%{!?_without_vmware:%{server_drivers}}
%define with_phyp 0%{!?_without_phyp:0}
%define with_esx 0%{!?_without_esx:1}
%define with_hyperv 0%{!?_without_hyperv:0}
%define with_xenapi 0%{!?_without_xenapi:1}
%define with_parallels 0%{!?_without_parallels:1}
# Then the secondary host drivers, which run inside libvirtd
%define with_interface 0%{!?_without_interface:%{server_drivers}}
%define with_network 0%{!?_without_network:%{server_drivers}}
%define with_storage_fs 0%{!?_without_storage_fs:%{server_drivers}}
%define with_storage_lvm 0%{!?_without_storage_lvm:%{server_drivers}}
%define with_storage_iscsi 0%{!?_without_storage_iscsi:%{server_drivers}}
%define with_storage_disk 0%{!?_without_storage_disk:%{server_drivers}}
%define with_storage_mpath 0%{!?_without_storage_mpath:%{server_drivers}}
%define with_storage_rbd 0
%define with_storage_sheepdog 0
%define with_numactl 0%{!?_without_numactl:%{server_drivers}}
%define with_selinux 0%{!?_without_selinux:%{server_drivers}}
%define with_apparmor 0%{!?_without_apparmor:%{server_drivers}}
# Optional bits on by default
%define with_polkit 0%{!?_without_polkit:1}
%define with_udev 0%{!?_without_udev:1}
%define with_audit 0%{!?_without_audit:1}
%define with_yajl 0%{!?_without_yajl:1}
%define with_sanlock 0%{!?_without_sanlock:1}
# A few optional bits off by default, we enable later
%define with_capng 0%{!?_without_capng:0}
%define with_netcf 0%{!?_without_netcf:0}
%define with_netcontrol 0%{!?_without_netcontrol:0}
%define with_nwfilter 0%{!?_without_nwfilter:0}
%define with_libpcap 0%{!?_without_libpcap:0}
%define with_macvtap 0%{!?_without_macvtap:0}
%define with_libnl 0%{!?_without_libnl:0}
%define with_dtrace 0%{!?_without_dtrace:0}
%define with_cgconfig 0%{!?_without_cgconfig:0}
%define with_systemd 0%{!?_without_systemd:0}
%define with_numad 0%{!?_without_numad:0}
%define with_firewalld 0%{!?_without_firewalld:0}
%define with_libssh2_transport 0%{!?_without_libssh2_transport:0}
# Non-server/HV driver defaults which are always enabled
%define with_python 0%{!?_without_python:1}
%define with_sasl 0%{!?_without_sasl:1}
# Set the OS / architecture specific special cases
# Xen is available only on i386 x86_64
%ifnarch %ix86 x86_64
%define with_xen 0
%define with_libxl 0
%endif
# libxl is only compatible with Xen >= 4.2 (i.e. suse_version > 12.2)
%if 0%{?suse_version} <= 1220
%define with_libxl 0
%endif
# numactl only on x86_64 and ia64
%ifnarch x86_64 ia64
%define with_numactl 0
%endif
# SLES doesn't contain OpenVZ, VBox, UML, ESX, VMWare, Citrix XenAPI,
# or hyper-v
%if 0%{?sles_version}
%define with_openvz 0
%define with_vbox 0
%define with_uml 0
%define with_esx 0
%define with_vmware 0
%define with_xenapi 0
%define with_hyperv 0
%define with_parallels 0
%endif
# Enable phyp driver for IBM Power systems
%ifarch ppc64
%define with_phyp 1
%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
# netcontrol is used to manage network interfaces on openSUSE >= 12.1
%if 0%{?suse_version} >= 1210
%define with_netcontrol 0%{!?_without_netcontrol:%{server_drivers}}
%endif
# libcapng is used to manage capabilities in 11.3 or newer.
# It is also used by lxc and needs to be enabled if lxc is enabled.
%if 0%{?suse_version} >= 1130 || %{with_lxc}
%define with_capng 0%{!?_without_capng:1}
%endif
%if 0%{?suse_version} >= 1210
%define with_systemd 0%{!?_without_systemd:1}
%endif
# Disable some drivers when building without libvirt daemon.
# The logic is the same as in configure.ac
%if ! %{with_libvirtd}
%define with_interface 0
%define with_network 0
%define with_qemu 0
%define with_lxc 0
%define with_uml 0
%define with_udev 0
%define with_storage_fs 0
%define with_storage_lvm 0
%define with_storage_iscsi 0
%define with_storage_mpath 0
%define with_storage_rbd 0
%define with_storage_sheepdog 0
%define with_storage_disk 0
%endif
# Enable libpcap library
%if %{with_qemu}
%if 0%{?suse_version} >= 1140
%define with_nwfilter 0%{!?_without_nwfilter:%{server_drivers}}
%define with_libpcap 0%{!?_without_libpcap:%{server_drivers}}
%define with_macvtap 0%{!?_without_macvtap:%{server_drivers}}
# Force QEMU to run as qemu:qemu
%define qemu_user qemu
%define qemu_group qemu
%else
%define qemu_user root
%define qemu_group root
%endif
%endif
%if %{with_macvtap}
%define with_libnl 1
%endif
# Pull in cgroups config system
%if %{with_qemu} || %{with_lxc}
%define with_cgconfig 0%{!?_without_cgconfig:1}
%endif
%if %{with_udev}
%define with_nodedev 1
%else
%define with_nodedev 0
%endif
%if %{with_storage_fs} || %{with_storage_mpath} || %{with_storage_iscsi} || %{with_storage_lvm} || %{with_storage_disk}
%define with_storage 1
%else
%define with_storage 0
%endif
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
BuildRequires: bridge-utils
BuildRequires: fdupes
BuildRequires: gettext
BuildRequires: libgcrypt-devel
BuildRequires: libgnutls-devel
BuildRequires: libtasn1-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: libxslt
BuildRequires: ncurses-devel
BuildRequires: pkg-config
BuildRequires: python-devel
BuildRequires: python-xml
BuildRequires: readline-devel
BuildRequires: xhtml-dtd
# Only for directory ownership:
BuildRequires: gtk-doc
%if %{with_xen} || %{with_libxl}
BuildRequires: xen-devel
%endif
%if %{with_sasl}
BuildRequires: cyrus-sasl-devel
%endif
%if %{with_udev}
BuildRequires: libpciaccess0-devel >= 0.10.9
BuildRequires: libudev-devel >= 145
%endif
%if %{with_avahi}
%if 0%{?suse_version} > 1030
BuildRequires: libavahi-devel
%else
BuildRequires: avahi-devel
%endif
%endif
%if %{with_selinux}
BuildRequires: libselinux-devel
%endif
%if %{with_apparmor}
BuildRequires: libapparmor-devel
%endif
%if %{with_numactl}
BuildRequires: libnuma-devel
%endif
%if %{with_numad}
BuildRequires: numad
%endif
%if %{with_polkit}
%if 0%{?suse_version} > 1110
BuildRequires: polkit >= 0.9
%else
BuildRequires: PolicyKit-devel >= 0.6
%endif
%endif
%if %{with_phyp}
BuildRequires: libssh2-devel
%endif
%if %{with_yajl}
BuildRequires: libyajl-devel
%endif
%if %{with_esx}
BuildRequires: libcurl-devel
%endif
%if %{with_hyperv}
BuildRequires: libwsman-devel >= 2.2.3
%endif
%if %{with_capng}
BuildRequires: libcap-ng-devel >= 0.5.0
%endif
%if %{with_netcf}
BuildRequires: netcf-devel >= 0.1.4
%endif
%if %{with_netcontrol}
BuildRequires: libnetcontrol-devel >= 0.2.0
%endif
%if %{with_network}
BuildRequires: dnsmasq >= 2.41
BuildRequires: iptables
BuildRequires: radvd
%endif
%if %{with_nwfilter}
BuildRequires: ebtables
%endif
%if %{with_libpcap}
BuildRequires: libpcap-devel
%endif
%if %{with_libnl}
%if 0%{?suse_version} < 1210
BuildRequires: libnl-devel
%else
BuildRequires: libnl-1_1-devel
%endif
%endif
%if %{with_storage_fs}
# For mount/umount in FS driver
BuildRequires: util-linux
%endif
%if %{with_storage_lvm}
# For LVM drivers
BuildRequires: lvm2
%endif
%if %{with_storage_iscsi}
# For ISCSI driver
BuildRequires: open-iscsi
%endif
%if %{with_storage_disk}
# For disk driver
BuildRequires: parted-devel
%endif
%if %{with_storage_mpath}
# For Multipath support
BuildRequires: device-mapper-devel
%endif
%if %{with_storage_rbd}
BuildRequires: ceph-devel
%endif
%if %{with_audit}
BuildRequires: audit-devel
%endif
%if %{with_dtrace}
# we need /usr/sbin/dtrace
BuildRequires: systemtap-sdt-devel
%endif
%if %{with_sanlock}
BuildRequires: sanlock-devel >= 2.4
%endif
%if %{with_systemd}
BuildRequires: systemd
%endif
Name: libvirt
Url: http://libvirt.org/
Version: 1.0.1
Release: 0
Summary: A C toolkit to interact with the virtualization capabilities of Linux
License: LGPL-2.1+
Group: Development/Libraries/C and C++
Conflicts: kvm < 0.14.1
# The client side, i.e. shared libs and virsh are in a subpackage
Requires: %{name}-client = %{version}-%{release}
Requires: virt-utils
# Used by many of the drivers, so turn it on whenever the
# daemon is present
%if %{with_libvirtd}
Recommends: bridge-utils
# for modprobe of pci devices
Requires: module-init-tools
# for /sbin/ip & /sbin/tc
Requires: iproute
%endif
%if %{with_network}
Recommends: dnsmasq >= 2.41
Recommends: radvd
%endif
%if %{with_network} || %{with_nwfilter}
Recommends: iptables
%endif
%if %{with_nwfilter}
Recommends: ebtables
%endif
Recommends: logrotate
Recommends: nfs-client
%if %{with_udev}
Requires: udev >= 145
%endif
%if %{with_polkit}
%if 0%{?suse_version} > 1110
Recommends: polkit >= 0.9
%else
Recommends: PolicyKit >= 0.6
%endif
%endif
%if %{with_storage_fs}
Recommends: nfs-utils
%endif
%if %{with_storage_lvm}
# For LVM drivers
Recommends: lvm2
%endif
%if %{with_storage_iscsi}
# For ISCSI driver
Recommends: open-iscsi
%endif
%if %{with_storage_disk}
# For disk driver
Recommends: parted
Recommends: device-mapper
%endif
%if %{with_storage_mpath}
# For multipath support
Recommends: device-mapper
%endif
%if 0%{?suse_version} > 1110
%ifarch i386 i586 i686 x86_64 ia64
# For virConnectGetSysinfo
Recommends: dmidecode
%endif
%endif
%if %{with_numad}
Requires: numad
%endif
# For service management
%if %{with_systemd}
%{?systemd_requires}
%endif
Source0: %{name}-%{version}.tar.bz2
Source1: libvirtd.init
Source2: libvirtd-relocation-server.fw
Source99: baselibs.conf
# Upstream patches
Patch0: 66ff2ddc-virtlockd-systemd-file-perms.patch
Patch1: 462a6962-script-fixes1.patch
Patch2: cb854b8f-script-fixes2.patch
Patch3: 5ec4b22b-script-fixes3.patch
Patch4: a1fd56cb-script-fixes4.patch
Patch5: 68e7bc45-libxl-link-fix.patch
# Need to go upstream
Patch100: xen-name-for-devid.patch
Patch101: clone.patch
Patch102: xen-pv-cdrom.patch
Patch103: AF_PACKET.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: libvirtd-init-script.patch
Patch202: libvirt-guests-init-script.patch
Patch203: virtlockd-init-script.patch
Patch204: relax-qemu-usergroup-check.patch
Patch205: suse-qemu-conf.patch
%if %{with_apparmor}
Patch250: install-apparmor-profiles.patch
%endif
%if %{with_netcontrol}
Patch300: libvirt-suse-netcontrol.patch
%endif
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
Summary: Client side library and utilities of the libvirt library
Group: Development/Libraries/C and C++
Requires: ncurses
Requires: readline
# Needed by libvirt-guests init script.
Requires: cyrus-sasl
Requires: gettext
Recommends: cyrus-sasl-digestmd5
# So remote clients can access libvirt over SSH tunnel
# (client invokes 'nc' against the UNIX socket on the server)
Recommends: netcat-openbsd
# Needed for probing the power management features of the host.
Recommends: pm-utils
%description client
Libvirt is a C toolkit to interact 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
Summary: A C toolkit to interact with the virtualization capabilities of Linux
Group: Development/Libraries/C and C++
Requires: %{name}-client = %{version}-%{release}
Requires: libxml2-devel
Requires: pkg-config
%if %{with_xen} || %{with_libxl}
Requires: xen-devel
%endif
%description devel
Libvirt is a C toolkit to interact 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
Summary: A C toolkit to interact 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 interact with the virtualization
capabilities of Linux. The libvirt-doc package contains documentation
for the libvirt API and tools.
Authors:
--------
Daniel Veillard <veillard@redhat.com>
Karel Zak <kzak@redhat.com>
%if %{with_sanlock}
%package lock-sanlock
Summary: Sanlock lock manager plugin for QEMU driver
Group: Development/Libraries/C and C++
Requires: sanlock >= 2.4
#for virt-sanlock-cleanup require augeas
Requires: %{name} = %{version}-%{release}
Requires: augeas
%description lock-sanlock
Includes the Sanlock lock manager plugin for the QEMU driver
%endif
%if %{with_python}
%package python
Summary: A C toolkit to interact 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 interact 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>
%endif
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch100 -p1
%patch101
%patch102 -p1
%patch103 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
%patch203 -p1
%patch204 -p1
%patch205 -p1
%if %{with_apparmor}
%patch250 -p1
%endif
%if %{with_netcontrol}
%patch300 -p1
%endif
%build
%if ! %{with_xen}
%define _without_xen --without-xen
%endif
%if ! %{with_qemu}
%define _without_qemu --without-qemu
%endif
%if ! %{with_openvz}
%define _without_openvz --without-openvz
%endif
%if ! %{with_lxc}
%define _without_lxc --without-lxc
%endif
%if ! %{with_vbox}
%define _without_vbox --without-vbox
%endif
%if ! %{with_xenapi}
%define _without_xenapi --without-xenapi
%endif
%if ! %{with_uml}
%define _without_uml --without-uml
%endif
%if ! %{with_phyp}
%define _without_phyp --without-phyp
%endif
%if ! %{with_esx}
%define _without_esx --without-esx
%endif
%if ! %{with_vmware}
%define _without_vmware --without-vmware
%endif
%if ! %{with_hyperv}
%define _without_hyperv --without-hyperv
%endif
%if ! %{with_parallels}
%define _without_parallels --without-parallels
%endif
%if ! %{with_libxl}
%define _without_libxl --without-libxl
%endif
%if ! %{with_libvirtd}
%define _without_libvirtd --without-libvirtd
%endif
%if ! %{with_storage_fs}
%define _without_storage_fs --without-storage-fs
%endif
%if ! %{with_storage_lvm}
%define _without_storage_lvm --without-storage-lvm
%endif
%if ! %{with_storage_iscsi}
%define _without_storage_iscsi --without-storage-iscsi
%endif
%if ! %{with_storage_disk}
%define _without_storage_disk --without-storage-disk
%endif
%if ! %{with_storage_mpath}
%define _without_storage_mpath --without-storage-mpath
%endif
%if ! %{with_storage_rbd}
%define _without_storage_rbd --without-storage-rbd
%endif
%if ! %{with_storage_sheepdog}
%define _without_storage_sheepdog --without-storage-sheepdog
%endif
%if ! %{with_numactl}
%define _without_numactl --without-numactl
%endif
%if ! %{with_numad}
%define _without_numad --without-numad
%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_netcontrol}
%define _without_netcontrol --without-netcontrol
%endif
%if ! %{with_udev}
%define _without_udev --without-udev
%endif
%if ! %{with_yajl}
%define _without_yajl --without-yajl
%endif
%if ! %{with_macvtap}
%define _without_macvtap --without-macvtap
%endif
%if ! %{with_polkit}
%define _without_polkit --without-polkit
%endif
%if ! %{with_audit}
%define _without_audit --without-audit
%endif
%if ! %{with_dtrace}
%define _without_dtrace --without-dtrace
%endif
%if ! %{with_interface}
%define _without_interface --without-interface
%endif
%if ! %{with_network}
%define _without_network --without-network
%endif
%if ! %{with_sasl}
%define _without_sasl --without-sasl
%endif
%if ! %{with_avahi}
%define _without_avahi --without-avahi
%endif
%if ! %{with_python}
%define _without_python --without-python
%endif
%if ! %{with_libpcap}
%define _without_libpcap --without-libpcap
%endif
%if ! %{with_sanlock}
%define _without_sanlock --without-sanlock
%endif
%if %{with_systemd}
%define init_scripts --with-init_script=systemd+redhat
%else
%define init_scripts --with-init_script=redhat
%endif
%if ! %{with_driver_modules}
%define _without_driver_modules --without-driver-modules
%endif
%if %{with_firewalld}
%define _with_firewalld --with-firewalld
%endif
autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS"
%configure --disable-static --with-pic \
%{?_without_xen} \
%{?_without_qemu} \
%{?_without_openvz} \
%{?_without_lxc} \
%{?_without_vbox} \
%{?_without_libxl} \
%{?_without_xenapi} \
%{?_without_sasl} \
%{?_without_avahi} \
%{?_without_polkit} \
%{?_without_python} \
%{?_without_libvirtd} \
%{?_without_uml} \
%{?_without_phyp} \
%{?_without_esx} \
%{?_without_hyperv} \
%{?_without_vmware} \
%{?_without_parallels} \
%{?_without_interface} \
%{?_without_network} \
%{?_without_storage_fs} \
%{?_without_storage_lvm} \
%{?_without_storage_iscsi} \
%{?_without_storage_disk} \
%{?_without_storage_mpath} \
%{?_without_storage_rbd} \
%{?_without_storage_sheepdog} \
%{?_without_numactl} \
%{?_without_numad} \
%{?_without_capng} \
%{?_without_netcf} \
%{?_without_netcontrol} \
%{?_without_selinux} \
%{?_without_apparmor} \
%{?_without_udev} \
%{?_without_yajl} \
%{?_without_sanlock} \
%{?_without_libpcap} \
%{?_without_macvtap} \
%{?_without_audit} \
%{?_without_dtrace} \
%{?_without_driver_modules} \
%{?_with_firewalld} \
--libexecdir=%{_libdir}/%{name} \
--with-qemu-user=%{qemu_user} \
--with-qemu-group=%{qemu_group} \
%{init_scripts} \
ac_cv_path_MODPROBE=/sbin/modprobe \
ac_cv_path_UDEVADM=/sbin/udevadm \
ac_cv_path_SHOWMOUNT=/usr/sbin/showmount
make V=1 %{?jobs:-j%jobs} DOCS_DIR=%{_docdir}/%{name}-python EXAMPLE_DIR=%{_docdir}/%{name}-python/examples HTML_DIR=%{_docdir}/%{name}
%install
%makeinstall SYSTEMD_UNIT_DIR=%{_unitdir} 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 ..
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{py_sitedir}/*.la
rm -f $RPM_BUILD_ROOT%{py_sitedir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/lock-driver/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}/lock-driver/*.a
# remove currently unsupported locale(s)
rm -rf $RPM_BUILD_ROOT/usr/share/locale/sr@latin
%if 0%{?suse_version} < 1130
rm -rf $RPM_BUILD_ROOT/usr/share/locale/vi_VN
%endif
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/libvirt
%find_lang %{name}
%if %{with_network}
install -d -m 0755 $RPM_BUILD_ROOT%{_localstatedir}/lib/libvirt/dnsmasq/
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/
cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
# Strip auto-generated UUID - we need it generated per-install
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
%else
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
%endif
%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
%if ! %{with_python}
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-python
%endif
%if ! %{with_libvirtd}
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter
%endif
# init scripts
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates
%if %{with_libvirtd}
# Currently using our own libvirtd init script
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirtd
install %SOURCE1 $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirtd
ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT%{_sbindir}/rclibvirtd
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirtd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd
rm -f $RPM_BUILD_ROOT/usr/lib/sysctl.d/libvirtd.conf
# For other services, use the in-tree scripts
mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlockd $RPM_BUILD_ROOT%{_sysconfdir}/init.d/virtlockd
ln -s /etc/init.d/virtlockd $RPM_BUILD_ROOT%{_sbindir}/rcvirtlockd
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/virtlockd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd
%endif
mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirt-guests
ln -s /etc/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sbindir}/rclibvirt-guests
mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirt-guests $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests
#install firewall definitions format is described here:
#/usr/share/SuSEfirewall2/services/TEMPLATE
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 %{S:2} $RPM_BUILD_ROOT/%{_fwdefdir}/libvirtd-relocation-server
%fdupes -s $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%if %{with_systemd}
%service_add_pre libvirtd.service
%service_add_pre virtlockd.service virtlockd.socket
%endif
%{_bindir}/getent group libvirt >/dev/null || \
%{_sbindir}/groupadd -r libvirt 2>/dev/null
%post
/sbin/ldconfig
%if %{with_libvirtd}
%if %{with_network}
# Install the default network if one doesn't exist
if ! /sbin/chkconfig libvirtd && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml
then
UUID=`/usr/bin/uuidgen`
sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \
< %{_datadir}/libvirt/networks/default.xml \
> %{_sysconfdir}/libvirt/qemu/networks/default.xml
fi
%endif
%if %{with_systemd}
%service_add_post libvirtd.service
%service_add_post virtlockd.service virtlockd.socket
%endif
%if 0%{?sles_version}
%{fillup_and_insserv -y -n libvirtd libvirtd}
%else # ! sles
%{fillup_only -n libvirtd}
%endif
%{fillup_only -n virtlockd}
%endif
%preun
%if %{with_libvirtd}
%if %{with_systemd}
%service_del_preun libvirtd.service
%service_del_preun virtlockd.service virtlockd.socket
%endif
%stop_on_removal libvirtd
%stop_on_removal virtlockd
%endif
%postun
/sbin/ldconfig
%if %{with_libvirtd}
%if %{with_systemd}
%service_del_postun libvirtd.service
%service_del_postun virtlockd.service virtlockd.socket
%endif
%restart_on_update libvirtd
%restart_on_update virtlockd
%endif
%insserv_cleanup
%post client
/sbin/ldconfig
%if %{with_systemd}
%service_add_post libvirt-guests.service
%endif
%{fillup_only -n libvirt-guests}
%preun client
%if %{with_systemd}
%service_del_preun libvirt-guests.service
%endif
%stop_on_removal libvirt-guests
if [ $1 = 0 ]; then
rm -f /var/lib/libvirt/libvirt-guests
fi
%postun client
/sbin/ldconfig
%if %{with_systemd}
%service_del_postun libvirt-guests.service
%endif
%insserv_cleanup
%if %{with_libvirtd}
%files
%defattr(-, root, root)
%{_sbindir}/libvirtd
%{_sbindir}/virtlockd
%dir %{_libdir}/%{name}
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
%if %{with_network}
%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) %{_localstatedir}/lib/libvirt/network/
%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/dnsmasq/
%dir %{_datadir}/libvirt/networks/
%{_datadir}/libvirt/networks/default.xml
%endif
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/
%{_sysconfdir}/libvirt/nwfilter/*.xml
%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd
%config /etc/init.d/libvirtd
%{_sbindir}/rclibvirtd
%{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd
%config /etc/init.d/virtlockd
%{_sbindir}/rcvirtlockd
%if %{with_systemd}
%{_unitdir}/libvirtd.service
%{_unitdir}/virtlockd.service
%{_unitdir}/virtlockd.socket
%endif
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd
%dir %{_datadir}/augeas/
%dir %{_datadir}/augeas/lenses
%dir %{_datadir}/augeas/lenses/tests
%{_datadir}/augeas/lenses/libvirtd.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd.aug
%{_datadir}/augeas/lenses/libvirt_lockd.aug
%{_datadir}/augeas/lenses/tests/test_libvirt_lockd.aug
%if %{with_dtrace}
%{_datadir}/systemtap/tapset/libvirt_probes.stp
%{_datadir}/systemtap/tapset/libvirt_functions.stp
%endif
%dir %{_localstatedir}/lib/libvirt/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
%dir %attr(0711, root, root) %{_localstatedir}/cache/libvirt/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
%dir %attr(0755, root, root) %{_libdir}/%{name}/lock-driver
%attr(0755, root, root) %{_libdir}/%{name}/lock-driver/lockd.so
%if %{with_polkit}
%if 0%{?suse_version} > 1110
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
%else
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
%endif
%endif
%if %{with_qemu}
%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
%config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%{_datadir}/augeas/lenses/libvirtd_qemu.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
%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
%{_datadir}/augeas/lenses/libvirtd_lxc.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
%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 %{with_libxl}
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
%endif
%if %{with_storage_disk}
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_parthelper
%endif
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_iohelper
%doc %{_mandir}/man8/libvirtd.8*
%if %{with_apparmor}
%dir %{_sysconfdir}/apparmor.d
%dir %{_sysconfdir}/apparmor.d/abstractions
%dir %{_sysconfdir}/apparmor.d/libvirt
%config(noreplace) %{_sysconfdir}/apparmor.d/usr.sbin.libvirtd
%config(noreplace) %{_sysconfdir}/apparmor.d/usr.lib.libvirt.virt-aa-helper
%config(noreplace) %{_sysconfdir}/apparmor.d/abstractions/libvirt-qemu
%config(noreplace) %{_sysconfdir}/apparmor.d/libvirt/TEMPLATE
%{_libdir}/%{name}/virt-aa-helper
%endif
%config %{_fwdefdir}/libvirtd-relocation-server
%endif # with_libvirtd
%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*
%doc %{_mandir}/man1/virt-host-validate.1*
%config(noreplace) %{_sysconfdir}/libvirt/libvirt.conf
%{_bindir}/virsh
%{_bindir}/virt-xml-validate
%{_bindir}/virt-pki-validate
%{_bindir}/virt-host-validate
%dir %{_libdir}/%{name}
%{_libdir}/lib*.so.*
%attr(0755, root, root) %{_libdir}/%{name}/libvirt-guests.sh
%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests
%config /etc/init.d/libvirt-guests
%{_sbindir}/rclibvirt-guests
%if %{with_systemd}
%{_unitdir}/libvirt-guests.service
%endif
%dir %{_datadir}/libvirt/
%dir %{_datadir}/libvirt/schemas/
%{_datadir}/libvirt/schemas/basictypes.rng
%{_datadir}/libvirt/schemas/capability.rng
%{_datadir}/libvirt/schemas/domain.rng
%{_datadir}/libvirt/schemas/domaincommon.rng
%{_datadir}/libvirt/schemas/domainsnapshot.rng
%{_datadir}/libvirt/schemas/interface.rng
%{_datadir}/libvirt/schemas/network.rng
%{_datadir}/libvirt/schemas/networkcommon.rng
%{_datadir}/libvirt/schemas/nodedev.rng
%{_datadir}/libvirt/schemas/nwfilter.rng
%{_datadir}/libvirt/schemas/secret.rng
%{_datadir}/libvirt/schemas/storageencryption.rng
%{_datadir}/libvirt/schemas/storagepool.rng
%{_datadir}/libvirt/schemas/storagevol.rng
%{_datadir}/libvirt/cpu_map.xml
%if %{with_sasl}
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
%endif
%files devel
%defattr(-, root, root)
%{_includedir}/libvirt
%{_libdir}/*.so
%{_libdir}/pkgconfig/libvirt.pc
%dir %{_datadir}/libvirt/api/
%{_datadir}/libvirt/api/libvirt-api.xml
%{_datadir}/libvirt/api/libvirt-qemu-api.xml
%files doc
%defattr(-, root, root)
%{_datadir}/gtk-doc/html/libvirt
%doc %{_docdir}/%{name}/*.png
%doc %{_docdir}/%{name}/*.html
%doc %{_docdir}/%{name}/*.gif
%doc %{_docdir}/%{name}/*.css
%doc %{_docdir}/%{name}/html
%doc %{_docdir}/%{name}/internals
%if %{with_sanlock}
%files lock-sanlock
%defattr(-, root, root)
%doc %{_mandir}/man8/virt-sanlock-cleanup.8*
%if %{with_qemu}
%config(noreplace) %{_sysconfdir}/%{name}/qemu-sanlock.conf
%endif
%dir %{_libdir}/%{name}/lock-driver/
%attr(0755, root, root) %{_libdir}/%{name}/lock-driver/sanlock.so
%dir %{_datadir}/augeas/
%dir %{_datadir}/augeas/lenses
%dir %{_datadir}/augeas/lenses/tests
%{_datadir}/augeas/lenses/libvirt_sanlock.aug
%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
%dir %attr(0700, root, root) %{_localstatedir}/lib/%{name}/sanlock
%{_sbindir}/virt-sanlock-cleanup
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_sanlock_helper
%endif
%if %{with_python}
%files python
%defattr(-, root, root)
%doc %{_docdir}/%{name}-python
%{py_sitedir}/libvirt.py*
%{_libdir}/python*/site-packages/libvirt_qemu.py*
%{py_sitedir}/libvirtmod*
%endif
%changelog