import perl-NNTPClient-0.37-5.el8

This commit is contained in:
CentOS Sources 2019-05-07 08:03:45 -04:00 committed by Andrew Lukoshko
commit 7e649483ea
5 changed files with 242 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/NNTPClient-0.37.tar.gz

View File

@ -0,0 +1 @@
0340afb1dd6eba853a3f6b537e5c92ee2d9376c0 SOURCES/NNTPClient-0.37.tar.gz

View File

@ -0,0 +1,96 @@
From 56ff427e14145772485cf04f174e436298d55836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 16 Nov 2016 18:09:48 +0100
Subject: [PATCH] Perform network tests only if EXTENDED_TESTING=1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Many tests require configured NNTP server. This is not true for many
cases. This patch skips them if EXTENDED_TESTING environment variable
is not true. The variable name is defined by
<https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md#environment-variables-for-testing-contexts>.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
test.pl | 46 ++++++++++++++++++++++++++++++----------------
1 file changed, 30 insertions(+), 16 deletions(-)
diff --git a/test.pl b/test.pl
index 26a100c..d8e5e12 100644
--- a/test.pl
+++ b/test.pl
@@ -6,7 +6,11 @@
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
-BEGIN {print "1..37\n";}
+BEGIN {
+ my $test_plan = 7;
+ $test_plan += 30 if $ENV{EXTENDED_TESTING};
+ print "1..$test_plan\n";
+}
END {print "not ok 1\n" unless $loaded;}
use News::NNTPClient;
$loaded = 1;
@@ -18,19 +22,6 @@ print "ok 1\n";
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):
-print <<EOF;
-
- These tests are as much a test of your news server as they are a
- test of News::NNTPClient. Not all of these tests will pass.
-
- The following tests rely on the existence of an available news
- server. If the environment variable NNTPSERVER is not set, then
- "news" will be used. If you don't have access to a news server,
- ok(), okprint(), code(), and postok() will fail. postok() will
- also fail if you don't have permission to post.
-
-EOF
-
$i = 2;
sub skip_500_ok {
@@ -50,12 +41,35 @@ $c = new News::NNTPClient;
$c->gmt(1);
$c->fourdigityear(1);
-for $f (qw(version debug eol gmt fourdigityear message code
- ok okprint postok mode_reader list help)) {
+for $f (qw(version debug eol gmt fourdigityear message)) {
+ print "not " unless $c->$f();
+ print "ok ", $i++, " ($f)\n";
+}
+
+# All test since here require an existing NNTP server
+if (!$ENV{EXTENDED_TESTING}) {
+ exit 0;
+}
+
+print <<EOF;
+
+ These tests are as much a test of your news server as they are a
+ test of News::NNTPClient. Not all of these tests will pass.
+
+ The following tests rely on the existence of an available news
+ server. If the environment variable NNTPSERVER is not set, then
+ "news" will be used. If you don't have access to a news server,
+ ok(), okprint(), code(), and postok() will fail. postok() will
+ also fail if you don't have permission to post.
+
+EOF
+
+for $f (qw(code ok okprint postok mode_reader list help)) {
print "not " unless $c->$f();
print "ok ", $i++, " ($f)\n";
}
+
# slave not supported by inn
skip_500_ok(\$i, $c, 'slave');
--
2.7.4

View File

@ -0,0 +1,72 @@
From 3f53b5fe72fe888ab953bea2eac49ec9def7c6ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 16 Nov 2016 13:28:26 +0100
Subject: [PATCH] Skip tests with unportable commands
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch skips unportable tests whose return code is 500. It usually
mean the server does not suport it.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
test.pl | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/test.pl b/test.pl
index 4f21575..26a100c 100644
--- a/test.pl
+++ b/test.pl
@@ -33,17 +33,32 @@ EOF
$i = 2;
+sub skip_500_ok {
+ my ($counter, $client, $function, @arguments) = @_;
+ my $status = $client->$function(@arguments);
+ my $code = $client->code();
+ if ($code != 500) {
+ print "not " unless $status;
+ print "ok ", ${$counter}++, " ($f)\n";
+ } else {
+ print "ok ", ${$counter}++, " # skip ($f is unsupported by the server)\n";
+ }
+}
+
$c = new News::NNTPClient;
$c->gmt(1);
$c->fourdigityear(1);
for $f (qw(version debug eol gmt fourdigityear message code
- ok okprint postok mode_reader list help slave)) {
+ ok okprint postok mode_reader list help)) {
print "not " unless $c->$f();
print "ok ", $i++, " ($f)\n";
}
+# slave not supported by inn
+skip_500_ok(\$i, $c, 'slave');
+
print <<EOF;
In addition to needing access to a news server, the following
@@ -99,12 +114,10 @@ EOF
# xpath xgtitle xhdr xpat xover xmotd xthread xindex xsearch
-print "not " unless $c->xpath($msgid);
-print "ok ", $i++, " (xpath $msgid)\n";
+skip_500_ok(\$i, $c, 'xpath', $msgid);
for $f (qw(xgtitle xhdr xpat xover xmotd xthread xindex xsearch)) {
- print "not " unless $c->$f();
- print "ok ", $i++, " ($f)\n";
+ skip_500_ok(\$i, $c, $f);
}
print <<EOF;
--
2.7.4

View File

@ -0,0 +1,72 @@
Name: perl-NNTPClient
Version: 0.37
Release: 5%{?dist}
Summary: Perl 5 module to talk to NNTP (RFC977) server
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/NNTPClient/
Source0: http://search.cpan.org/CPAN/authors/id/R/RV/RVA/NNTPClient-%{version}.tar.gz
# Skip unportable tests whose command is not supported by a server,
# CPAN RT#118794
Patch0: NNTPClient-0.37-Skip-tests-with-unportable-commands.patch
# Skip network tests by default, CPAN RT#118799, inn segfaults (bug #1395717)
Patch1: NNTPClient-0.37-Perform-network-tests-only-if-EXTENDED_TESTING-1.patch
BuildArch: noarch
BuildRequires: findutils
BuildRequires: make
BuildRequires: perl-interpreter
BuildRequires: perl-generators
BuildRequires: perl(ExtUtils::MakeMaker)
# Run-time:
BuildRequires: perl(:VERSION) >= 5.2.0
BuildRequires: perl(Carp)
BuildRequires: perl(Socket)
BuildRequires: perl(strict)
BuildRequires: perl(vars)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# Do not scan documentation for dependencies
%{?perl_default_filter}
%description
This module implements a client interface to NNTP, enabling a Perl 5
application to talk to NNTP servers. It uses the Object Oriented
Programming interface.
%prep
%setup -q -n NNTPClient-%{version}
%patch0 -p1
%patch1 -p1
%build
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%install
make pure_install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -delete
%{_fixperms} $RPM_BUILD_ROOT/*
%check
make test
%files
%doc demos README
%{perl_vendorlib}/*
%{_mandir}/man3/*
%changelog
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.37-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.37-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sun Jun 04 2017 Jitka Plesnikova <jplesnik@redhat.com> - 0.37-3
- Perl 5.26 rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.37-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Nov 11 2016 Petr Pisar <ppisar@redhat.com> 0.37-1
- Specfile autogenerated by cpanspec 1.78.