diff --git a/perl-DB_File.spec b/perl-DB_File.spec index 5be16c6..dca8c08 100644 --- a/perl-DB_File.spec +++ b/perl-DB_File.spec @@ -59,11 +59,26 @@ provided by Berkeley DB version 1.x (if you have a newer version of DB, you will be limited to functionality provided by interface of version 1.x). The interface defined here mirrors the Berkeley DB interface closely. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n DB_File-%{version} find -type f -exec chmod -x {} + perl -MConfig -pi -e 's|^#!.*perl|$Config{startperl}|' dbinfo +# Help file to recognise the Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F" + chmod +x "$F" +done + %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_OPT_FLAGS" %{make_build} @@ -73,8 +88,21 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="$RPM_ find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete %{_fixperms} $RPM_BUILD_ROOT/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +# Remove author tests +rm %{buildroot}%{_libexecdir}/%{name}/t/pod.t +rm %{buildroot}%{_libexecdir}/%{name}/t/meta-*.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + %check unset PERL_CORE +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -83,9 +111,13 @@ make test %{perl_vendorarch}/DB_File* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Tue Jun 22 2021 Jitka Plesnikova - 1.856-1 - 1.856 bump +- Package tests * Mon May 24 2021 Jitka Plesnikova - 1.855-478 - Perl 5.34 re-rebuild of bootstrapped packages