File tog-pegasus.spec of Package tog-pegasus

#
# spec file for package tog-pegasus (Version 2.8.0)
#
# Copyright (c) 2008 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 openslp-devel openssl openssl-devel pam-devel pwdutils python-httplib2
Version:        2.8.0
Release:        3
#
Summary:        OpenPegasus WBEM Services for Linux
Group:          System/Management
Url:            http://www.openpegasus.org
#
License:        Other uncritical OpenSource License; X11/MIT
#
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-config.patch
Patch3:         pegasus-no-strip.patch
Patch5:         pegasus-local-or-remote-auth.patch
Patch11:        pegasus-2.7.0-strncat.patch
Patch12:        pegasus-2.8.0-notests.patch
#
Provides:       tog-pegasus-cimserver
Provides:       cim-server
#
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)
PreReq:         python-devel 
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:        X11/MIT
Summary:        OpenPegasus WBEM Services for Linux
Group:          System/Management
Obsoletes:      tog-pegasus-sdk
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:        X11/MIT
Summary:        Non-frozen development headers for OpenPegasus
Group:          System/Management
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 -b .pegasus-config.patch
%patch3
%patch5
%patch11
%patch12 -b .pegasus-2.8.0-notests.patch

%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"
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
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
%fdupes -s $RPM_BUILD_ROOT/usr/bin
### 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 || :
/usr/sbin/groupadd -r cimsrvr >/dev/null 2>&1 || :
/usr/sbin/useradd  -r -g cimsrvr -s /sbin/nologin \
	-d /var/lib/Pegasus -c "tog-pegasus OpenPegasus WBEM/CIM services" \
	cimsrvr >/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 cimsrvr.cimsrvr %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,cimsrvr,cimsrvr) /var/lib/Pegasus/repository
%attr(-,cimsrvr,cimsrvr) /var/lib/Pegasus/repository/*
%attr(755,cimsrvr,cimsrvr) /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
* Thu Nov 20 2008 mhrusecky@suse.cz
- adding %%fdupes into the spec file to fix build on ia64
  (same build ID in nonidentical files broke extracting debug info)
* Fri Nov 07 2008 ro@suse.de
- move pkgconfig creation out of specfile (confuses parser ...)
- add python-httplib2 and openssl to buildrequires to fix build
* Fri Sep 19 2008 bwhiteley@suse.de
- Put %%_libdir/*.so files back in the main package, as many of
  them need to be there.
- Removed Python provider manager from this package.  It is in a
  separate package now due to pluggable provider manager support
  in Pegasus 2.8.  Also, CMPI-based Python providers are now
  preferred (cmpi-bindings project within http://omc-project.org/)
- Disable building of most test code.
- Remove test-internal subpackage.
* Fri Sep 19 2008 mmarek@suse.cz
- updated to 2.8.0
  new features in this version:
  * Memory Resident Repository (PEP 307)
  * WS-Management Support in CIM Server 	 (PEP 311)
  * Pluggable Provider Managers - Enhancement (PEP 313)
  * Tracing in OpenPegasus - Enhancement (PEP 315)
  * Profile Registration Profile Support (PEP 319)
  * Track Generated Indications Data (PEP 322)
  * DMTf Indication Profile Implementation, Stage 1 (DMTF DSP 1054)
  (PEP 323)
  * Track Generated Indications Data (PEP 322)
* Mon Aug 18 2008 mmarek@suse.de
- use LSB keywords instead of X-UnitedLinux-* in the init script
* Tue Jul 15 2008 mmarek@suse.cz
- only put folowing .so files into the main package (bnc#341368):
  %%_libdir/Pegasus/*/*.so
  %%_libdir/lib*Handler.so
  everything else goes to the -devel subpackage
* Fri Jul 04 2008 mmarek@suse.cz
- split /usr/include/Pegasus-internal into devel-internal
  subpackage
