File libvirt.spec of Package libvirt

#
# spec file for package libvirt (Version 0.4.6)
#
# 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

%define with_xen     1
%define with_lxc     0
%define with_selinux 0
# Xen is available only on i386 x86_64
%ifnarch %ix86 x86_64
%define with_xen 0
%endif
%if 0%{?suse_version} > 1100
%define with_lxc     1
%define with_selinux 1
%endif

Name:           libvirt
BuildRequires:  PolicyKit-devel bridge-utils cyrus-sasl-devel fdupes gettext gnutls-devel iptables-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel readline-devel util-linux xhtml-dtd
%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
# Only for directory ownership:
BuildRequires:  gtk-doc
Url:            http://libvirt.org/
License:        LGPL v2.1 or later
Group:          Development/Libraries/C and C++
AutoReqProv:    yes
Version:        0.4.6
Release:        11.<RELEASE17>
Summary:        A C toolkit to interract with the virtualization capabilities of Linux
Requires:       readline
Requires:       ncurses
Requires:       bridge-utils
Requires:       iptables
Requires:       cyrus-sasl
Requires:       lvm2
Requires:       parted
#Requires:       /usr/bin/qemu-img
Recommends:     cyrus-sasl-digestmd5
Requires:       dnsmasq
Requires:       PolicyKit >= 0.6
Requires:       socat
Requires:       open-iscsi
Source0:        %{name}-%{version}.tar.bz2
Source1:        libvirtd.init
Patch0:         socat.patch
Patch1:         libvirtd-defaults.patch
Patch2:         fs-storage-driver.patch
Patch3:         snapshots.patch
Patch4:         vif-parsing.patch
Patch5:         xen-maxmem.patch
Patch6:         cgroup.patch
Patch7:         lxc_res_mem.patch
Patch8:         cgshares.patch
Patch9:         lxcsched.patch
Patch10:        lxcvirsh.patch
Patch11:        cgmajor.patch
Patch12:        lxcpty.patch
Patch13:        clone.patch
Patch14:        vnc-port.patch
Patch15:        suse-network.patch
Patch16:        xen-pv-cdrom.patch
Patch17:        detach-disk.patch
Patch18:        migrate-params.patch
Patch19:        cve-2008-5086.patch
Patch20:        devhelp.patch
Patch21:        pv-cdrom-connect.patch 
Patch22:        vnclisten.patch
Patch23:        no-xen-bridge-source.patch
Patch24:        sexpr2string.patch
Patch25:        xend-vcpupin-inactive.patch
Patch26:        xend-cpumaps.patch
Patch27:        vcpupin-fix.patch
Patch28:        qemu-caps.patch
Patch29:        CVE-2010-2242-nat.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
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
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.



Authors:
--------
    Daniel Veillard <veillard@redhat.com>
    Karel Zak <kzak@redhat.com>

%package devel
License:        LGPL v2.1 or later
Summary:        A C toolkit to interract with the virtualization capabilities of Linux
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version} libxml2-devel
%if %{with_xen}
Requires:       xen-devel
%endif

%description devel
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
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
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.



Authors:
--------
    Daniel Veillard <veillard@redhat.com>
    Karel Zak <kzak@redhat.com>

%package doc
License:        LGPL v2.1 or later
Summary:        A C toolkit to interract with the virtualization capabilities of Linux
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description doc
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
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
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.



Authors:
--------
    Daniel Veillard <veillard@redhat.com>
    Karel Zak <kzak@redhat.com>

%package python
License:        LGPL v2.1 or later
Summary:        A C toolkit to interract with the virtualization capabilities of Linux
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
%py_requires

%description python
Libvirt is a C toolkit to interract with the virtualization
capabilities Linux. Virtualization of the Linux Operating System means
the ability to run multiple instances of Operating Systems concurently
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
initially for the Xen paravirtualization but should be able to
integrate other virtualization mechanisms if needed.



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
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
rm po/no.*

%build
%if ! %{with_xen}
%define _without_xen --without-xen
%endif
%if ! %{with_lxc}
%define _without_lxc --without-lxc
%endif
%if %{with_selinux}
%define _with_selinux --with-selinux
%endif
autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS"
%configure %{?_without_xen} \
           %{?_without_lxc} \
           %{?_with_selinux} \
           --libexecdir=%{_libdir}/%{name} \
           --with-init-script=none \
           --with-remote-pid-file=%{_localstatedir}/run/libvirtd.pid \
           --with-xen-proxy=no \
           ac_cv_path_DNSMASQ=/usr/sbin/dnsmasq \
           ac_cv_path_QEMU_IMG=/usr/bin/qemu-img-xen \
           ac_cv_path_ISCSIADM=/sbin/iscsiadm
make 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
# for now, do not install the default network definition
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
# do not package augeas config files for now
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_qemu.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/run/libvirt
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/libvirt
rm $RPM_BUILD_ROOT%{_docdir}/%{name}/{*.c,examples.x*}
rm $RPM_BUILD_ROOT%{_libdir}/*.*a $RPM_BUILD_ROOT%{py_sitedir}/*.*a
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
%{fillup_and_insserv -f -y libvirtd}

%preun
%stop_on_removal libvirtd

%postun
/sbin/ldconfig
%restart_on_update libvirtd
%insserv_cleanup

%files -f %{name}.lang
%defattr(-, root, root)
%{_bindir}/virsh
%{_sbindir}/libvirtd
%doc %dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/[CNRT]*
%doc %{_docdir}/%{name}/AUTHORS
%doc %{_mandir}/man1/virsh.1*
%{_libdir}/*.so.*
%dir %{_libdir}/%{name}
%if 0%{?suse_version} > 1030
%{_libdir}/%{name}/libvirt_parthelper
%endif
%if %{with_lxc}
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_lxc
%endif
%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 /%{_localstatedir}/run/libvirt/
%dir /%{_localstatedir}/lib/libvirt/
%config /etc/init.d/libvirtd
%{_sbindir}/rclibvirtd
%config %{_sysconfdir}/libvirt/libvirtd.conf
%config %{_sysconfdir}/libvirt/qemu.conf
%config %{_sysconfdir}/sasl2/libvirt.conf
%if 0%{?suse_version} > 1030
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
%endif

%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}/*.gif
%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
openSUSE Build Service is sponsored by