File tog-pegasus.spec of Package tog-pegasus

#
# spec file for package tog-pegasus (Version 2.9.0)
#
# Copyright (c) 2009 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/
#

# norootforbuild


Name:           tog-pegasus
BuildRequires:  cim-schema e2fsprogs-devel fdupes gcc-c++ libicu-devel net-snmp-devel
BuildRequires:  openslp-devel openssl openssl-devel pam-devel pwdutils python-httplib2
Version:        2.9.0
Release:        3
#
Summary:        OpenPegasus WBEM Services for Linux
Group:          System/Management
Url:            http://www.openpegasus.org
#
License:        Other uncritical OpenSource License  ; MIT License (or similar)
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#
Source:         pegasus-%{version}.tar.bz2
Source1:        tog-pegasus-rpmlintrc
Source2:        README.SUSE.Security
Source3:        genOpenPegasusSSLCerts
Source4:        pegasus_arch_alternatives
Source5:        provider-register.sh
Source6:        loadmof.sh
Source7:        rmmof.sh
Source8:        pegasus.init
Source10:       pegutil.sh
Source11:       pegasus_build_env_vars.sh
Source12:       cimserver_planned.conf
Source13:       README.SUSE
Source14:       Makefile.pkg-config
Source15:       tog-pegasus.pc
#
Patch1:         pegasus-pam-wbem.patch
Patch2:         pegasus-2.9.0-config.patch
Patch3:         pegasus-no-strip.patch
Patch5:         pegasus-2.9.0-local-or-remote-auth.patch
Patch11:        pegasus-2.7.0-strncat.patch
Patch12:        pegasus-2.8.0-notests.patch
# PATCH-FIX-UPSTREAM pegasus-2.9.0-gcc44.patch [ upstream#8496 ] mhrusecky@suse.cz -- Fixed problematic elif  - fixes compilation with gcc44
# http://bugzilla.openpegasus.org/show_bug.cgi?id=8496
Patch13:        pegasus-2.9.0-gcc44.patch
# PATCH-FEATURE-SUSE pegasus-2.9.0-defineable-user.patch [] mhrusecky@suse.cz -- possibility to use other user then cimsrv
Patch14:        pegasus-2.9.0-defineable-user.patch
Patch15:        pegasus-2.9.0-timestamp-size.patch
#
Provides:       tog-pegasus-cimserver
Provides:       cim-server
#
Conflicts:      libcmpiCppImpl0
Conflicts:      sblim-cmpi-devel
#
PreReq:         pwdutils %insserv_prereq %fillup_prereq
PreReq:         python-pywbem >= 0.6.20080201.1
PreReq:         cim-schema >= 2.17
# due to bug in python package (bnc#427987)
# Should be fixed in 11.2
%if 0%{?suse_version} < 1120 && 0%{?suse_version} > 0
PreReq:         python-devel 
%endif
Requires:       bash, sed, grep, coreutils, procps, openssl >= 0.9.6, pam
Requires:       bind-utils, net-tools
Obsoletes:      pegasus-wbem
Provides:       pegasus-wbem

%description
OpenPegasus WBEM Services for Linux enables management solutions that
deliver increased control of enterprise resources. WBEM is a platform
and resource independent DMTF standard that defines a common
information model and communication protocol for monitoring and
controlling resources from diverse sources.



Authors:
--------
    The Open Group

%package devel
License:        MIT License (or similar)
Summary:        OpenPegasus WBEM Services for Linux
Group:          System/Management
Obsoletes:      tog-pegasus-sdk
Provides:       tog-pegasus-sdk
Conflicts:      sblim-cmpi-devel
Requires:       tog-pegasus >= %{version}
Requires:       gcc-c++
Requires:       pkg-config
Requires(preun): make

%description devel
OpenPegasus WBEM Services for Linux enables management solutions that
deliver increased control of enterprise resources. WBEM is a platform
and resource independent DMTF standard that defines a common
information model and communication protocol for monitoring and
controlling resources from diverse sources.



Authors:
--------
    The Open Group

%package devel-internal
License:        MIT License (or similar)
Summary:        Non-frozen development headers for OpenPegasus
Group:          System/Management
Conflicts:      sblim-cmpi-devel
Requires:       tog-pegasus >= %{version}
Requires:       gcc-c++
Requires:       pkg-config
Requires(preun): make