* Mon May 12 2008 mmarek@suse.cz
- drop provider-register.sh usage in peg-loadmof.sh, it can't find
  MOFs in /usr/share/mof/* (bnc#389134)
* Mon May 12 2008 mmarek@suse.cz
- don't install internal headers executable
* Thu Apr 17 2008 npaxton@novell.com
- install non-frozen headers to /usr/include/Pegasus-internal
* Thu Apr 03 2008 bwhiteley@suse.de
- Renamed README.SuSE.Security to README.SUSE.Security.
- Patch to allow connection to UDS with credentials (pegasus_bug:7563).
* Tue Mar 25 2008 npaxton@novell.com
- Add pluggable provider manager patch
* Thu Mar 20 2008 mmarek@suse.cz
- cim-schema is also used in %%post
* Thu Mar 20 2008 mmarek@suse.cz
- Changed the python-pywbem dependency to PreReq, as it is used
  in %%post.
- Synced *.changes and %%changelog in the specfile
* Thu Feb 28 2008 jcarey@novell.com
- Changed to use copy of given OperationContext when making up
  calls to the CIMOM. Fixes problem where the requesting user
  name was not being used when making these calls. The user
  identity was not available to providers.
* Fri Feb 22 2008 bwhiteley@suse.de
- Don't build root/cimv2 namespace during build.  Create it during
  install instead with new python MOF compiler.  Don't register any
  PG providers by default.
* Wed Feb 20 2008 jcarey@novell.com
- Changed to not allow exception to be thrown from the
  processMessage method of the provider manager.
* Fri Feb 15 2008 bwhiteley@suse.de
- Make cimsrvr user a member of the pegasus group.  Otherwise,
  in-process providers do not work.
* Sat Feb 09 2008 bwhiteley@suse.de
- Allow root user to log in from remote (bnc#344466)
* Tue Feb 05 2008 jcarey@novell.com
- Changed so the default action is performed when a SIGCHLD signal
  is received (pegasus-sigchld.patch).
* Fri Feb 01 2008 bwhiteley@suse.de
- Changed peg-loadmof.sh to use new pywbem MOF compiler instead of
  Pegasus MOF compiler.
- Fixed the python provider manager to cleanly unload providers.
* Mon Jan 21 2008 mmarek@suse.cz
- copy repository to prev_repository instead of rename, to make
  patchrpms happy
* Fri Jan 11 2008 mmarek@suse.cz 
- run repupgrade on package update [#349347]
* Thu Jan 10 2008 bwhiteley@suse.de
- Added a new file with build options, instead of patching the one
  that comes with the project.
- Changed PEGASUS_CLASS_CACHE_SIZE=30
- Changed PEGASUS_DEFAULT_USERCTXT_REQUESTOR=true
- Disabled PEGASUS_USE_RELEASE_CONFIG_OPTIONS.  When this is enabled, it's
  impossible to change the listen port numbers.
- Created a new cimserver_planned.conf with all runtime options present
  and documented.
* Tue Jan 08 2008 mmarek@suse.cz
- reduced BuildRequires (enables SLES9 build in the buildservice)
* Mon Jan 07 2008 mmarek@suse.cz
- synced with the systemsmanagement:wbem buildservice project
  * set authorizedUserGroups=pegasus in config
  * updated the python provider interface
  * added pegutil script to start a minimal cimserver on demand
  to simplify loadmof.sh
  * updated pegasus-config.patch
  * send content-length header in 401 case in XmlWriter.cpp
  (pegasus-http401-content-length.patch)
  * move the .so symlinks back to the main package for now
  [#341368]
* Mon Dec 03 2007 mmarek@suse.cz
- fixed incorrect strncat() call in OperatingSystem_Linux.cpp
* Tue Nov 27 2007 bwhiteley@suse.de
- Added python provider interface.
* Thu Nov 15 2007 mmarek@suse.cz
- add .so symlinks for all installed libraries [#341368] and move
  them to -devel
* Fri Nov 02 2007 mmarek@suse.cz
- reduced BuildRequires
* Wed Oct 31 2007 mmarek@suse.cz
- added a workaround for a gcc bug [#337901, gcc.gnu.org/PR31081]
  to fix BETA build
* Tue Oct 30 2007 mmarek@suse.cz
- updated to 2.7.0
  new features in this version:
  * Add Platform support IBM i5/PASE - Portable Application
  Solutions Environment (PASE) (PEP 284)
  * Reduce the Amount of CIM Server code that runs Privileged
  (Privilege Separation) (PEP 286)
  * Add Support for IPv6 - Stage 1 (Note: This functionality was
  made available but normally disabled Pegasus 2.6.1) (PEP 291)
  * Add IPV6 Support for SNMP Indication Handler and include
  NET-SNMP indication handler in Linux RPM (PEP 62)
  * Enhanced Log File Support (PEP 302)
  * Add support for certificate-based authentication audit logging
  (PEP 258)
  * Add two new trace components to facilitate triage of indication
  delivery issues (bug 6466)
  new features from 2.6.0:
  * Embedded Instance Support in Pegasus (PEP 233)
  * Providing SMI-Server Profile through OpenPegasus (PEP 244)
  * Incorporation of CIM_Error into OpenPegasus Infrastructure
  (PEP 245)
  * Language Interfaces (PEP 246)
  * Reducing Pegasus Code size and static memory usage (PEP 255)
  * Indication Subscription Management (PEP 257)
  * Audit Logging (PEP 258)
  * SSL Certificate Management Command Interfaces (PEP 259)
  * CMPI 2.0 Currency (PEP 260)
  * SLP enhancements for Pegasus 2.6 (PEP 267)
  * Repository Archive (PEP 271)
- rewrote the specfile from scratch
- updated the local-or-remote patch to support IPv6 and privilege
  separation
* Sat Aug 11 2007 dmueller@suse.de
- rename test package to test-internal and remove
  it from production state (fixes build)
* Thu Jan 18 2007 mrueckert@suse.de
- prefixed loadmof.sh and rmmof.sh with "peg-"
  and require cim-schema. (#228349|FATE #301801)
* Thu Jan 18 2007 mrueckert@suse.de
- add symlink for libcmpiCppImpl.so.1 to
  libcmpiCppImpl.so and install the CMPI headers (#233452)
* Thu Nov 16 2006 mrueckert@suse.de
- make sure all manpages are world readable (#209441)
* Tue Jul 11 2006 mrueckert@suse.de
- build tests rpm
- move *.so symlinks into the base package. needed for plugin
  loading.
- create ssl certs in the init script if needed
- properly handle return codes in provider-register.sh
- set "repositoryIsDefaultInstanceProvider=true" so sblim-gather
  can register properly
* Mon Jul 10 2006 mrueckert@suse.de
- obsolete/provide pegasuse-wbem
* Mon Jul 10 2006 mrueckert@suse.de
- comment out the Requires(post|pre|postun) for now
* Fri Jul 07 2006 mrueckert@suse.de
- dont package the debug files in the base package
* Fri Jul 07 2006 mrueckert@suse.de
- Initial package based on the fedora core 6 package
openSUSE Build Service is sponsored by