File pcp.spec of Package pcp
#
# spec file for package pcp (Version 2.5.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: pcp
BuildRequires: bison flex gcc-c++ ncurses-devel procps
Version: 2.5.0
Release: 126
Summary: Performance Co-Pilot (system-level performance monitoring)
License: GPL v2 or later
Url: http://oss.sgi.com/projects/pcp
Group: System/Monitoring
Source: pcp-%{version}.src.tar.gz
Patch0: pcp-%{version}-SuSE.diff
Patch1: pcp-%{version}-ndbm.diff
Patch2: pcp-%{version}-rpmlint.diff
Patch3: pcp-gcc43.patch
Patch4: pcp-init.patch
Patch5: pcp-2.5.0-buffer-overflow.diff
Patch6: pcp-xenbuild.patch
PreReq: %insserv_prereq %fillup_prereq permissions
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Performance Co-Pilot (PCP) is a framework and services to support
system-level performance monitoring and performance management.
Authors:
--------
SGI OSS <owner-pcp@oss.sgi.com>
%package devel
Summary: Include Files and Libraries mandatory for Development
Group: Development/Libraries/C and C++
License: GPL v2 or later
Requires: %{name} = %{version}
%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
Authors:
--------
SGI OSS <owner-pcp@oss.sgi.com>
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3
%patch4
%patch5
%patch6
%build
%{suse_update_config -f}
autoconf
YACC="yacc" ./configure \
--bindir=%{_bindir} \
--mandir=%{_mandir} \
--libdir=%{_libdir} \
--datadir=%{_datadir}/pcp \
--sysconfdir=/etc/pcp \
--sbindir=/usr/lib/pcp \
--localstatedir=/var/lib/pcp
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
/usr/bin/gmake default_pcp
%install
DIST_ROOT=$RPM_BUILD_ROOT
DIST_MANIFEST=`pwd`/install.manifest
export DIST_ROOT DIST_MANIFEST
rm -f $DIST_MANIFEST
/usr/bin/gmake install_pcp
# local setting
install -d $RPM_BUILD_ROOT/usr/sbin
./install-sh -S ../../etc/init.d/pcp /usr/sbin/rcpcp
./install-sh -S ../../etc/init.d/pmie /usr/sbin/rcpmie
./install-sh -S ../../etc/init.d/pmproxy /usr/sbin/rcpmproxy
set +x
PCP_CONF=src/include/pcp.conf
export PCP_CONF
. src/include/pcp.env
sort $DIST_MANIFEST | uniq | $PCP_AWK_PROG '
$1 == "d" { printf ("%%%%dir %%%%attr(%%s,root,root) %%s\n", $2, $5); }
$1 == "f" { if ( match ($6, "'$PCP_VAR_DIR'/config") ||
match ($6, "'$PCP_SYSCONFIG_DIR'") ) {
printf ("%%%%config ");
}
if (match ($6, "'$PCP_MAN_DIR'") || match ($6, "'$PCP_DOC_DIR'")) {
printf ("%%%%doc ");
}
g = $4;
if (g == "trusted") {
printf ("%%%%verify(not mode group) ");
} else if (g == "bin") {
g = "root";
}
printf ("%%%%attr(%%s,root,%%s) %s\n", $2, g, $6); }
$1 == "l" { printf "%%%%attr(-,root,root) %%s\n", $3; }
' | tee files-all.rpm |
perl -e '
open(N, "> files.rpm") || die;
open(D, "> files-devel.rpm") || die;
while ( <> ) {
if ( m{(include|man3|/var/lib/pcp/(pmdas|demos))} || m{\.(c|h|so)$} ) {
print D;
} else {
print N;
}
}'
set -x
%clean
[ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ] || rm -rf $RPM_BUILD_ROOT
%verifyscript
%verify_permissions -e /usr/lib/pcp/pmpost
%files -f files.rpm
%files -f files-devel.rpm devel
%preun
if [ "$1" -eq 0 ]
then
#
# Stop daemons before erasing the package
#
if [ -f /etc/pcp.env ] ; then
. /etc/pcp.env
$PCP_RC_DIR/pcp stop >/dev/null 2>&1
$PCP_RC_DIR/pmie stop >/dev/null 2>&1
[ -x $PCP_RC_DIR/pmproxy ] && $PCP_RC_DIR/pmproxy stop >/dev/null 2>&1
rm -f $PCP_VAR_DIR/pmns/.NeedRebuild
fi
fi
exit 0
%postun
%insserv_cleanup
exit 0
%post
%run_permissions
if [ -f /etc/pcp.env ] ; then
. /etc/pcp.env
. $PCP_SHARE_DIR/lib/rc-proc.sh
touch $PCP_VAR_DIR/pmns/.NeedRebuild
chmod 644 $PCP_VAR_DIR/pmns/.NeedRebuild
if [ ! -f $PCP_VAR_DIR/pmns/root ]
then
if [ -f $PCP_VAR_DIR/pmns/root.saved ]
then
# restore the previous pmns after upgrade
mv $PCP_VAR_DIR/pmns/root.saved $PCP_VAR_DIR/pmns/root
else
# empty initial name space (prior to Rebuild)
echo "root {" >$PCP_VAR_DIR/pmns/root
echo "}" >>$PCP_VAR_DIR/pmns/root
fi
chmod 644 $PCP_VAR_DIR/pmns/root
else
# root pmns already exists, so we need to restore
# pmcd.conf and pmcd.options if they were saved.
for f in $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH
do
if [ -f $f -a -f $f.rpmsave ]
then
mv $f $f.rpmnew
mv $f.rpmsave $f
fi
done
fi
#
# delete *.rpmorig turds that are the same as their new version
find $PCP_VAR_DIR/config -name \*.rpmorig -print \
| while read f
do
if diff $f `basename $f .rpmorig` >/dev/null 2>&1
then
rm -f $f
fi
done
x=$PCP_SHARE_DIR/lib/.migrate_pcp_var_dir
[ -x $x ] && $x
fi
%{fillup_and_insserv pcp}
exit 0
%triggerpostun -- pcp < 2.1.9
#
# Fix for bug where pcp-2.1.6 %postun script would chkconfig pcp off
# and remove the .NeedRebuild and .NeedUpdate files. This was done
# *after* the %post script of the new version, causing upgrade havoc.
#
if [ "$1" -gt 0 ]
then
. /etc/pcp.env
. $PCP_SHARE_DIR/lib/rc-proc.sh
touch $PCP_VAR_DIR/pmns/.NeedRebuild
chmod 644 $PCP_VAR_DIR/pmns/.NeedRebuild
fi
exit 0
%triggerun -- pcp < 2.2.0-18
#
# first half of fix for bug #825229 where upgrade
# clobbers $PCP_VAR_DIR/pmns/root
#
if [ "$1" -gt 0 ]
then
. /etc/pcp.env
if [ -f $PCP_VAR_DIR/pmns/root ]
then
cp $PCP_VAR_DIR/pmns/root $PCP_VAR_DIR/pmns/root.saved
fi
fi
exit 0
%triggerpostun -- pcp < 2.2.0-18
#
# second half of the fix for bug #825229
#
if [ "$1" -gt 0 ]
then
. /etc/pcp.env
if [ ! -f $PCP_VAR_DIR/pmns/root ]
then
if [ -f $PCP_VAR_DIR/pmns/root.saved ]
then
mv $PCP_VAR_DIR/pmns/root.saved $PCP_VAR_DIR/pmns/root
else
# empty initial name space (prior to Rebuild)
echo "root {" >$PCP_VAR_DIR/pmns/root
echo "}" >>$PCP_VAR_DIR/pmns/root
fi
chmod 644 $PCP_VAR_DIR/pmns/root
fi
fi
exit 0
%changelog
* Thu Nov 06 2008 ro@suse.de
- fix build failure in obs
* Tue Oct 07 2008 kukuk@suse.de
- Fix possible buffer overflow
* Thu Aug 28 2008 cthiel@suse.de
- fix init scripts
* Wed Dec 05 2007 ro@suse.de
- fix build with gcc-4.3
(package could possibly be updated anyway)
* Thu Jul 12 2007 rw@suse.de
- Split off development package.
* Fri Mar 30 2007 ro@suse.de
- Add procps,ncurses-devel,bison to buildreq.
* Fri Jun 16 2006 schwab@suse.de
- Set datadir.
- Use RPM_OPT_FLAGS.
* Fri Jun 02 2006 rw@suse.de
- Remove fake dependency on gdbm-devel headers. (#177730)
* Wed Jan 25 2006 mls@suse.de
- Convert neededforbuild to BuildRequires
* Mon Jan 16 2006 rw@suse.de
- Update to version 2.5.0. (FATE 153129)
* Thu Oct 20 2005 rw@suse.de
- Fix permission of a demo directory. (#129486)
* Sat Apr 09 2005 coolo@suse.de
- Fix gcc4 compilation
* Fri Nov 12 2004 ro@suse.de
- Correct permissions handling for pmpost
* Mon Oct 18 2004 nashif@suse.de
- Update to version 2.4.0
* Wed Apr 28 2004 nashif@suse.de
- #39324: fixes for SuSE and 2.6 kernels in general from SGI
* Tue Mar 16 2004 nashif@suse.de
- Update to version 2.3.2
* Wed Nov 05 2003 ro@suse.de
- package according to permissions.secure and add run_permissions
- don't build as root
* Mon Jul 21 2003 nashif@suse.de
- update to version 2.3.1
* Thu Jun 19 2003 nashif@suse.de
- Update to version 2.3.0
- Fixed file list
* Thu Apr 10 2003 ro@suse.de
- fix build with coreutils
(deprecated calling syntax for head,tail,sort)
* Mon Jan 20 2003 ro@suse.de
- make it compile with latest glibc (pcp-2.2.2-st_mtime.patch)
* Mon Dec 02 2002 ro@suse.de
- include errno.h where needed
- use yacc instead of bison for now (make it compile)
* Fri Aug 16 2002 nashif@suse.de
- Fixed bug #17954: Added PreReq
* Thu Apr 25 2002 coolo@suse.de
- fix build for x86_64 and s390x
* Fri Feb 15 2002 nashif@suse.de
- fix bug #13321: made init script pmie LSB compliant
- Added header note
- Status returns correct value
- Fixed pcp init script: status did not work
* Fri Jan 18 2002 nashif@suse.de
- Update to version 2.2.2
* Thu Dec 06 2001 nashif@suse.de
- Removed START_ variable
- Changed escaped { to non escaped to stop awk from complaining
* Mon Jul 09 2001 nashif@suse.de
- Update to version 2.2.1
- Fixed bug # 9068
* Thu Jun 07 2001 nashif@suse.de
- fixed configure.in
* Wed May 09 2001 mfabian@suse.de
- bzip2 sources
* Thu Mar 15 2001 nashif@suse.de
- added -fpic to fix compile error on ia64
* Fri Feb 09 2001 nashif@suse.de
- Update headers
- Modified init scripts
* Sun Dec 03 2000 nashif@suse.de
- Fixed %%post (exit before insserv)
- Added sub-package pcp-mysql
- Added mysql PMDA to monitor mysql sessions
* Thu Nov 30 2000 nashif@suse.de
- Update to 2.2.11
* Wed Nov 29 2000 ro@suse.de
- move rcscript to etc/init.d
* Sun Nov 26 2000 nashif@suse.de
- Use insserv
* Mon Oct 30 2000 nashif@suse.de
- Update to version 2.2.10
* Wed Sep 27 2000 nashif@suse.de
- Update to 2.1.7
* Fri Jul 07 2000 kukuk@suse.de
- Fix for SPARC
* Wed May 24 2000 nashif@suse.de
- Initial Release (2.1.4)