%description devel-internal
Non-frozen headers for OpenPegasus.  Some aspects of Pegasus are
pluggable, such as provider managers, but the interfaces aren't frozen
yet so they can't be built with the public SDK.  This package contains
all headers for building such things.



Authors:
--------
    The Open Group

%prep
%setup -q -n pegasus
%patch1
%patch2
%patch3
%patch5
%patch11
%patch12 -b .pegasus-2.8.0-notests.patch
%patch13
%patch14
%patch15

%build
cp -fp %_sourcedir/README.SUSE.Security doc
cp -fp %_sourcedir/README.SUSE doc
cp -fp %_sourcedir/genOpenPegasusSSLCerts rpm
cp -fp %_sourcedir/Makefile.pkg-config .
case %_arch in
i?86)
	PEGASUS_PLATFORM=LINUX_IX86_GNU;;
x86_64)
	PEGASUS_PLATFORM=LINUX_X86_64_GNU;;
ia64)
	PEGASUS_PLATFORM=LINUX_IA64_GNU;;
ppc)
	PEGASUS_PLATFORM=LINUX_PPC_GNU;;
ppc64)
	PEGASUS_PLATFORM=LINUX_PPC64_GNU;;
s390)
	PEGASUS_PLATFORM=LINUX_ZSERIES_GNU;;
s390x)
	PEGASUS_PLATFORM=LINUX_ZSERIES64_GNU;;
*)
	echo "Unknown platform: %_arch"
	exit 1;;
esac
cat >rpm-env <<EOF
export PEGASUS_PLATFORM=$PEGASUS_PLATFORM
export PEGASUS_ROOT=`pwd`
export PEGASUS_HOME=\$PEGASUS_ROOT/_build
export PEGASUS_EXTRA_C_FLAGS="%optflags -Wno-unused -fno-strict-aliasing"
export PEGASUS_EXTRA_CXX_FLAGS=\$PEGASUS_EXTRA_C_FLAGS
export PEGASUS_STAGING_DIR=%buildroot
export PEGASUS_ARCH_LIB=%_lib
export PEGASUS_ENVVAR_FILE=%{S:11}
export PATH="$PATH:\$PEGASUS_HOME/bin"
export LD_LIBRARY_PATH=\$PEGASUS_HOME/lib
export PEGASUS_BUILD_TEST_RPM=1
export PEGASUS_ENABLE_MAKE_INSTALL=yes
export PEGASUS_SKIP_MOST_TEST_DIRS=true
export PEGASUS_CIMSERVERMAIN_USER=pegasus
EOF
. rpm-env
# vvv remove this when #337901 / gcc.gnu.org/PR31081 gets fixed
# mv src/Pegasus/Client/tests/DeleteNamespace/DeleteNamespace.cpp{,.disabled}
# echo -e '#include <stdio.h>\nint main() { puts("test disabled"); return 0; }' \
# > src/Pegasus/Client/tests/DeleteNamespace/DeleteNamespace.cpp
# ^^^
make -f Makefile.Release create_ProductVersionFile
make -f Makefile.Release create_CommonProductDirectoriesInclude
make -f Makefile.Release create_ConfigProductDirectoriesInclude
make -f Makefile.Release %{?jobs:-j%jobs} all
make -f Makefile.Release repository

