File libvirt-cim.spec of Package libvirt-cim

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

%if 0%{?suse_version} > 1140 || 0%{?fedora_version} > 14
%define has_systemd 1
%define has_systemd 0

Name:           libvirt-cim

License:        LGPL-2.1+
Group:          System/Management
Version:        0.6.3
Release:        0
Summary:        CMPI-based CIM provider implementing DMTF SVPC model
Source:         %{name}-%{version}.tar.bz2
Source1:        libvirt-cim-rpmlintrc
Source2:        README.SUSE
Patch0:         provider-reg.patch
Patch1:         automake.patch
Patch2:         libvirt-cim-0.6.3-fix-bashisms.patch
Patch3:         f6b7eeaf.patch
Patch4:         memory_leaks.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  automake
BuildRequires:  autoconf
BuildRequires:  e2fsprogs-devel
BuildRequires:  libcmpiutil-devel > 0.5.4
BuildRequires:  libtool
BuildRequires:  libuuid-devel
BuildRequires:  libvirt-devel >= 0.3.2
BuildRequires:  libxml2-devel
BuildRequires:  sblim-cmpi-devel
BuildRequires:  sblim-sfcb
%if 0%{?has_systemd}
BuildRequires:  systemd
# the %pre/%post scripts are sfcb specific currently
Requires:       sblim-sfcb
Requires:       libxml2 >= 2.6.0
Requires:       cim-schema >= 2.17
Requires:       unzip
%if 0%{?suse_version} >= 1140
%if 0%{?has_systemd} == 0
Requires:       sysvinit-tools
Provides:       xen-cim-cmpi = 0.2.0
Obsoletes:      xen-cim-cmpi < 0.2.0

Libvirt-cim is a CMPI CIM provider that implements the DMTF SVPC
virtualization model. The goal is to support most of the features
exported by libvirt itself, enabling management of multiple platforms
with a single provider.

    Dan Smith <>

%define REGISTRATION %{_datadir}/%{name}/*.registration
%define SCHEMA %{_datadir}/%{name}/*.mof
%define INTEROP_REG %{_datadir}/%{name}/{RegisteredProfile,ElementConformsToProfile,ReferencedProfile}.registration
%define INTEROP_MOF %{_datadir}/%{name}/{ComputerSystem,HostSystem,RegisteredProfile,DiskPool,MemoryPool,NetPool,ProcessorPool,VSMigrationService,ElementConformsToProfile,ReferencedProfile,AllocationCapabilities}.mof
%define CIMV2_REG %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,ElementConformsToProfile,HostedAccessPoint}.registration
%define CIMV2_MOF %{_datadir}/%{name}/{HostedResourcePool,ElementCapabilities,HostedService,HostedDependency,RegisteredProfile,ComputerSystem,ElementConformsToProfile,HostedAccessPoint}.mof

%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
chmod -x src/* libxkutil/* schema/* README doc/* base_schema/README*
chmod +X src/* libxkutil/* schema/*

autoreconf -i -f
%configure --disable-werror --disable-static
make %{?_smp_mflags} DOCS_DIR=%{_docdir}/%{name} HTML_DIR=%{_docdir}/%{name}

%if 0%{?suse_version}
%make_install DOCS_DIR=%{_docdir}/%{name} HTML_DIR=%{_docdir}/%{name}
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_docdir}/%{name}
make install DESTDIR=$RPM_BUILD_ROOT DOCS_DIR=%{_docdir}/%{name}-%{version} HTML_DIR=%{_docdir}/%{name}-%{version}
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/cmpi/*.{a,la}
%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/
#%{__rm} -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
#%{__rm} -f $RPM_BUILD_ROOT%{_datadir}/%{name}/
#%{__rm} -f $RPM_BUILD_ROOT%{_datadir}/%{name}/cimv216-interop_mof
#%{__rm} -f $RPM_BUILD_ROOT%{_datadir}/%{name}/
#%{__rm} -f $RPM_BUILD_ROOT%{_datadir}/%{name}/fix_schema.patch
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/libvirt/cim

# unregister current providers on upgrade only
if [ $1 -eq 2 ]; then
%{_datadir}/%{name}/ -d -t sfcb \
	-n root/virt \
	-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true

%{_datadir}/%{name}/ %{_datadir}/%{name}
# Register libvirt-cim on the sfcb's providers list
%{_datadir}/%{name}/ -t sfcb \
        -n root/virt \
        -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
# Register some of our providers under other namespaces too? ok.
%{_datadir}/%{name}/ -t sfcb \
        -n root/interop \
        -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true
%{_datadir}/%{name}/ -t sfcb \
        -n root/cimv2\
        -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true
# Restart the sfcb to update its providers list
if test -x /usr/sbin/sfcbd ; then
%if 0%{?has_systemd}
  systemctl try-restart sblim-sfcb.service >/dev/null 2>&1 || :
  /etc/init.d/sfcb restart

# unregister our providers only on uninstall
if [ $1 -eq 0 ]; then
%{_datadir}/%{name}/ -d -t sfcb \
	-n root/virt \
	-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true

# Restart the sfcb to update its providers list
if test -x /usr/sbin/sfcbd ; then
%if 0%{?has_systemd}
  systemctl try-restart sblim-sfcb.service >/dev/null 2>&1 || :
  /etc/init.d/sfcb restart

%defattr(-, root, root)
%dir %{_datadir}/%{name}
%config(noreplace) %{_sysconfdir}/libvirt-cim.conf
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/cim
%if 0%{?suse_version}
%doc %{_docdir}/%{name}
%doc %{_docdir}/%{name}-%{version}