File pcp.spec of Package pcp

#
# spec file for package pcp
#
# Copyright (c) 2011 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
Version:        3.5.8
Release:        3
%define pcp_release 1
Summary:        System-level performance monitoring and performance management
License:        GPLv2
Url:            http://oss.sgi.com/projects/pcp
Group:          System/Monitoring
Source:         %{name}-%{version}-%{pcp_release}.src.tar.gz
Requires:       libpcp3 = %{version}
Requires:       bash gawk sed grep fileutils findutils
%if "%{_vendor}" == "suse"
Requires:       sysconfig cpp 
%else
Requires:       initscripts
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf bison flex ncurses-devel procps readline-devel
BuildRequires:  perl(ExtUtils::MakeMaker)
Patch6:         pcp-xenbuild.patch
Patch9:         static_lib_perms.diff

%define _pmdasdir %{_localstatedir}/lib/pcp/pmdas

%description
Performance Co-Pilot (PCP) provides a framework and services to support
system-level performance monitoring and performance management. 

The PCP open source release provides a unifying abstraction for all of
the interesting performance data in a system, and allows client
applications to easily retrieve and process any subset of that data. 

#
# libpcp
#
%package -n libpcp3
License:        LGPLv2+
Group:          System/Libraries
Summary:        Performance Co-Pilot run-time libraries
Url:            http://oss.sgi.com/projects/pcp/
Obsoletes:      pcp < 3.0
AutoReq:        no

%description -n libpcp3
Performance Co-Pilot (PCP) run-time libraries

#
# libpcp-devel
#
%package -n libpcp-devel
License:        GPLv2
Group:          Development/Libraries/Other
Summary:        Performance Co-Pilot (PCP) development headers and documentation
Url:            http://oss.sgi.com/projects/pcp/
Requires:       libpcp3 = %{version}

%description -n libpcp-devel
Performance Co-Pilot (PCP) headers, documentation and tools for development.

#
# perl-PCP-PMDA. This is the PCP agent perl binding.
#
%package -n perl-PCP-PMDA
License:        GPLv2
Group:          System/Monitoring
Summary:        Performance Co-Pilot (PCP) Perl bindings and documentation
Url:            http://oss.sgi.com/projects/pcp/
Requires:       pcp >= %{version} perl-base

%description -n perl-PCP-PMDA
The PCP::PMDA Perl module contains the language bindings for
building Performance Metric Domain Agents (PMDAs) using Perl.
Each PMDA exports performance data for one specific domain, for
example the operating system kernel, Cisco routers, a database,
an application, etc.

#
# perl-PCP-MMV
#
%package -n perl-PCP-MMV
License:        GPLv2
Group:          System/Monitoring
Summary:        Performance Co-Pilot (PCP) Perl bindings for PCP Memory Mapped Values
Url:            http://oss.sgi.com/projects/pcp/
Requires:       pcp >= %{version} perl-base

%description -n perl-PCP-MMV
The PCP::MMV module contains the Perl language bindings for
building scripts instrumented with the Performance Co-Pilot
(PCP) Memory Mapped Value (MMV) mechanism.
This mechanism allows arbitrary values to be exported from an
instrumented script into the PCP infrastructure for monitoring
and analysis with pmchart, pmie, pmlogger and other PCP tools.

#
# perl-PCP-LogImport
#
%package -n perl-PCP-LogImport
License:        GPLv2
Group:          System/Monitoring
Summary:        Performance Co-Pilot Perl bindings for importing external data
Url:            http://oss.sgi.com/projects/pcp/
Requires:       pcp >= %{version} perl-base

%description -n perl-PCP-LogImport
The PCP::LogImport module contains the Perl language bindings for
importing data in various 3rd party formats into PCP archives so
they can be replayed with standard PCP monitoring tools.

#
# perl-PCP-LogSummary
#
%package -n perl-PCP-LogSummary
License:        GPLv2
Group:          System/Monitoring
Summary:        Performance Co-Pilot Perl bindings for processing pmlogsummary output
Url:            http://oss.sgi.com/projects/pcp/
Requires:       pcp >= %{version} perl-base

%description -n perl-PCP-LogSummary
The PCP::LogSummary module provides a Perl module for using the
statistical summary data produced by the Performance Co-Pilot
pmlogsummary utility.  This utility produces various averages,
minima, maxima, and other calculations based on the performance
data stored in a PCP archive.  The Perl interface is ideal for
exporting this data into third-party tools (e.g. spreadsheets).

