File sblim-sfcb.spec of Package sblim-sfcb

# spec file for package sblim-sfcb
# 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

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        Small Footprint CIM Broker
License:        EPL-1.0
Group:          System/Management

Name:           sblim-sfcb
Version:        1.3.14
Release:        0

Provides:       openwbem = 3.2.2
Obsoletes:      openwbem < 3.2.2

Source0:        %{name}-%{version}.tar.bz2
%if 0%{?suse_version}
Source2:        sblim-sfcb.init
Source4:        sfcb-pam.conf
Source5:        %{name}-rpmlintrc
Source6:        susefirewall.conf
Patch1:         pending-upstream.patch
Patch4:         0004-Don-t-call-tool_mm_flush-during-OPS_LoadProvider.patch
Patch6:         0006-Reflect-provider-information-in-ps-via-argv.patch
Patch7:         use-local-cmpi-header-file.patch

Provides:       cim-server
Provides:       cimserver
%if 0%{?suse_version} >= 1030
BuildRequires:  libcurl-devel
BuildRequires:  curl-devel
BuildRequires:  cim-schema
BuildRequires:  libtool
BuildRequires:  openssl-devel
BuildRequires:  pam-devel
BuildRequires:  sblim-sfcc-devel
BuildRequires:  zlib-devel
%if 0%{?rhel_version} == 0 && 0%{?centos_version} == 0
BuildRequires:  openslp-devel
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  unzip
# RHEL4 explicitly requires gcc
%if 0%{?rhel_version} >= 400 || 0%{?centos_version} >= 400
%if 0%{?rhel_version} < 500 || 0%{?centos_version} < 500
BuildRequires:  gcc-c++

Requires:       curl
%if 0%{?suse_version} < 1120
# unneeded explicit lib dependency
Requires:       zlib
Requires:       openssl
Requires:       pam
# Added NWP - dependency on cim-schema instead of inbuilt schema
Requires:       cim-schema
# /usr/bin/wbemcat needs LWP::UserAgent
Requires:       perl-libwww-perl
PreReq:         /usr/sbin/groupadd /usr/sbin/groupmod

Small Footprint CIM Broker (sfcb) is a CIM server conforming to the CIM
Operations over HTTP protocol. It is robust, with low resource
consumption and therefore specifically suited for embedded and resource
constrained environments. sfcb supports providers written against the
Common Manageability Programming Interface (CMPI).

%setup -q -n %{name}-%{version}
%patch1 -p1
%patch4 -p1
%patch6 -p1
%patch7 -p1

export PATCH_GET=0

#autoreconf -f -i
cp %SOURCE1 .
cp %SOURCE3 mofc/
chmod +x mofc/
# 1.3.6 tarball seems incomplete. (issue #2931327 upstream)
# might be able to remove the following workaround in a future version. 
mkdir -p test/finaltest
mkdir -p test/TestProviders/tests
mkdir -p test/commands
mkdir -p test/wbemcli
mkdir -p test/xmltest
mkdir -p test/unittest
mkdir -p test/slptest
mkdir -p test/localtests
touch test/finaltest/
touch test/TestProviders/tests/
touch test/commands/
touch test/wbemcli/
touch test/xmltest/
touch test/unittest/
touch test/slptest/
touch test/localtests/
sh ./
#if test -d mofc; then cd mofc && autoreconf -f -i; fi
#%%configure --enable-debug --enable-ssl --enable-pam --enable-ipv6 CIMSCHEMA_SOURCE=%{SOURCE1} CIMSCHEMA_MOF=cimv216.mof CIMSCHEMA_SUBDIRS=y
mkdir -p m4
%if 0%{?rhel_version} == 0 && 0%{?centos_version} == 0
%configure --enable-debug --enable-ssl --enable-pam --enable-ipv6 \
            --enable-uds $WITH_SLP

# RHEL < 6 ships with old libtool (see
%if 0%{?rhel_version} >= 400 || 0%{?centos_version} >= 400
%if 0%{?rhel_version} < 600 || 0%{?centos_version} < 600
rm -f libtool; ln -s /usr/bin/libtool .
(cd mofc; rm -f libtool; ln -s /usr/bin/libtool .)