%install
. rpm-env
make -f Makefile.Release stage
rm -r %buildroot/usr/share/doc/tog-pegasus-*
# ghost configs
touch %buildroot/etc/Pegasus/{cimserver_current.conf,cimserver_trust,indication_trust,crl}
#
# suse compat stuff
#
install -D -m755 %_sourcedir/pegasus.init %{buildroot}/etc/init.d/tog-pegasus
ln -sf /etc/init.d/tog-pegasus %{buildroot}%{_sbindir}/rctog-pegasus
ln -sf /etc/init.d/tog-pegasus %{buildroot}%{_sbindir}/rcpegasus-wbem
install -D -m755 %_sourcedir/loadmof.sh %{buildroot}%{_bindir}/peg-loadmof.sh
install -D -m755 %_sourcedir/pegutil.sh %{buildroot}%{_sbindir}/pegutil
install -D -m755 %_sourcedir/rmmof.sh %{buildroot}%{_bindir}/peg-rmmof.sh
install -D -m755 %_sourcedir/provider-register.sh %{buildroot}%{_datadir}/Pegasus/scripts/provider-register.sh;
install %{S:12} %{buildroot}/etc/Pegasus/cimserver_planned.conf
# fix permissions
chmod -v 0755 %{buildroot}/usr/share/Pegasus/scripts/*
find %{buildroot}/usr/include/Pegasus -type f -print0 | xargs -r0 chmod -v a-x
# add missing .so symlinks
pushd %buildroot%_libdir
	for f in *.so.*; do
		s=`echo "$f" | sed 's/\.so\..*/.so/'`
		if ! test -e "$s"; then
			ln -s "$f" "$s"
		fi
	done
popd
rm %{buildroot}/var/lib/Pegasus/cimserver_planned.conf
# XXX: do we still need this? The upstream RPMS don't package all of CMPI/*.h
# either
#%{__install} -m 0644 src/Pegasus/Provider/CMPI/*.h %{buildroot}%{_includedir}/Pegasus/Provider/CMPI/
# install some extra MOF files that we'll need in %post
rm -r %{buildroot}/var/lib/Pegasus/repository/root#cimv2
rm %{buildroot}/var/lib/Pegasus/repository/root#PG_InterOp/instances/*
install Schemas/Pegasus/InterOp/VER20/{PG_Namespace20,PG_ServerProfile20}.mof \
		%{buildroot}/usr/share/Pegasus/mof/Pegasus/
# install all headers for -devel-internal package
install -d %{buildroot}/usr/include/Pegasus-internal
pushd src
for h in $(find Pegasus -name "*.h"); do
  install -d %{buildroot}/usr/include/Pegasus-internal/$(dirname $h)
  install -m644 $h %{buildroot}/usr/include/Pegasus-internal/$h
done
popd
# Create pkg-config file
install -d %{buildroot}/usr/%_lib/pkgconfig
sed -e "s,@VERSION@,%{version}," %{S:15} > %{buildroot}/usr/%_lib/pkgconfig/%{name}.pc
# Final cleanups
%fdupes -s $RPM_BUILD_ROOT/usr/bin
%fdupes -s $RPM_BUILD_ROOT/usr/share/Pegasus/samples
rm -f $RPM_BUILD_ROOT/usr/share/Pegasus/samples/{lib,obj,lib}/target
chmod a-x $RPM_BUILD_ROOT/usr/share/Pegasus/mof/Pegasus/* \
          $RPM_BUILD_ROOT/etc/Pegasus/cimserver_planned.conf
### end of %install

%clean
rm -rf %buildroot
%define prev_repo /var/lib/Pegasus/prev_repository
%define curr_repo /var/lib/Pegasus/repository
%define restart_flag /var/run/tog-pegasus/needs-restart

%pre
/usr/sbin/groupadd -r pegasus >/dev/null 2>&1 || :
/usr/sbin/useradd  -r -g pegasus -s /sbin/nologin -d /var/lib/Pegasus \
	-c "tog-pegasus OpenPegasus WBEM/CIM services" pegasus >/dev/null 2>&1 || :
# upgrade the repository on package update
if test -e %curr_repo; then
  if test -x /etc/init.d/tog-pegasus && /etc/init.d/tog-pegasus status>/dev/null
  then
    /etc/init.d/tog-pegasus stop || :
    touch %restart_flag
  fi
  if test -e %prev_repo; then
    # Should not happen, but...
    # Assume that the previous install failed in %%post at repupgrade and
    # the cimserver wasn't started in between (and if we're lucky, this
    # is the fixed package and everything's gonna be all right).
    # But backup the current repository just in case.
    echo "Warning: %prev_repo exists" >&2
    backup=`mktemp -d %curr_repo.backup.XXXXXXXXXX`
    echo "Warning: saving %curr_repo as $backup/repository" >&2
    mv %curr_repo $backup/
    exit 0
  else
    #mv %curr_repo %prev_repo
    # make patchrpms happy
    cp -a %curr_repo %prev_repo
  fi
fi

%post
/sbin/ldconfig;
%fillup_and_insserv -f tog-pegasus
MOFs=""
for i in \
	CIM_IndicationSubscription \
	CIM_FormattedIndicationSubscription \
	CIM_IndicationHandler \
	CIM_ListenerDestinationCIMXML \
	CIM_IndicationHandlerCIMXML \
	CIM_IndicationFilter \
	CIM_Namespace \
	CIM_CIMOMStatisticalData \
	CIM_QueryCapabilities; do 
	MOFs="$MOFs /usr/share/mof/cim-current/*/$i.mof"
