Package tests

This commit is contained in:
Petr Písař 2021-03-08 17:55:46 +01:00
parent c3ac4eb07a
commit 4a276778d1
2 changed files with 44 additions and 4 deletions

View File

@ -0,0 +1,2 @@
from Config import *
addFilter("-tests.noarch: W: no-documentation");

View File

@ -14,6 +14,7 @@ Source0: https://cpan.metacpan.org/authors/id/O/OA/OALDERS/libwww-perl-%{
Patch0: libwww-perl-6.39-Normalize-shebangs-in-examples.patch Patch0: libwww-perl-6.39-Normalize-shebangs-in-examples.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: make BuildRequires: make
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: perl-interpreter BuildRequires: perl-interpreter
@ -128,6 +129,9 @@ Provides: perl(LWP::Debug::TraceHTTP::Socket) = %{version}
Provides: perl(LWP::Protocol::http::Socket) = %{version} Provides: perl(LWP::Protocol::http::Socket) = %{version}
Provides: perl(LWP::Protocol::http::SocketMethods) = %{version} Provides: perl(LWP::Protocol::http::SocketMethods) = %{version}
# Remove underspecified dependencies
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Authen::NTLM|Encode|File::Listing|HTTP::Cookies|HTTP::Daemon|HTTP::Date|HTTP::Negotiate|HTTP::Request|HTTP::Response|HTTP::Status|LWP::MediaTypes|MIME::Base64|Net::FTP|Net::HTTP|Test::More|URI|WWW::RobotRules)\\)$
%description %description
The libwww-perl collection is a set of Perl modules which provides a simple and The libwww-perl collection is a set of Perl modules which provides a simple and
consistent application programming interface to the World-Wide Web. The main consistent application programming interface to the World-Wide Web. The main
@ -135,16 +139,37 @@ focus of the library is to provide classes and functions that allow you to
write WWW clients. The library also contain modules that are of more general write WWW clients. The library also contain modules that are of more general
use and even classes that help you implement simple HTTP servers. use and even classes that help you implement simple HTTP servers.
# Remove underspecified dependencies %package tests
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\((Authen::NTLM|Encode|File::Listing|HTTP::Date|HTTP::Negotiate|HTTP::Request|HTTP::Response|HTTP::Status|LWP::MediaTypes|MIME::Base64|Net::FTP|Net::HTTP|URI|WWW::RobotRules)\\)$ Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(HTTP::Cookies) >= 6
Requires: perl(HTTP::Daemon) >= 6.12
Requires: perl(HTTP::Request) >= 6
Requires: perl(HTTP::Response) >= 6
Requires: perl(Net::HTTP) >= 6.18
Requires: perl(Test::More) >= 0.96
%if %{with perl_libwww_perl_enables_internet_test} && %{with perl_libwww_perl_enables_optional_test}
Requires: perl(Test::LeakTrace)
%endif
Requires: perl(URI) >= 1.10
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep %prep
%setup -q -n libwww-perl-%{version} %setup -q -n libwww-perl-%{version}
%patch0 -p1 %patch0 -p1
%if !%{with perl_libwww_perl_enables_internet_test} %if !%{with perl_libwww_perl_enables_internet_test}
rm t/leak/no_leak.t t/redirect.t rm t/base/protocols/nntp.t t/leak/no_leak.t t/redirect.t
perl -i -ne 'print $_ unless m{^(?:t/leak/no_leak\.t|t/redirect\.t)}' MANIFEST perl -i -ne 'print $_ unless m{^(?:t/base/protocols/nntp\.t|t/leak/no_leak\.t|t/redirect\.t)}' MANIFEST
%endif %endif
# Help generators to recognize a Perl code
for F in $(find t -name '*.t'); do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*\bperl}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build %build
# Install the aliases by default # Install the aliases by default
@ -154,6 +179,15 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 --aliases < /de
%install %install
%{make_install} %{make_install}
%{_fixperms} $RPM_BUILD_ROOT/* %{_fixperms} $RPM_BUILD_ROOT/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/bash
unset COVERAGE PERL_LWP_ENV_HTTP_TEST_SERVER_TIMEOUT PERL_LWP_ENV_HTTP_TEST_URL
cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" -r
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%check %check
unset COVERAGE PERL_LWP_ENV_HTTP_TEST_SERVER_TIMEOUT PERL_LWP_ENV_HTTP_TEST_URL unset COVERAGE PERL_LWP_ENV_HTTP_TEST_SERVER_TIMEOUT PERL_LWP_ENV_HTTP_TEST_URL
@ -169,9 +203,13 @@ make test
%{_mandir}/man1/*.1* %{_mandir}/man1/*.1*
%{_mandir}/man3/*.3* %{_mandir}/man3/*.3*
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Mon Mar 08 2021 Petr Pisar <ppisar@redhat.com> - 6.53-1 * Mon Mar 08 2021 Petr Pisar <ppisar@redhat.com> - 6.53-1
- 6.53 bump - 6.53 bump
- Package tests
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.52-2 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 6.52-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild