From Fedora Project Wiki

< Features‎ | FullyTestablePerl

Revision as of 09:11, 8 November 2008 by Cweyl (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Proof-of-concept only!
These are rough, proof-of-concept demonstrations. They certainly need more work and cleanup, even before just living in one's .rpmmacros file full-time. (Which, incidentally, is a good way to try this out.)

add to $HOME/.rpmmacros

# FIXME: need some magic here!
%__is_perl_pkg  1

#   Template for debug information sub-package.
%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\
%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\

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

$HOME/bin/ %{perl_testsuitedir} > testsfiles.list\


create as $HOME/bin/


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

set -ex

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



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

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

# fin!

Now, try building a perl package :)