diff --git a/perl-GIS-Distance.rpmlintrc b/perl-GIS-Distance.rpmlintrc new file mode 100644 index 0000000..a5d5f5e --- /dev/null +++ b/perl-GIS-Distance.rpmlintrc @@ -0,0 +1 @@ +addFilter('-tests\.noarch: W: no-documentation') diff --git a/perl-GIS-Distance.spec b/perl-GIS-Distance.spec index c47c14d..72fb19a 100644 --- a/perl-GIS-Distance.spec +++ b/perl-GIS-Distance.spec @@ -10,7 +10,7 @@ Name: perl-GIS-Distance Version: 0.19 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Calculate geographic distances License: GPL+ or Artistic URL: https://metacpan.org/release/GIS-Distance @@ -20,6 +20,7 @@ BuildRequires: coreutils BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: perl(:VERSION) >= 5.8.1 +BuildRequires: perl(Config) BuildRequires: perl(Module::Build::Tiny) >= 0.035 BuildRequires: perl(strict) # Run-time: @@ -37,11 +38,11 @@ BuildRequires: perl(strictures) >= 2 BuildRequires: perl(GIS::Distance::Fast) >= 0.13 %endif # Tests: -BuildRequires: perl(Test2::Require::Module) BuildRequires: perl(Test2::V0) >= 0.000094 %if %{with perl_GIS_Distance_enables_optional_test} # Optional tests: BuildRequires: perl(Geo::Point) >= 0.95 +BuildRequires: perl(Test2::Require::Module) %endif Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl(Const::Fast) >= 0.014 @@ -51,15 +52,37 @@ Recommends: perl(GIS::Distance::Fast) >= 0.13 Requires: perl(namespace::clean) >= 0.24 # Remove under-specified dependencies -%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Const::Fast|namespace::clean)\\)$ +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Const::Fast|Geo::Point|namespace::clean|Test2::V0)\\)$ %description This Perl module calculates distances between geographic points on, at the moment, planet Earth. Various "FORMULAS" are available that provide different levels of accuracy versus speed. +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Test2::V0) >= 0.000094 +%if %{with perl_GIS_Distance_enables_optional_test} +Requires: perl(Geo::Point) >= 0.95 +%endif + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n GIS-Distance-%{version} +%if !%{with perl_GIS_Distance_enables_optional_test} +rm t/geo_point.t +perl -i -ne 'print $_ unless m{^t/geo_point\.t}' MANIFEST +%endif +# Normalize shebangs +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 Build.PL --installdirs=vendor @@ -68,9 +91,19 @@ perl Build.PL --installdirs=vendor %install ./Build install --destdir=%{buildroot} --create_packlist=0 %{_fixperms} %{buildroot} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +unset GEO_DISTANCE_PP GIS_DISTANCE_PP +cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %check unset GEO_DISTANCE_PP GIS_DISTANCE_PP +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') ./Build test %files @@ -79,7 +112,13 @@ unset GEO_DISTANCE_PP GIS_DISTANCE_PP %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Tue Jan 18 2022 Petr Pisar - 0.19-5 +- Package the tests + * Thu Jul 22 2021 Fedora Release Engineering - 0.19-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild