File sblim-smis-hba.spec of Package sblim-smis-hba

#
# spec file for package sblim-smis-hba
#
# 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/
#


%define cmpi_provider_dir %{_libdir}/cmpi

Name:           sblim-smis-hba
Version:        1.0.0
Release:        0
Summary:        SBLIM SMI-S HBA Instrumentation
License:        EPL-1.0
Url:            http://sblim.wiki.sourceforge.net/
Group:          System/Management/Instrumentation

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#!BuildIgnore: tog-pegasus
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  libHBAAPI2-devel
BuildRequires:  libidn-devel
BuildRequires:  libtool
BuildRequires:  sblim-cmpi-base-devel
BuildRequires:  sblim-cmpi-devel
BuildRequires:  sblim-sfcb
BuildRequires:  sblim-testsuite

Requires:       bind
Requires:       cim-server
Provides:       sblim-cmpi-smis-hba

Source0:        http://sourceforge.net/projects/sblim/files/providers/%{name}/%{version}/%{name}-%{version}.tar.bz2
Source1:        %{name}-tests.tar.bz2
# hbaapi.h is not below sys/, kkaempf@suse.de
Patch0:         fix-hbaapi-include-path.patch
# drop %%{version} from docdir installation, kkaempf@suse.de
Patch1:         fix-docdir.patch
# PATCH-FIX-OPENSUSE - fix gcc10 build
Patch2:         sblim-smis-hba-1.0.0.patch

%description
This package provides access to the SMI-S HBA configuration data via
CIMOM technology/infrastructure. It contains the SMI-S HBA CIM model,
CMPI provider with the Samba task specific Resource Access.

%package devel
Summary:        Development files for SBLIM WBEM-SMT SMI-S HBA
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%Description devel
The SBLIM WBEM-SMT SMI-S HBA development package contains header
files for dependent provider packages.

%package test
Summary:        Testcase files for SBLIM WBEM-SMT SMI-S HBA
Group:          System/Management/Instrumentation/Test
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%Description test
SBLIM WBEM-SMT SMI-S HBA provider testcase files for the SBLIM
testsuite.

%prep
%setup -n %{name}-%{version} -a1

export PATCH_GET=0

%patch -P0 -p0
%patch -P1 -p0
%patch -P2 -p1

%build
autoreconf -f -i

# SLE 10 does not recognize --docdir
#   and cannot parse || expressions :-/

%configure \
   CFLAGS="$RPM_OPT_FLAGS" \
   TESTSUITEDIR=%{_datadir}/sblim-testsuite \
   CIMSERVER=sfcb \
   PROVIDERDIR=%{_libdir}/cmpi \
%if 0%{?suse_version} > 1010
  --docdir=%{_docdir}/%{name}
%else
%if 0%{?suse_version} == 0
%if (0%{?rhel_version} >= 600) || (0%{?centos_version} >= 600)
  --docdir=%{_docdir}/%{name}-%{version}
%endif
%endif
%endif

make CFLAGS="-fno-strict-aliasing" RPM_OPT_FLAGS="$(RPM_OPT_FLAGS)" 

%install

mkdir -p $RPM_BUILD_ROOT/usr/%{_lib}/cmpi
mkdir -p $RPM_BUILD_ROOT/usr/include/cmpi
mkdir -p $RPM_BUILD_ROOT/usr/share/cmpi/mof

%if 0%{?suse_version}
make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_lib} docdir=%{_docdir}/%{name}
%else
make install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_lib} docdir=%{_docdir}/%{name}-%{version}
%endif

rm -f $RPM_BUILD_ROOT/%{_libdir}/*a
rm -f $RPM_BUILD_ROOT/%{_libdir}/cmpi/*a

%define SCHEMA %{_datadir}/%{name}/Linux_SMIS_ECTP.mof %{_datadir}/%{name}/Linux_SMIS_HBA_HDR.mof
%define REGISTRATION %{_datadir}/%{name}/Linux_SMIS_ECTP.reg %{_datadir}/%{name}/Linux_SMIS_HBA_HDR.reg

%define INTEROP_SCHEMAS %{_datadir}/%{name}/Linux_smis-hba_Profile.mof
%define INTEROP_REGISTRATIONS %{_datadir}/%{name}/Linux_smis-hba_Profile.registration

%pre
# definition of schema and registration files
# 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
#FIXME	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) 
%doc NEWS README AUTHORS COPYING
%{cmpi_provider_dir}/*.so.*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}

%files devel
%defattr(-,root,root) 
%{cmpi_provider_dir}/*.so

%files test
%defattr(-,root,root,0755)
%{_datadir}/sblim-testsuite/test-sblim-hba.sh
%defattr(-,root,root,0644)
%{_datadir}/sblim-testsuite/cim/Linux_*
%{_datadir}/sblim-testsuite/system/linux/Linux_*

%changelog
openSUSE Build Service is sponsored by