File sblim-cmpi-base.spec of Package sblim-cmpi-base

#
# spec file for package sblim-cmpi-base
#
# Copyright (c) 2012 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:           sblim-cmpi-base
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  sblim-cmpi-devel
BuildRequires:  sblim-indication_helper-devel
BuildRequires:  sblim-sfcb
BuildRequires:  sblim-testsuite
Version:        1.6.1
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       cim-server cim-schema
Url:            http://sblim.wiki.sourceforge.net/
Source0:        http://prdownloads.sourceforge.net/sblim/%{name}-%{version}.tar.bz2
Source1:        sblim-cmpi-base-rpmlintrc
# PATCH-FEATURE-OPENSUSE sblim-cmpi-base-%{version}-methods-enable.patch [ bnc#470670 ] mhrusecky@suse.cz -- Enables methods by default
Patch0:         sblim-cmpi-base-%{version}-methods-enable.patch
# PATCH-FIX-UPSTREAM sblim-cmpi-base-%{version}-missing-fclose.patch [ bnc#530325 upstream#2843613 ] mhrusecky@suse.cz -- Adding missing fclose
Patch1:         sblim-cmpi-base-%{version}-missing-fclose.patch
Summary:        SBLIM Base Instrumentation
License:        EPL-1.0
Group:          System/Management

%description
Standards Based Linux Instrumentation Base Providers



Authors:
--------
    SBLIM Project

%package devel
Summary:        SBLIM Base Instrumentation Header Development Files
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
SBLIM Base Provider Development Package



Authors:
--------
    SBLIM Project

%package testsuite
Summary:        SBLIM Base Instrumentation (test suite)
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       sblim-testsuite

%description testsuite
Test suite for the Standards Based Linux Instrumentation Base Providers



Authors:
--------
    SBLIM Project

%prep
%setup -T -b 0 -n %{name}-%{version}
%patch0
%patch1

%build
autoreconf -fi
%configure TESTSUITEDIR=%{_datadir}/sblim-testsuite --disable-static
%{__make}

%install
%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%else
%makeinstall docdir=%{_docdir}/%{name}
%endif
# don't delete .la's until we sort out if sfcb/openwbem/pegasus use ltdlopen()
# %{__rm} %{buildroot}%{_libdir}/{libcmpiOSBase_Common,libdmiinfo}.la
# remove unused libtool files
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT/%{_libdir}/cmpi/*.a
rm -f $RPM_BUILD_ROOT/%{_libdir}/cmpi/*.la

%clean

%pre
# definition of schema and registration files
%define SCHEMA %{_datadir}/%{name}/Linux_Base.mof %{_datadir}/%{name}/Linux_BaseIndication.mof
%define PEGASUS_MOF  CIM_Card,CIM_UnixProcess,CIM_Processor,CIM_OperatingSystem,CIM_ComputerSystem,CIM_ComputerSystemPackage,CIM_RunningOS,CIM_OSProcess,CIM_SystemDevice,CIM_ProcessIndication,CIM_ElementStatisticalData
%define REGISTRATION %{_datadir}/%{name}/Linux_BaseIndication.registration
# If upgrading, deregister old version
if [ $1 -gt 1 ]
then
  %{_datadir}/%{name}/provider-register.sh -d \
	-r %{REGISTRATION} -m %{SCHEMA} > /dev/null ||:
fi

%post
# Register Schema and Provider - this is higly provider specific
# tog-pegasus needs some schemes registered first
if [ -x /usr/bin/peg-loadmof.sh ]; then
	peg-loadmof.sh -n root/cimv2 /usr/share/mof/cim-current/*/{%{PEGASUS_MOF}}.mof
	rctog-pegasus try-restart
fi
# and then following script can handle registration for various providers
%{_datadir}/%{name}/provider-register.sh \
	-r %{REGISTRATION} -m %{SCHEMA} > /dev/null ||:
/sbin/ldconfig

%preun
# Deregister only if not upgrading 
if [ $1 -eq 0 ]
then
  %{_datadir}/%{name}/provider-register.sh -d \
	-r %{REGISTRATION} -m %{SCHEMA} > /dev/null ||:
fi

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root) 
%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
%docdir %{_datadir}/doc/%{name}-%{version}
%doc %{_datadir}/doc/%{name}-%{version}
%else
%doc %{_docdir}/%{name}
%endif
%dir %{_libdir}/cmpi/
%{_libdir}/cmpi/libcmpiOSBase*.so
%{_libdir}/libcmpiOSBase_Common.so.*
%{_libdir}/libdmiinfo.so.*
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/provider-register.sh
%{_datadir}/%{name}/Linux_Base*
#possibly needed atm, as per above comment... leaving for now
%{_libdir}/libcmpiOSBase_Common.la
%{_libdir}/libdmiinfo.la

%files devel
%defattr(-,root,root)
%dir %{_includedir}/sblim
%{_includedir}/sblim/*
%{_libdir}/libcmpiOSBase_Common.so
%{_libdir}/libdmiinfo.so

%files testsuite
%defattr(-,root,root)
%dir %{_datadir}/sblim-testsuite
%dir %{_datadir}/sblim-testsuite/cim
%dir %{_datadir}/sblim-testsuite/system
%dir %{_datadir}/sblim-testsuite/system/linux
%{_datadir}/sblim-testsuite/test-cmpi-base.sh
%{_datadir}/sblim-testsuite/cim/Linux*.cim
%{_datadir}/sblim-testsuite/system/linux/*.pl
%{_datadir}/sblim-testsuite/system/linux/*.system
%{_datadir}/sblim-testsuite/system/linux/Linux_OperatingSystem.version.sh
%{_datadir}/sblim-testsuite/system/linux/createKeyFiles.sh

%changelog