[perl-RRD-Simple] Spec clean-up

Paul Howarth pghmcfc at fedoraproject.org
Thu Jan 12 20:16:45 UTC 2012


commit ec765b304c427a654cee8c2c37f97bee1b4af77f
Author: Paul Howarth <paul at city-fan.org>
Date:   Thu Jan 12 20:16:13 2012 +0000

    Spec clean-up
    
    - Fix provides/requires filters to work with rpm 4.9+ too
    - Add buildreqs for perl core modules, which may be dual-lived
    - Nobody else likes macros for commands
    - Don't package INSTALL file

 perl-RRD-Simple.spec |   42 ++++++++++++++++++++++++++++++++----------
 1 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/perl-RRD-Simple.spec b/perl-RRD-Simple.spec
index 67e863d..4005b4b 100644
--- a/perl-RRD-Simple.spec
+++ b/perl-RRD-Simple.spec
@@ -1,21 +1,30 @@
+# Need to tweak provides/requires filters differently if we have rpm 4.9 onwards
+%global rpm49 %(rpm --version | perl -pi -e 's/^.* (\\d+)\\.(\\d+)\\.(\\d+).*/sprintf("%d.%03d%03d",$1,$2,$3) ge 4.009 ? 1 : 0/e')
+
 Name:		perl-RRD-Simple
 Version:	1.44
-Release:	10%{?dist}
+Release:	11%{?dist}
 Summary:	Simple interface to create and store data in RRD files
 Group:		Development/Libraries
 License:	ASL 2.0
 URL:		http://search.cpan.org/dist/RRD-Simple
 Source0:	http://search.cpan.org/CPAN/authors/id/N/NI/NICOLAW/RRD-Simple-%{version}.tar.gz
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
 BuildArch:	noarch
+BuildRequires:	perl(Carp)
+BuildRequires:	perl(Exporter)
+BuildRequires:	perl(File::Basename)
+BuildRequires:	perl(File::Spec)
 BuildRequires:	perl(Module::Build)
+BuildRequires:	perl(POSIX)
 BuildRequires:	perl(RRDs)
 BuildRequires:	perl(Test::More)
 BuildRequires:	perl(Test::Pod)
 BuildRequires:	perl(Test::Pod::Coverage)
+
 # https://rt.cpan.org/Public/Bug/Display.html?id=46193
 BuildConflicts:	perl(Test::Deep)
-Requires:	perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Requires:	perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
 
 %description
 RRD::Simple provides a simple interface to RRDTool's RRDs module. This module
@@ -31,35 +40,42 @@ if you do not need to, nor want to, bother defining custom RRA definitions.
 %setup -q -n RRD-Simple-%{version}
 
 # Don't want provides/requires from %%{_docdir}
-%global docfilt %{__perl} -p -e 's|%{_docdir}/%{name}-%{version}\\S+||'
+%global docfilt perl -p -e 's|%{_docdir}/%{name}-%{version}\\S+||'
 # RRD::Simple version should be from distribution version, not svn revision
-%global verfilt %{__perl} -pi -e 's/(perl\\(RRD::Simple\\) =) \\d+/\\1 %{version}/'
+%global verfilt perl -pi -e 's/(perl\\(RRD::Simple\\) =) \\d+/\\1 %{version}/'
 # Apply provides/requires filters
+%if %{rpm49}
+%global provfilt /bin/sh -c "%{docfilt} | %{__perllib_provides} | %{verfilt}"
+%define __perllib_provides %{provfilt}
+%global reqfilt /bin/sh -c "%{docfilt} | %{__perllib_requires}"
+%define __perllib_requires %{reqfilt}
+%else
 %global provfilt /bin/sh -c "%{docfilt} | %{__perl_provides} | %{verfilt}"
 %define __perl_provides %{provfilt}
 %global reqfilt /bin/sh -c "%{docfilt} | %{__perl_requires}"
 %define __perl_requires %{reqfilt}
+%endif
 
 %build
 # Prevent call-home query/timeout; not strictly necessary
-AUTOMATED_TESTING=1 %{__perl} Build.PL installdirs=vendor
+AUTOMATED_TESTING=1 perl Build.PL installdirs=vendor
 ./Build
 
 %install
-%{__rm} -rf %{buildroot}
+rm -rf %{buildroot}
 ./Build install destdir=%{buildroot} create_packlist=0
-/usr/bin/find %{buildroot} -depth -type d -exec /bin/rmdir {} ';' 2>/dev/null
+find %{buildroot} -depth -type d -exec rmdir {} ';' 2>/dev/null
 %{_fixperms} %{buildroot}
 
 %check
 LC_ALL=C ./Build test
 
 %clean
-%{__rm} -rf %{buildroot}
+rm -rf %{buildroot}
 
 %files
 %defattr(-,root,root,-)
-%doc Changes INSTALL LICENSE NOTICE README examples/ t/
+%doc Changes LICENSE NOTICE README examples/ t/
 %dir %{perl_vendorlib}/RRD/
 %dir %{perl_vendorlib}/RRD/Simple/
 %{perl_vendorlib}/RRD/Simple.pm
@@ -68,6 +84,12 @@ LC_ALL=C ./Build test
 %{_mandir}/man3/RRD::Simple::Examples.3pm*
 
 %changelog
+* Thu Jan 12 2012 Paul Howarth <paul at city-fan.org> - 1.44-11
+- Fix provides/requires filters to work with rpm 4.9+ too
+- Add buildreqs for perl core modules, which may be dual-lived
+- Nobody else likes macros for commands
+- Don't package INSTALL file
+
 * Mon Jun 20 2011 Marcela Mašláňová <mmaslano at redhat.com> - 1.44-10
 - Perl mass rebuild
 



More information about the perl-devel mailing list