From 2afae62b281de1b6f1f53f4bb01a983c396781df Mon Sep 17 00:00:00 2001 From: Petr Písař Date: May 27 2021 09:23:12 +0000 Subject: Package the tests --- diff --git a/perl-DateTime-Format-Flexible.rpmlintrc b/perl-DateTime-Format-Flexible.rpmlintrc new file mode 100644 index 0000000..59d4531 --- /dev/null +++ b/perl-DateTime-Format-Flexible.rpmlintrc @@ -0,0 +1,2 @@ +from Config import * +addFilter("-tests\.noarch: W: no-documentation") diff --git a/perl-DateTime-Format-Flexible.spec b/perl-DateTime-Format-Flexible.spec index 935fe5f..9579c8f 100644 --- a/perl-DateTime-Format-Flexible.spec +++ b/perl-DateTime-Format-Flexible.spec @@ -38,6 +38,10 @@ BuildRequires: perl(Test::Pod::Coverage) >= 1.04 %endif Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +# Remove private modules +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(t::lib::helper\\) +%global __provides_exclude %{?__provides_exclude:%{__provides_exclude}|}^perl\\(t::lib::helper\\) + %description If you have ever had to use a program that made you type in the date a certain way and thought "Why can't the computer just figure out what date I wanted?", @@ -46,8 +50,18 @@ this module is for you. DateTime::Format::Flexible attempts to take any string you give it and parse it into a DateTime object. +%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 DateTime-Format-Flexible-%{version} +chmod +x t/*.t %build perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -56,13 +70,25 @@ 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} +rm %{buildroot}%{_libexecdir}/%{name}/t/{002_pod,003_podcoverage}.t +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +unset DFF_DEBUG +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check +unset DFF_DEBUG %if %{with perl_DateTime_Format_Flexible_enables_extra_test} export TEST_POD=1 %else export TEST_POD=0 %endif +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') make test %files @@ -71,9 +97,13 @@ make test %{perl_vendorlib}/* %{_mandir}/man3/*.3* +%files tests +%{_libexecdir}/%{name} + %changelog * Thu May 27 2021 Petr Pisar - 0.33-1 - 0.33 bump +- Package the tests * Wed Jan 27 2021 Fedora Release Engineering - 0.32-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild