diff --git a/perl-MooseX-Types-Common.rpmlintrc b/perl-MooseX-Types-Common.rpmlintrc new file mode 100644 index 0000000..5e41aba --- /dev/null +++ b/perl-MooseX-Types-Common.rpmlintrc @@ -0,0 +1 @@ +addFilter('-tests.noarch: W: no-documentation') diff --git a/perl-MooseX-Types-Common.spec b/perl-MooseX-Types-Common.spec index 754a49e..abc994f 100644 --- a/perl-MooseX-Types-Common.spec +++ b/perl-MooseX-Types-Common.spec @@ -1,17 +1,17 @@ Name: perl-MooseX-Types-Common Summary: A library of commonly used type constraints Version: 0.001014 -Release: 17%{?dist} +Release: 18%{?dist} License: GPL+ or Artistic Source0: https://cpan.metacpan.org/authors/id/E/ET/ETHER/MooseX-Types-Common-%{version}.tar.gz URL: https://metacpan.org/release/MooseX-Types-Common BuildArch: noarch - BuildRequires: coreutils BuildRequires: make BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(:VERSION) >= 5.8 +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(strict) BuildRequires: perl(warnings) @@ -40,9 +40,23 @@ Requires: perl(namespace::autoclean) A set of commonly-used type constraints that do not ship with Moose by default. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(URI::URL) + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". %prep %setup -q -n MooseX-Types-Common-%{version} +# 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_MM_FALLBACK_SILENCE_WARNING=1 perl Makefile.PL INSTALLDIRS=vendor \ @@ -52,8 +66,19 @@ PERL_MM_FALLBACK_SILENCE_WARNING=1 perl Makefile.PL INSTALLDIRS=vendor \ %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 +unset AUTHOR_TESTING +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check +unset AUTHOR_TESTING +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -62,7 +87,13 @@ make test %{perl_vendorlib}/MooseX* %{_mandir}/man3/MooseX*.3* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Jan 17 2022 Petr Pisar - 0.001014-18 +- Package the tests + * Thu Jan 06 2022 Petr Pisar - 0.001014-17 - Specify all dependencies