make postinstall DESTDIR=$RPM_BUILD_ROOT
# comment out - NWP - removing schema pkg
#make DESTDIR=$RPM_BUILD_ROOT install-cimschema
# remove docs from wrong dir.  They are handled by %doc macro in files list
rm -rf $RPM_BUILD_ROOT/usr/share/doc
# remove unused libtool files
rm -f $RPM_BUILD_ROOT/%{_libdir}/*a
rm -f $RPM_BUILD_ROOT/%{_libdir}/sfcb/*a
# make the cmpi directory that sfcb will own - for SuSE Autobuild checks of rpm directory ownership
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/cmpi
%if 0%{?suse_version}
# override the default-installed sfcb init script - use the one from Source2
# due to /etc/SuSE-release not available in autobuild, so won't install
# correct init script
install %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/sfcb
ln -s /etc/init.d/sfcb $RPM_BUILD_ROOT/usr/sbin/rcsfcb
# Added NWP 5/14/08 - transition to using cim-schema rpm instead of internal-built schema
ln -sf /usr/share/mof/cim-current $RPM_BUILD_ROOT/%{_datadir}/sfcb/CIM
install -m 0644 %SOURCE4 $RPM_BUILD_ROOT/etc/pam.d/sfcb
%if 0%{?suse_version} > 1010
# firewall service definition
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services
install -m 0644 %SOURCE6 $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/sblim-sfcb
echo "%defattr(-,root,root)" > _pkg_list
# Added NWP 5/14/08 - moved from 'files schema'
echo "%dir %{_datadir}/sfcb/" >> _pkg_list
find $RPM_BUILD_ROOT/%{_datadir}/sfcb -type f | grep -v $RPM_BUILD_ROOT/%{_datadir}/sfcb/CIM >> _pkg_list
# Added next line - NWP - declaring link to CIM as part of pkg
echo "%{_datadir}/sfcb/CIM" >> _pkg_list
# end add NWP
sed s?$RPM_BUILD_ROOT??g _pkg_list > _pkg_list_2
mv -f _pkg_list_2 _pkg_list
echo "%dir %{_libdir}/cmpi/" >> _pkg_list
echo "%dir %{_sysconfdir}/sfcb/" >> _pkg_list
echo "%dir %{_libdir}/sfcb" >> _pkg_list
echo "%config %{_sysconfdir}/sfcb/*" >> _pkg_list
echo "%config %{_sysconfdir}/pam.d/*" >> _pkg_list
%if 0%{?suse_version} > 1010
echo "%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/sblim-sfcb" >> _pkg_list
echo "%doc README COPYING AUTHORS" >> _pkg_list
echo "%doc %{_datadir}/man/man1/*" >> _pkg_list
echo "%{_sysconfdir}/init.d/sfcb" >> _pkg_list
echo "%{_localstatedir}/lib/sfcb" >> _pkg_list
echo "%{_bindir}/*" >> _pkg_list
echo "%{_sbindir}/*" >> _pkg_list
echo "%{_libdir}/sfcb/*.so*" >> _pkg_list
echo =======================================
cat _pkg_list

%{__rm} -rf $RPM_BUILD_ROOT

/usr/sbin/groupadd -r sfcb >/dev/null 2>&1 || :
/usr/sbin/groupmod -A root sfcb >/dev/null 2>&1 || :
# cleanup up schema directory (bnc#590196)
if [ -d %{_datadir}/sfcb/CIM -a \( \! -L /usr/share/sfcb/CIM \) ]
  rm -rf %{_datadir}/sfcb/CIM

test -n "$FIRST_ARG" || FIRST_ARG=$1
#removed NWP, placed into init script for first service startup
#%{_datadir}/sfcb/ %{_sysconfdir}/sfcb
%if 0%{?suse_version}
%{fillup_and_insserv -f sfcb}
if test "$FIRST_ARG" -eq 1 ; then
   sfcbrepos -f 2> /dev/null || :
# else we do it in postun instead.
exit 0

%stop_on_removal sfcb

test -n "$FIRST_ARG" || FIRST_ARG=$1
if test "$FIRST_ARG" -ge 1 ; then
   sfcbrepos -f 2> /dev/null || :
%restart_on_update sfcb

%files -f _pkg_list