#
# pcp-import-sar2pcp
#
%package import-sar2pcp
License:        LGPLv2+
Group:          System/Monitoring
Summary:        Performance Co-Pilot tools for importing sar data into PCP archive logs
Url:            http://oss.sgi.com/projects/pcp/
Requires:       libpcp3 >= %{version} perl-PCP-LogImport >= %{version} sysstat

%description import-sar2pcp
Performance Co-Pilot (PCP) front-end tools for importing sar data
into standard PCP archive logs for replay with any PCP monitoring tool.

#
# pcp-import-iostat2pcp
#
%package import-iostat2pcp
License:        LGPLv2+
Group:          System/Monitoring
Summary:        Performance Co-Pilot tools for importing iostat data into PCP archive logs
Url:            http://oss.sgi.com/projects/pcp/
Requires:       libpcp3 >= %{version} perl-PCP-LogImport >= %{version} sysstat

%description import-iostat2pcp
Performance Co-Pilot (PCP) front-end tools for importing iostat data
into standard PCP archive logs for replay with any PCP monitoring tool.

#
# pcp-import-sheet2pcp
#
%package import-sheet2pcp
License:        LGPLv2+
Group:          System/Monitoring
Summary:        Performance Co-Pilot tools for importing spreadsheet data into PCP archive logs
Url:            http://oss.sgi.com/projects/pcp/
Requires:       libpcp3 >= %{version} perl-PCP-LogImport >= %{version} sysstat

%description import-sheet2pcp
Performance Co-Pilot (PCP) front-end tools for importing spreadsheet data
into standard PCP archive logs for replay with any PCP monitoring tool.

#
# pcp-import-mrtg2pcp
#
%package import-mrtg2pcp
License:        LGPLv2+
Group:          System/Monitoring
Summary:        Performance Co-Pilot tools for importing MTRG data into PCP archive logs
Url:            http://oss.sgi.com/projects/pcp/
Requires:       libpcp3 >= %{version} perl-PCP-LogImport >= %{version}

%description import-mrtg2pcp
Performance Co-Pilot (PCP) front-end tools for importing MTRG data
into standard PCP archive logs for replay with any PCP monitoring tool.

%prep
%setup -q
%patch6
%patch9
autoconf
./configure --bindir=%{_bindir} \
	    --libdir=%{_libdir} \
	    --libexecdir=%{_libexecdir} && touch config.done

%clean
[ ! -z "$DIST_ROOT" ] && rm -rf $DIST_ROOT
rm -Rf $RPM_BUILD_ROOT

%build
make default_pcp

%install
BACKDIR=`pwd`;
DIST_ROOT=$RPM_BUILD_ROOT
export DIST_ROOT
make install_pcp

# Fix stuff we do/don't want to ship
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.a

# list of PMDAs in the base pkg
ls -1 $RPM_BUILD_ROOT/%{_pmdasdir} | grep -vE 'simple|sample|trivial|txmon' |\
sed -e 's#^#'%{_pmdasdir}'\/#' >base_pmdas.list

# bin and man1 files except those split out into sub packages
ls -1 $RPM_BUILD_ROOT/%{_bindir} | grep -v '2pcp' |\
sed -e 's#^#'%{_bindir}'\/#' >base_binfiles.list
ls -1 $RPM_BUILD_ROOT/%{_mandir}/man1 | grep -v '2pcp' |\
sed -e 's#^#'%{_mandir}'\/man1\/#' >base_man1files.list

cat base_pmdas.list base_binfiles.list base_man1files.list > base_specialfiles.list

# add /etc/init.d/X symlinks at /usr/sbin/rcX
%__install -d -m 0755 ${RPM_BUILD_ROOT}/%{_sbindir}
for script in pcp pmie pmproxy; do
        ln -s "%{_sysconfdir}/init.d/${script}" "${RPM_BUILD_ROOT}/%{_sbindir}/rc${script}"
done

%post
/sbin/ldconfig

%preun
%{?stop_on_removal:%{stop_on_removal pcp pmproxy pmie}}

%postun
/sbin/ldconfig
%{?restart_on_update:%{restart_on_update pcp pmproxy pmie}}
%{?insserv_cleanup:%{insserv_cleanup}}

%post -n libpcp3 -p /sbin/ldconfig

%postun -n libpcp3 -p /sbin/ldconfig