done
for i in \
	PG_Namespace20 \
	PG_Events20; do
	MOFs="$MOFs /usr/share/Pegasus/mof/Pegasus/$i.mof"
done
#	PG_ServerProfile20 
peg-loadmof.sh -n root/cimv2 $MOFs
# upgrade the repository on package update, part 2
if test -d %prev_repo; then
  echo "running repupgrade to upgrade repository" >&2
  /usr/sbin/repupgrade
  chown -R pegasus.pegasus %curr_repo
  rm -rf %prev_repo
fi
if test -e %restart_flag; then
  /etc/init.d/tog-pegasus start || :
  rm %restart_flag
fi

%preun
%stop_on_removal tog-pegasus

%postun
/sbin/ldconfig
%insserv_cleanup

%preun devel
if [ $1 -eq 0 ] ; then
   make --directory /usr/share/Pegasus/samples -s clean >/dev/null 2>&1 || :;
fi

%files
%defattr(-,root,root)
/usr/%{_lib}/Pegasus/
/usr/%{_lib}/*.so.*
/usr/%{_lib}/*.so
/usr/sbin/*
/usr/bin/*
/usr/share/Pegasus/scripts
%config /etc/init.d/tog-pegasus
%config(noreplace) /etc/pam.d/wbem
%dir /etc/Pegasus
%ghost %config(noreplace)  /etc/Pegasus/cimserver_current.conf
%config(noreplace)        /etc/Pegasus/cimserver_planned.conf
%config(noreplace)        %attr(0600,root,root) /etc/Pegasus/access.conf
%ghost %config(noreplace) %attr(0600,root,root) /etc/Pegasus/ssl.cnf
%ghost %config(noreplace) %attr(0600,root,root) /etc/Pegasus/client.pem
%ghost %config(noreplace) %attr(0600,root,root) /etc/Pegasus/server.pem
%ghost %config(noreplace) %attr(0600,root,root) /etc/Pegasus/file.pem
%ghost %config(noreplace) %attr(0640,root,pegasus) /etc/Pegasus/cimserver_trust
%ghost %config(noreplace) %attr(0640,root,pegasus) /etc/Pegasus/indication_trust
%ghost %config(noreplace) %attr(0640,root,pegasus) /etc/Pegasus/crl
%dir /var/lib/Pegasus
/var/lib/Pegasus/cache
%dir /var/lib/Pegasus/log
%attr(0600,root,root) /var/lib/Pegasus/log/install.log
%dir %attr(0700,pegasus,pegasus) /var/lib/Pegasus/repository
%attr(-,pegasus,pegasus) /var/lib/Pegasus/repository/*
%attr(755,pegasus,pegasus) /var/run/tog-pegasus
%dir /usr/share/Pegasus
/usr/share/Pegasus/mof
%doc /usr/share/man/man[18]/*
%doc doc/license.txt doc/Admin_Guide_Release.pdf doc/PegasusSSLGuidelines.htm doc/SecurityGuidelinesForDevelopers.html doc/README.SUSE.Security doc/README.SUSE src/Clients/repupgrade/doc/repupgrade.html 

%files devel
%defattr(-,root,root)
/usr/include/Pegasus
/usr/share/Pegasus/samples
/usr/share/Pegasus/html
/usr/%_lib/pkgconfig/*

%files devel-internal
%defattr(-,root,root)
/usr/include/Pegasus-internal
/usr/%_lib/pkgconfig/*
# NOTE: please use the tog-pegasus.changes file, this changelog will be
# automatically updated from it in the binary RPMS

%changelog
openSUSE Build Service is sponsored by