From Fedora Project Wiki
(New page: An overloaded %debug_package, a couple additional macros, and an additional helper script are all that's needed to automatically generate a -tests subpackage. Note! These are rough, proo...)
 
No edit summary
Line 82: Line 82:


Now, try building a perl package :)
Now, try building a perl package :)
[[Cagtegory:Perl]]

Revision as of 04:23, 8 November 2008

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

Note! 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\
%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}

%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

#!/bin/sh

# 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 <cweyl@alumni.drew.edu> 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 - )

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

# fin!

Now, try building a perl package :)


Cagtegory:Perl