%files -f base_specialfiles.list
%defattr(-,root,root)
%dir %{_pmdasdir}
%dir %{_datadir}/pcp
%dir %{_localstatedir}/lib/pcp
%dir %{_localstatedir}/lib/pcp/config
%doc %{_datadir}/doc/packages/pcp-%{version}
%{_libexecdir}/pcp
%{_datadir}/pcp/lib
%{_localstatedir}/log/pcp
%{_localstatedir}/lib/pcp/pmns
%{_initrddir}/pcp
%{_initrddir}/pmie
%{_initrddir}/pmproxy
%{_mandir}/man4/*
%config %{_sysconfdir}/bash_completion.d/pcp
%config %{_sysconfdir}/pcp.env
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmcd/pmcd.conf
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmcd/pmcd.options
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmcd/rc.local
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmie/config.default
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmie/control
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmie/crontab
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmlogger/config.default
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmlogger/control
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmlogger/crontab
%config(noreplace) %{_localstatedir}/lib/pcp/config/pmproxy/pmproxy.options
%{_localstatedir}/lib/pcp/config/*
/usr/sbin/rcpcp
/usr/sbin/rcpmie
/usr/sbin/rcpmproxy

%files -n libpcp3
%defattr(-,root,root)
%dir %{_includedir}/pcp
%{_includedir}/pcp/builddefs
%{_includedir}/pcp/buildrules
%config %{_sysconfdir}/pcp.conf
%{_libdir}/libpcp.so.3
%{_libdir}/libpcp_gui.so.2
%{_libdir}/libpcp_mmv.so.1
%{_libdir}/libpcp_pmda.so.3
%{_libdir}/libpcp_trace.so.2
%{_libdir}/libpcp_import.so.1

%files -n libpcp-devel
%defattr(-,root,root)
%{_libdir}/libpcp.so
%{_libdir}/libpcp.so.2
%{_libdir}/libpcp_gui.so
%{_libdir}/libpcp_gui.so.1
%{_libdir}/libpcp_mmv.so
%{_libdir}/libpcp_pmda.so
%{_libdir}/libpcp_pmda.so.2
%{_libdir}/libpcp_trace.so
%{_libdir}/libpcp_import.so
%{_includedir}/pcp/*.h
%{_mandir}/man3/*.3.gz
%{_datadir}/pcp/demos
%{_datadir}/pcp/examples
%{_localstatedir}/lib/pcp/pmdas/simple
%{_localstatedir}/lib/pcp/pmdas/sample
%{_localstatedir}/lib/pcp/pmdas/trivial
%{_localstatedir}/lib/pcp/pmdas/txmon

%files import-sar2pcp
%defattr(-,root,root)
%{_bindir}/sar2pcp
%{_mandir}/man1/sar2pcp.1.gz

%files import-iostat2pcp
%defattr(-,root,root)
%{_bindir}/iostat2pcp
%{_mandir}/man1/iostat2pcp.1.gz

%files import-sheet2pcp
%defattr(-,root,root)
%{_bindir}/sheet2pcp
%{_mandir}/man1/sheet2pcp.1.gz

%files import-mrtg2pcp
%defattr(-,root,root)
%{_bindir}/mrtg2pcp
%{_mandir}/man1/mrtg2pcp.1.gz

%files -n perl-PCP-PMDA
%defattr(-,root,root)
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP/PMDA
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP/PMDA.pm
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP/PMDA/PMDA.so
/usr/share/man/man3/PCP::PMDA.3pm.gz

%files -n perl-PCP-MMV
%defattr(-,root,root)
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP/MMV
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP/MMV.pm
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP/server.pl
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP/MMV/MMV.so
/usr/share/man/man3/PCP::MMV.3pm.gz

%files -n perl-PCP-LogImport
%defattr(-,root,root)
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP
%dir /usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP/LogImport
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/PCP/LogImport.pm
/usr/lib/perl5/vendor_perl/*/*-linux-thread-multi/auto/PCP/LogImport/LogImport.so
/usr/share/man/man3/PCP::LogImport.3pm.gz

%files -n perl-PCP-LogSummary
%defattr(-,root,root)
%dir /usr/lib/perl5/vendor_perl/*/PCP
/usr/lib/perl5/vendor_perl/*/PCP/LogSummary.pm
/usr/lib/perl5/vendor_perl/*/PCP/exceldemo.pl
/usr/lib/perl5/vendor_perl/*/PCP/extract.pl
/usr/share/man/man3/PCP::LogSummary.3pm.gz

%changelog