Features/FullyTestablePerl/RpmMacros

An overloaded %debug_package, a couple additional macros, and an additional helper script are all that's needed to automatically generate a -tests subpackage.

add to $HOME/.rpmmacros %__is_perl_pkg 1
 * 1) FIXME: need some magic here!

%debug_package \ %ifnarch noarch\ %global __debug_package 1\ %package debug\ Summary: Debug information for package %{name}\ Group: Development/Debug\ AutoReqProv: 0\ %description debug\ This package provides debug information for package %{name}.\ Debug information is useful when developing applications that use this\ package or when debugging this package.\ %files debug -f debugfiles.list\ %defattr(-,root,root)\ %endif\ %if %{__is_perl_pkg}0\ %global __perl_package 1\ %package tests\ Summary: Test suite for package %{name}\ Group: Development/Debug\ Requires: %{name} = %{version}\ AutoReqProv: 0\ %description tests\ This package provides the test suite for package %{name}.\ %files tests -f testsfiles.list\ %defattr(-,root,root)\ %endif\ %{nil}
 * 1)   Template for debug information sub-package.

%perl_version     %(eval "`%{__perl} -V:version`"; echo $version) %perl_testsuitedir /usr/lib/perl5/tests/%{perl_version}/vendor_tests

%__perl_install_post\ $HOME/bin/find-perl-testsuite.sh %{perl_testsuitedir} > testsfiles.list\ %{nil}

%__spec_install_post\ %{?__debug_package:%{__debug_install_post}}\ %{?__perl_package:%{__perl_install_post}}\ %{__arch_install_post}\ %{__os_install_post}\ %{nil}

create as $HOME/bin/find-perl-testsuite.sh
 * 1) !/bin/sh


 * 1) Note this is SUPER simplistic, and will die a horrible death if anything is
 * 2) even off a little bit from what we expect.
 * 3) This code is licensed under the GPL, either version 2 or any later version
 * 4) you choose.
 * 5) Chris Weyl  2008
 * 1) Chris Weyl  2008
 * 1) Chris Weyl  2008

set -ex

TS_DIR_ROOT="$1" DIST_NAME=`echo $RPM_PACKAGE_NAME | sed -e 's/^perl-//'`

TS_DIR="$TS_DIR_ROOT/$DIST_NAME"

mkdir -p $RPM_BUILD_ROOT/$TS_DIR

tar -cf - t/ | ( cd $RPM_BUILD_ROOT/$TS_DIR && tar -xf - )

echo '/usr/lib/perl5/tests'
 * 1) FIXME for now, just add the whole kit-n-kaboodle to %files


 * 1) fin!

Now, try building a perl package :)