diff --git a/perl-Business-CreditCard.rpmlintrc b/perl-Business-CreditCard.rpmlintrc new file mode 100644 index 0000000..a5d5f5e --- /dev/null +++ b/perl-Business-CreditCard.rpmlintrc @@ -0,0 +1 @@ +addFilter('-tests\.noarch: W: no-documentation') diff --git a/perl-Business-CreditCard.spec b/perl-Business-CreditCard.spec index cd4516e..3dac5c5 100644 --- a/perl-Business-CreditCard.spec +++ b/perl-Business-CreditCard.spec @@ -11,6 +11,7 @@ BuildRequires: glibc-common BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 # Run-time: BuildRequires: perl(Exporter) @@ -24,6 +25,15 @@ These subroutines tell you whether a credit card number is self-consistent -- whether the last digit of the number is a valid check-sum for the preceding digits. +%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 Business-CreditCard-%{version} for F in BINS; do @@ -31,6 +41,11 @@ for F in BINS; do touch -r "$F"{,.utf8} mv "$F"{.utf8,} done +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F" + chmod +x "$F" +done %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -39,6 +54,14 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 %install %{make_install} %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +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 export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') @@ -49,9 +72,13 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog * Mon Aug 22 2022 Petr Pisar - 0.39-1 - 0.39 bump +- Install the tests * Fri Jul 22 2022 Fedora Release Engineering - 0.36-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild