rpms/perl/devel macros.perl,1.3,1.4 perl.spec,1.252,1.253

Chris Weyl cweyl at fedoraproject.org
Sat Feb 6 01:37:56 UTC 2010


Author: cweyl

Update of /cvs/extras/rpms/perl/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12986

Modified Files:
	macros.perl perl.spec 
Log Message:
* Fri Feb 05 2010 Chris Weyl <cweyl at alumni.drew.edu> - 4:5.10.1-110
- add initial EXPERIMENTAL tests subpackage rpm macros to macros.perl



Index: macros.perl
===================================================================
RCS file: /cvs/extras/rpms/perl/devel/macros.perl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- macros.perl	1 Oct 2009 14:41:52 -0000	1.3
+++ macros.perl	6 Feb 2010 01:37:55 -0000	1.4
@@ -26,3 +26,106 @@
 %filter_setup \
 }}
 
+#############################################################################
+# Macros to assist with generating a "-tests" subpackage in a semi-automatic
+# manner.
+#
+# The following macros are still in a highly experimental stage and users
+# should be aware that the interface and behaviour may change. 
+#
+# PLEASE, PLEASE CONDITIONALIZE THESE MACROS IF YOU USE THEM.
+#
+# See http://gist.github.com/284409
+
+# These macros should be invoked as above, right before the first %description
+# section, and conditionalized.  e.g., for the common case where all our tests
+# are located under t/, the correct usage is:
+#
+#   %{?perl_default_subpackage_tests}
+#
+# If custom files/directories need to be specified, this can be done as such:
+#
+#   %{?perl_subpackage_tests:%perl_subpackage_tests t/ one/ three.sql}
+#
+# etc, etc.
+
+%perl_version   %(eval "`%{__perl} -V:version`"; echo $version)
+%perl_testdir   %{_libexecdir}/perl5-tests
+%cpan_dist_name %(eval echo %{name} | %{__sed} -e 's/^perl-//')
+
+# easily mark something as required by -tests and BR to the main package
+%tests_req() %{expand:\
+BuildRequires: %*\
+%%tests_subpackage_requires %*\
+}
+
+# fixup (and create if needed) the shbang lines in tests, so they work and
+# rpmlint doesn't (correctly) have a fit
+%fix_shbang_line() \
+TMPHEAD=`mktemp`\
+TMPBODY=`mktemp`\
+for file in %* ; do \
+    head -1 $file > $TMPHEAD\
+    tail -n +2 $file > $TMPBODY\
+    %{__perl} -pi -e '$f = /^#!/ ? "" : "#!%{__perl}$/"; $_="$f$_"' $TMPHEAD\
+    cat $TMPHEAD $TMPBODY > $file\
+done\
+%{__perl} -MExtUtils::MakeMaker -e "ExtUtils::MM_Unix->fixin(qw{%*})"\
+%{__rm} $TMPHEAD $TMPBODY\
+%{nil}
+
+# additional -tests subpackage requires, if any
+%tests_subpackage_requires() %{expand: \
+%global __tests_spkg_req %{?__tests_spkg_req} %* \
+}
+
+# additional -tests subpackage provides, if any
+%tests_subpackage_provides() %{expand: \
+%global __tests_spkg_prov %{?__tests_spkg_prov} %* \
+}
+
+#
+# Runs after the body of %check completes.
+#
+
+%__perl_check_pre %{expand: \
+%{?__spec_check_pre} \
+pushd %{buildsubdir} \
+%define perl_br_testdir %{buildroot}%{perl_testdir}/%{cpan_dist_name} \
+%{__mkdir_p} %{perl_br_testdir} \
+%{__tar} -cf - %{__perl_test_dirs} | ( cd %{perl_br_testdir} && %{__tar} -xf - ) \
+find . -maxdepth 1 -type f -name '*META*' -exec %{__cp} -vp {} %{perl_br_testdir} ';' \
+find %{perl_br_testdir} -type f -exec %{__chmod} -c -x {} ';' \
+T_FILES=`find %{perl_br_testdir} -type f -name '*.t'` \
+%fix_shbang_line $T_FILES \
+%{__chmod} +x $T_FILES \
+%{_fixperms} %{perl_br_testdir} \
+popd \
+}
+
+#
+# The actual invoked macro
+#
+
+%perl_subpackage_tests() %{expand: \
+%global __perl_package 1\
+%global __perl_test_dirs %* \
+%global __spec_check_pre %{expand:%{__perl_check_pre}} \
+%package tests\
+Summary: Test suite for package %{name}\
+Group: Development/Debug\
+Requires: %{name} = %{version}-%{release}\
+Requires: /usr/bin/prove \
+%{?__tests_spkg_req:Requires: %__tests_spkg_req}\
+%{?__tests_spkg_prov:Provides: %__tests_spkg_prov}\
+AutoReqProv: 0 \
+%description tests\
+This package provides the test suite for package %{name}.\
+%files tests\
+%defattr(-,root,root,-)\
+%{perl_testdir}\
+}
+
+# shortcut sugar
+%perl_default_subpackage_tests %perl_subpackage_tests t/
+


Index: perl.spec
===================================================================
RCS file: /cvs/extras/rpms/perl/devel/perl.spec,v
retrieving revision 1.252
retrieving revision 1.253
diff -u -p -r1.252 -r1.253
--- perl.spec	8 Jan 2010 15:07:12 -0000	1.252
+++ perl.spec	6 Feb 2010 01:37:56 -0000	1.253
@@ -7,7 +7,7 @@
 
 Name:           perl
 Version:        %{perl_version}
-Release:        109%{?dist}
+Release:        110%{?dist}
 Epoch:          %{perl_epoch}
 Summary:        Practical Extraction and Report Language
 Group:          Development/Languages
@@ -1869,6 +1869,9 @@ make test
 
 # Old changelog entries are preserved in CVS.
 %changelog
+* Fri Feb 05 2010 Chris Weyl <cweyl at alumni.drew.edu> - 4:5.10.1-110
+- add initial EXPERIMENTAL tests subpackage rpm macros to macros.perl
+
 * Tue Dec 22 2009 Marcela Mašláňová <mmaslano at redhat.com> - 4:5.10.1-109
 - 547656 CVE-2009-3626 perl: regexp matcher crash on invalid UTF-8 characters  
 - 549306 version::Internals should be packaged in perl-version subpackage



More information about the scm-commits mailing list