From ebda5cdebae9e667c9be3ca7eab13598c0d26d85 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Tue, 24 Nov 2020 01:03:06 +0100 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/perl-Net-Ping.git#6ff68734c397c212b0370f292b642caba8db5c73 --- .gitignore | 1 + ...work-tests-with-NO_NETWORK_TESTING-1.patch | 143 ++++++++++++++++++ ...routable-addreses-for-negative-tests.patch | 102 +++++++++++++ README.md | 4 + perl-Net-Ping.spec | 90 +++++++++++ sources | 1 + 6 files changed, 341 insertions(+) create mode 100644 Net-Ping-2.74-Disable-all-network-tests-with-NO_NETWORK_TESTING-1.patch create mode 100644 Net-Ping-2.74-Use-non-routable-addreses-for-negative-tests.patch create mode 100644 README.md create mode 100644 perl-Net-Ping.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..45c4b72 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/Net-Ping-2.74.tar.gz diff --git a/Net-Ping-2.74-Disable-all-network-tests-with-NO_NETWORK_TESTING-1.patch b/Net-Ping-2.74-Disable-all-network-tests-with-NO_NETWORK_TESTING-1.patch new file mode 100644 index 0000000..05c71aa --- /dev/null +++ b/Net-Ping-2.74-Disable-all-network-tests-with-NO_NETWORK_TESTING-1.patch @@ -0,0 +1,143 @@ +From ab3c25e921e15aa2923d509a9317610a1e9f1d4e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 18 Nov 2020 08:42:00 +0100 +Subject: [PATCH 2/2] Disable all network tests with NO_NETWORK_TESTING=1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a host cannot resolve the host names, the tests fail like: + +getaddrinfo(www.google.com.,,AF_INET) failed - Temporary failure in name resolution at /builddir/build/BUILD/Net-Ping-2.74/blib/lib/Net/Ping.pm line 1925. + +The tests recommend setting PERL_CORE=1, but PERL_CORE has a different +meaning. + +This patch recognizes a NO_NETWORK_TESTING environment variable to +skip non-localhost tests. This is alike to Test::RequiresInternet. The +patch also coerces the remaining tests to use loopback addresses +instead. + +Signed-off-by: Petr Písař +--- + t/400_ping_syn.t | 11 +++++------ + t/410_syn_host.t | 11 +++++------ + t/420_ping_syn_port.t | 11 +++++------ + t/500_ping_icmp.t | 1 + + t/501_ping_icmpv6.t | 1 + + 5 files changed, 17 insertions(+), 18 deletions(-) + +diff --git a/t/400_ping_syn.t b/t/400_ping_syn.t +index 8409aae..4e22e7c 100644 +--- a/t/400_ping_syn.t ++++ b/t/400_ping_syn.t +@@ -1,11 +1,10 @@ + use strict; + + BEGIN { +- if ($ENV{PERL_CORE}) { +- unless ($ENV{PERL_TEST_Net_Ping}) { +- print "1..0 # Skip: network dependent test\n"; +- exit; +- } ++ if ($ENV{NO_NETWORK_TESTING} || ++ ($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) { ++ print "1..0 # Skip: network dependent test\n"; ++ exit; + } + unless (eval "require Socket") { + print "1..0 \# Skip: no Socket\n"; +@@ -30,7 +29,7 @@ BEGIN { + # connection to remote networks, but you still want the tests + # to pass, use the following: + # +-# $ PERL_CORE=1 make test ++# $ NO_NETWORK_TESTING=1 make test + + # Hopefully this is never a routeable host + my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; +diff --git a/t/410_syn_host.t b/t/410_syn_host.t +index 15948e2..5d58bda 100644 +--- a/t/410_syn_host.t ++++ b/t/410_syn_host.t +@@ -2,11 +2,10 @@ + use strict; + + BEGIN { +- if ($ENV{PERL_CORE}) { +- unless ($ENV{PERL_TEST_Net_Ping}) { +- print "1..0 # Skip: network dependent test\n"; +- exit; +- } ++ if ($ENV{NO_NETWORK_TESTING} || ++ ($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) { ++ print "1..0 # Skip: network dependent test\n"; ++ exit; + } + unless (eval "require Socket") { + print "1..0 \# Skip: no Socket\n"; +@@ -31,7 +30,7 @@ BEGIN { + # connection to remote networks, but you still want the tests + # to pass, use the following: + # +-# $ PERL_CORE=1 make test ++# $ NO_NETWORK_TESTING=1 make test + + # Try a few remote servers + my %webs; +diff --git a/t/420_ping_syn_port.t b/t/420_ping_syn_port.t +index 53c153f..6b8d19a 100644 +--- a/t/420_ping_syn_port.t ++++ b/t/420_ping_syn_port.t +@@ -2,11 +2,10 @@ + use strict; + + BEGIN { +- if ($ENV{PERL_CORE}) { +- unless ($ENV{PERL_TEST_Net_Ping}) { +- print "1..0 # Skip: network dependent test\n"; +- exit; +- } ++ if ($ENV{NO_NETWORK_TESTING} || ++ ($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) { ++ print "1..0 # Skip: network dependent test\n"; ++ exit; + } + unless (eval "require Socket") { + print "1..0 \# Skip: no Socket\n"; +@@ -31,7 +30,7 @@ BEGIN { + # connection to remote networks, but you still want the tests + # to pass, use the following: + # +-# $ PERL_CORE=1 make test ++# $ NO_NETWORK_TESTING=1 make test + + # Hopefully this is never a routeable host + my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; +diff --git a/t/500_ping_icmp.t b/t/500_ping_icmp.t +index dea6588..7e45cc4 100644 +--- a/t/500_ping_icmp.t ++++ b/t/500_ping_icmp.t +@@ -19,6 +19,7 @@ BEGIN { + } + + my $is_devel = $ENV{PERL_CORE} || -d ".git" ? 1 : 0; ++$ENV{TEST_PING_HOST} = "127.0.0.1" if $ENV{NO_NETWORK_TESTING}; + # Note this rawsocket test code is considered anti-social in p5p and was removed in + # their variant. + # See http://nntp.perl.org/group/perl.perl5.porters/240707 +diff --git a/t/501_ping_icmpv6.t b/t/501_ping_icmpv6.t +index 165824f..9b5b8b8 100644 +--- a/t/501_ping_icmpv6.t ++++ b/t/501_ping_icmpv6.t +@@ -19,6 +19,7 @@ BEGIN { + } + + my $is_devel = $ENV{PERL_CORE} || -d ".git" ? 1 : 0; ++$ENV{TEST_PING6_HOST} = "::1" if $ENV{NO_NETWORK_TESTING}; + if (!Net::Ping::_isroot()) { + my $file = __FILE__; + my $lib = $ENV{PERL_CORE} ? '-I../../lib' : '-Mblib'; +-- +2.25.4 + diff --git a/Net-Ping-2.74-Use-non-routable-addreses-for-negative-tests.patch b/Net-Ping-2.74-Use-non-routable-addreses-for-negative-tests.patch new file mode 100644 index 0000000..058ce6c --- /dev/null +++ b/Net-Ping-2.74-Use-non-routable-addreses-for-negative-tests.patch @@ -0,0 +1,102 @@ +From a42c6588e33a1d6d847b60ef3386bfd122ce030b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 18 Nov 2020 09:49:48 +0100 +Subject: [PATCH 1/2] Use non-routable addreses for negative tests +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch uses the addresses reserved for a documentation purpose +which should be unroutable instead of just a random address. + +Signed-off-by: Petr Písař +--- + t/190_alarm.t | 2 +- + t/200_ping_tcp.t | 2 +- + t/400_ping_syn.t | 2 +- + t/410_syn_host.t | 2 +- + t/420_ping_syn_port.t | 2 +- + t/501_ping_icmpv6.t | 2 +- + 6 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/t/190_alarm.t b/t/190_alarm.t +index 65276a2..f86305c 100644 +--- a/t/190_alarm.t ++++ b/t/190_alarm.t +@@ -29,7 +29,7 @@ use Test::More tests => 6; + BEGIN {use_ok 'Net::Ping'}; + + # Hopefully this is never a routeable host +-my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249"; ++my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; + + eval { + my $timeout = 11; +diff --git a/t/200_ping_tcp.t b/t/200_ping_tcp.t +index e2bfe18..8e8f56d 100644 +--- a/t/200_ping_tcp.t ++++ b/t/200_ping_tcp.t +@@ -18,7 +18,7 @@ BEGIN { + } + + # Hopefully this is never a routeable host +-my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249"; ++my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; + + # Remote network test using tcp protocol. + # +diff --git a/t/400_ping_syn.t b/t/400_ping_syn.t +index 1ccec9f..8409aae 100644 +--- a/t/400_ping_syn.t ++++ b/t/400_ping_syn.t +@@ -33,7 +33,7 @@ BEGIN { + # $ PERL_CORE=1 make test + + # Hopefully this is never a routeable host +-my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249"; ++my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; + + # Try a few remote servers + my %webs = ( +diff --git a/t/410_syn_host.t b/t/410_syn_host.t +index d84a7eb..15948e2 100644 +--- a/t/410_syn_host.t ++++ b/t/410_syn_host.t +@@ -37,7 +37,7 @@ BEGIN { + my %webs; + BEGIN { + # Hopefully this is never a routeable host +- my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249"; ++ my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; + + %webs = ( + $fail_ip => 0, +diff --git a/t/420_ping_syn_port.t b/t/420_ping_syn_port.t +index 55ee88a..53c153f 100644 +--- a/t/420_ping_syn_port.t ++++ b/t/420_ping_syn_port.t +@@ -34,7 +34,7 @@ BEGIN { + # $ PERL_CORE=1 make test + + # Hopefully this is never a routeable host +-my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249"; ++my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0"; + + # Try a few remote servers + my %webs; +diff --git a/t/501_ping_icmpv6.t b/t/501_ping_icmpv6.t +index 3d2b789..165824f 100644 +--- a/t/501_ping_icmpv6.t ++++ b/t/501_ping_icmpv6.t +@@ -59,7 +59,7 @@ SKIP: { + my $rightip = "2001:4860:4860::8888"; # pingable ip of google's dnsserver + # for a firewalled ipv6 network try an optional local ipv6 host + $rightip = $ENV{TEST_PING6_HOST} if $ENV{TEST_PING6_HOST}; +- my $wrongip = "2001:4860:4860::1234"; # non existing ip ++ my $wrongip = "2001:db8::"; # non existing ip + # diag "Pinging existing IPv6 "; + my $result = $p->ping($rightip); + if ($result == 1) { +-- +2.25.4 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9f365e4 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# perl-Net-Ping + +Net::Ping module contains methods to test the reachability of remote hosts on +a network. \ No newline at end of file diff --git a/perl-Net-Ping.spec b/perl-Net-Ping.spec new file mode 100644 index 0000000..9a1c8f1 --- /dev/null +++ b/perl-Net-Ping.spec @@ -0,0 +1,90 @@ +Name: perl-Net-Ping +Version: 2.74 +Release: 1%{?dist} +Summary: Check a remote host for reachability +License: GPL+ or Artistic +URL: https://metacpan.org/release/Net-Ping/ +Source0: https://cpan.metacpan.org/authors/id/R/RU/RURBAN/Net-Ping-%{version}.tar.gz +# Use trully non-routable address in tests, proposed to the upstream, +# +Patch0: Net-Ping-2.74-Use-non-routable-addreses-for-negative-tests.patch +# Disable Internet tests with NO_NETWORK_TESTING, bug #1898132, +# proposed to the upstream, +Patch1: Net-Ping-2.74-Disable-all-network-tests-with-NO_NETWORK_TESTING-1.patch +BuildArch: noarch +BuildRequires: coreutils +BuildRequires: make +BuildRequires: perl-generators +BuildRequires: perl-interpreter +BuildRequires: perl(:VERSION) >= 5.2 +BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 +BuildRequires: perl(strict) +BuildRequires: perl(warnings) +# Run-time: +BuildRequires: perl(Carp) +BuildRequires: perl(constant) +BuildRequires: perl(Exporter) +BuildRequires: perl(Fcntl) +BuildRequires: perl(FileHandle) +BuildRequires: perl(IO::Socket::INET) +# Net::Ping::External not used at tests +BuildRequires: perl(POSIX) +BuildRequires: perl(Socket) >= 2.007 +BuildRequires: perl(Time::HiRes) +BuildRequires: perl(vars) +# Win32 not used on Linux +# Tests: +BuildRequires: perl(Config) +BuildRequires: perl(Cwd) +BuildRequires: perl(File::Spec) +BuildRequires: perl(Test::More) +# sudo not used +# Optional tests: +BuildRequires: perl(:VERSION) >= 5.6 +# Class::XSAccessor not used +BuildRequires: perl(IO::Socket) +# List::MoreUtils not used +# Module::CPANTS::Kwalitee::Uses not used +# Text::CSV_XS not used +# Test::CPAN::Meta not used +# Test::Kwalitee not used +BuildRequires: perl(Test::Pod) >= 1.22 +# Test::Pod::Coverage not used +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +Requires: perl(IO::Socket::INET) +# Keep Net::Ping::External optional +Suggests: perl(Net::Ping::External) +Conflicts: perl < 4:5.22.0-350 + +%description +Net::Ping module contains methods to test the reachability of remote hosts on +a network. + +%prep +%setup -q -n Net-Ping-%{version} +%patch0 -p1 +%patch1 -p1 + +%build +unset PERL_CORE +perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 +%{make_build} + +%install +%{make_install} +%{_fixperms} $RPM_BUILD_ROOT/* + +%check +unset AUTHOR_TESTING IS_MAINTAINER NET_PING_FAIL_IP PERL_TEST_Net_Ping \ + TEST_PING_HOST TEST_PING6_HOST +export NO_NETWORK_TESTING=1 +make test + +%files +%doc Changes README TODO +%{perl_vendorlib}/* +%{_mandir}/man3/* + +%changelog +* Mon Nov 16 2020 Petr Pisar 2.74-1 +- Specfile autogenerated by cpanspec 1.78. diff --git a/sources b/sources new file mode 100644 index 0000000..ca942d0 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (Net-Ping-2.74.tar.gz) = 780f390525013fd5e681f4a783e8057a1b8608db7bc7e67da3585da081a2d3e812f422fd564dbf0db53d3091efa38e61a3668f4431410bb4444091a8f66a5f1f