[perl-Software-License] Clean up and add EL-5 support

Paul Howarth pghmcfc at fedoraproject.org
Wed Mar 7 15:04:01 UTC 2012


commit dec5cbf54285101b817329f03a9a71056b7cf27f
Author: Paul Howarth <paul at city-fan.org>
Date:   Wed Mar 7 15:02:25 2012 +0000

    Clean up and add EL-5 support
    
    - Add test suite patch to support building with Test::More < 0.88 so that we
      can build for EPEL-5, only applying the patch when necessary
    - Drop redundant versioned requirements of XXX >= 0.000
    - Drop BR: perl ≥ 1:5.6.0; even EL-3 could have satisfied that
    - BR: perl(base) and perl(Carp), which could be dual-lived
    - BR: perl(Test::Pod) for full test coverage
    - Run the release tests too
    - Don't need to remove empty directories from buildroot
    - Don't use macros for commands
    - Use DESTDIR rather than PERL_INSTALL_ROOT
    - Drop %defattr, redundant since rpm 4.4
    - Make %files list more explicit

 Software-License-0.103001-old-Test::More.patch |   48 +++++++++++++++++++
 perl-Software-License.spec                     |   58 ++++++++++++++++-------
 2 files changed, 88 insertions(+), 18 deletions(-)
---
diff --git a/Software-License-0.103001-old-Test::More.patch b/Software-License-0.103001-old-Test::More.patch
new file mode 100644
index 0000000..33158f1
--- /dev/null
+++ b/Software-License-0.103001-old-Test::More.patch
@@ -0,0 +1,48 @@
+diff -up Software-License-0.103001/t/custom.t.orig Software-License-0.103001/t/custom.t
+--- Software-License-0.103001/t/custom.t.orig	2011-04-28 12:20:57.000000000 +0100
++++ Software-License-0.103001/t/custom.t	2011-04-28 15:41:09.821742581 +0100
+@@ -2,7 +2,7 @@
+ use strict;
+ use warnings;
+ 
+-use Test::More;
++use Test::More tests => 8;
+ 
+ use Software::License::Custom;
+ 
+@@ -40,5 +40,3 @@ Well... this is only some sample text. I
+ 
+ Yes, spanning more lines and more paragraphs.
+ END_OF_FULLTEXT
+-
+-done_testing;
+diff -up Software-License-0.103001/t/meta-names.t.orig Software-License-0.103001/t/meta-names.t
+--- Software-License-0.103001/t/meta-names.t.orig	2011-04-28 12:20:57.000000000 +0100
++++ Software-License-0.103001/t/meta-names.t	2011-04-28 15:40:17.974704365 +0100
+@@ -2,13 +2,16 @@
+ use strict;
+ use warnings;
+ 
+-use Test::More 0.88;
++use Test::More;
+ 
+ my @files = <lib/Software/License/*.pm>;
+ 
++plan tests => scalar @files;
++
+ for my $module (@files) {
+   # It's retired.  Dunno if it's okay to be open_source.  Punt!
+-  next if $module =~ /Sun.pm$/;
++  SKIP: {
++  skip "Dunno if it's okay for Sun.pm to be open_source", 1 if $module =~ /Sun.pm$/;
+ 
+   my $pkg = $module;
+   $pkg =~ s{^lib/}{};
+@@ -18,6 +21,5 @@ for my $module (@files) {
+   eval "require $pkg; 1";
+ 
+   ok(defined $pkg->meta_name, "$pkg provide meta_name");
++  }
+ }
+-
+-done_testing;
diff --git a/perl-Software-License.spec b/perl-Software-License.spec
index 6dd6d6b..4429931 100644
--- a/perl-Software-License.spec
+++ b/perl-Software-License.spec
@@ -1,6 +1,9 @@
+# We need to patch the test suite if we have an old version of Test::More
+%global old_test_more %(perl -MTest::More -e 'print (($Test::More::VERSION < 0.88) ? 1 : 0);' 2>/dev/null || echo 0)
+
 Name:           perl-Software-License
 Version:        0.103004
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Package that provides templated software licenses
 License:        GPL+ or Artistic
 Group:          Development/Libraries
@@ -8,15 +11,18 @@ URL:            http://search.cpan.org/dist/Software-License/
 # For unknown reasons this module URL is currently missing
 #Source0:        http://www.cpan.org/modules/by-module/Software/Software-License-%{version}.tar.gz
 Source0:        http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Software-License-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch1:         Software-License-0.103001-old-Test::More.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
 BuildArch:      noarch
-BuildRequires:  perl >= 1:5.6.0
-BuildRequires:  perl(Data::Section) >= 0.000
+BuildRequires:  perl(base)
+BuildRequires:  perl(Carp)
+BuildRequires:  perl(Data::Section)
 BuildRequires:  perl(ExtUtils::MakeMaker)
-BuildRequires:  perl(Sub::Install) >= 0.000
-BuildRequires:  perl(Text::Template) >= 0.000
+BuildRequires:  perl(Sub::Install)
+BuildRequires:  perl(Text::Template)
 BuildRequires:  perl(Test::More)
-Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+BuildRequires:  perl(Test::Pod)
+Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
 
 %description
 Software-License contains templates for common open source software licenses.
@@ -24,33 +30,49 @@ Software-License contains templates for common open source software licenses.
 %prep
 %setup -q -n Software-License-%{version}
 
+# Compatibility with old Test::More versions
+%if %{old_test_more}
+%patch1 -p1
+%endif
+
 %build
-%{__perl} Makefile.PL INSTALLDIRS=vendor
+perl Makefile.PL INSTALLDIRS=vendor
 make %{?_smp_mflags}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-
-make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
-
+make pure_install DESTDIR=$RPM_BUILD_ROOT
 find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
-find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;
-
-%{_fixperms} $RPM_BUILD_ROOT/*
+%{_fixperms} $RPM_BUILD_ROOT
 
 %check
-make test
+make test RELEASE_TESTING=1
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
-%defattr(-,root,root,-)
 %doc Changes LICENSE README
-%{perl_vendorlib}/*
-%{_mandir}/man3/*
+%{perl_vendorlib}/Software/
+%{_mandir}/man3/Software::License.3pm*
+%{_mandir}/man3/Software::License::*.3pm*
+%{_mandir}/man3/Software::LicenseUtils.3pm*
 
 %changelog
+* Wed Mar  7 2012 Paul Howarth <paul at city-fan.org> - 0.103004-2
+- Add test suite patch to support building with Test::More < 0.88 so that we
+  can build for EPEL-5, only applying the patch when necessary
+- Drop redundant versioned requirements of XXX >= 0.000
+- Drop BR: perl ≥ 1:5.6.0; even EL-3 could have satisfied that
+- BR: perl(base) and perl(Carp), which could be dual-lived
+- BR: perl(Test::Pod) for full test coverage
+- Run the release tests too
+- Don't need to remove empty directories from buildroot
+- Don't use macros for commands
+- Use DESTDIR rather than PERL_INSTALL_ROOT
+- Drop %%defattr, redundant since rpm 4.4
+- Make %%files list more explicit
+
 * Mon Jan 30 2012 Daniel P. Berrange <berrange at redhat.com> - 0.103004-1
 - Update to 0.103004 release (rhbz #750790)
 


More information about the scm-commits mailing list