File libvirt-cim.spec of Package libvirt-cim

#
# spec file for package libvirt-cim
#
# 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/
#


Name:           libvirt-cim
BuildRequires:  e2fsprogs-devel
BuildRequires:  libcmpiutil-devel > 0.5.4
BuildRequires:  libtool
BuildRequires:  libvirt-devel >= 0.3.2
BuildRequires:  libxml2-devel
BuildRequires:  sblim-cmpi-devel
BuildRequires:  sblim-sfcb
%ifarch %ix86 x86_64
BuildRequires:  xen-devel
%endif
%if 0%{?rhel_version} == 0 && 0%{?sles_version} != 10
BuildRequires:  libuuid-devel
%endif
Url:            http://libvirt.org/CIM/
Version:        0.5.14
Release:        0.<RELEASE2>
Summary:        CMPI-based CIM provider implementing DMTF SVPC model
License:        LGPL-2.1+
Group:          System/Management
Source:         %{name}-%{version}.tar.bz2
Source1:        libvirt-cim-rpmlintrc
Patch0:         provider-reg.patch
Patch1:         automake.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       cim-schema >= 2.17
Requires:       cim-server
Requires:       libvirt >= 0.3.2
Requires:       libxml2 >= 2.6.0
Requires:       unzip
Provides:       xen-cim-cmpi = 0.2.0
Obsoletes:      xen-cim-cmpi < 0.2.0

%description
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.



Authors:
--------
    Dan Smith <danms@us.ibm.com>

%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

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

%build
autoreconf -i -f
export CFLAGS="$RPM_OPT_FLAGS"
%configure --disable-werror
make DOCS_DIR=%{_docdir}/%{name} HTML_DIR=%{_docdir}/%{name}

%install
%if 0%{?suse_version}
%makeinstall DOCS_DIR=%{_docdir}/%{name} HTML_DIR=%{_docdir}/%{name}
%else
make install DESTDIR=$RPM_BUILD_ROOT DOCS_DIR=%{_docdir}/%{name}-%{version} HTML_DIR=%{_docdir}/%{name}-%{version}
%endif
%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/*.{a,la}
%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/cmpi/*.{a,la}
%{__rm} -f $RPM_BUILD_ROOT%{_libdir}/libxkutil.so
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/libvirt/cim

%clean
%{__rm} -rf $RPM_BUILD_ROOT
# do nothing if not an upgrade, otherwise deregister current providers

%pre
[ $1 -eq 1 ] && exit 0
%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
	-n root/virt \
	-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true

%post
/sbin/ldconfig
%{_datadir}/%{name}/install_base_schema.sh %{_datadir}/%{name}
%restart_on_update sfcb
%{_datadir}/%{name}/provider-register.sh -t sfcb \
        -n root/virt \
        -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
%{_datadir}/%{name}/provider-register.sh -t sfcb \
        -n root/virt \
        -r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true
%{_datadir}/%{name}/provider-register.sh -t sfcb \
        -n root/interop \
        -r %{INTEROP_REG} -m %{INTEROP_MOF} -v >/dev/null 2>&1 || true
%{_datadir}/%{name}/provider-register.sh -t sfcb \
        -n root/cimv2\
        -r %{CIMV2_REG} -m %{CIMV2_MOF} -v >/dev/null 2>&1 || true

%preun
%{_datadir}/%{name}/provider-register.sh -d -t sfcb \
	-n root/virt \
	-r %{REGISTRATION} -m %{SCHEMA} >/dev/null 2>&1 || true

%postun -p /sbin/ldconfig

%files 
%defattr(-, root, root)
%dir %{_datadir}/%{name}
%config(noreplace) %{_sysconfdir}/libvirt-cim.conf
%{_libdir}/lib*.so*
%{_libdir}/cmpi/lib*.so*
%{_datadir}/%{name}/*.sh
%{_datadir}/%{name}/*.mof
%{_datadir}/%{name}/*.registration
%{_datadir}/%{name}/cim_schema_*-MOFs.zip
%{_datadir}/%{name}/cimv*-cimv2_mof
%{_datadir}/%{name}/cimv*-interop_mof
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/cim
%if 0%{?suse_version}
%doc %{_docdir}/%{name}
%else
%doc %{_docdir}/%{name}-%{version}
%endif

%changelog
openSUSE Build Service is sponsored by