pcp/pcp.spec

269 lines
6.8 KiB
RPMSpec
Raw Normal View History

#
# spec file for package pcp (Version 2.5.0)
#
# Copyright (c) 2010 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: 130
Summary: Performance Co-Pilot (system-level performance monitoring)
License: GPLv2+
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
Patch7: pcp-2.5.0-GCC44.patch
Patch8: pcp-pic.diff
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: GPLv2+
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
%patch7 -p1
%patch -P 8 -p1
%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
export RPM_OPT_FLAGS=${RPM_OPT_FLAGS/-fomit-frame-pointer/}
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