dev-perl/ParaDNS: EAPI6 + tests

- EAPI6ify
- Enable tests
- Fix compatibility with newer Net-DNS
- Fence tests under networkless environments

Package-Manager: Portage-2.3.18, Repoman-2.3.6
This commit is contained in:
Kent Fredric
2017-12-27 16:29:07 +13:00
parent b6d59dab56
commit df397e61bf
3 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
DIST_AUTHOR=MSERGEANT
DIST_VERSION=2.0
inherit perl-module
DESCRIPTION="a DNS lookup class for the Danga::Socket framework"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND="dev-perl/Net-DNS
>=dev-perl/Danga-Socket-1.61"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${PN}-2.0-net-dns-compat.patch"
"${FILESDIR}/${PN}-2.0-no-network.patch"
)

View File

@@ -0,0 +1,42 @@
From 0edb7527fb17c313c17c1c2572d9c454040677a2 Mon Sep 17 00:00:00 2001
From: Andy Jones <andy_jones@outgun.com>
Date: Thu, 28 Aug 2014 15:37:01 +0100
Subject: Support newer Net::DNS::Resolver
Bug: https://rt.cpan.org/Ticket/Display.html?id=98386
---
lib/ParaDNS/Resolver.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/ParaDNS/Resolver.pm b/lib/ParaDNS/Resolver.pm
index e147602..1a3f5dd 100644
--- a/lib/ParaDNS/Resolver.pm
+++ b/lib/ParaDNS/Resolver.pm
@@ -40,7 +40,7 @@ sub new {
}
}
else {
- foreach my $ns (@{ $res->{nameservers} }) {
+ foreach my $ns ( $res->nameservers ) {
trace(2, "Using nameserver $ns:$res->{port}\n");
my $dst_sockaddr = sockaddr_in($res->{'port'}, inet_aton($ns));
push @{$self->{dst}}, $dst_sockaddr;
@@ -216,7 +216,6 @@ sub event_read {
my $res = $self->{res};
while (my $packet = $res->bgread($sock)) {
- my $err = $res->errorstring;
my $answers = 0;
my $header = $packet->header;
my $id = $header->id;
@@ -278,6 +277,7 @@ sub event_read {
$answers++;
}
if (!$answers) {
+ my $err = $res->errorstring || $packet->header->rcode;
if ($err eq "NXDOMAIN") {
# trace("found => NXDOMAIN\n");
$qobj->run_callback("NXDOMAIN");
--
2.15.1

View File

@@ -0,0 +1,38 @@
From 257b6b9764858cdbca2e0d6b95e688bb92ae0b05 Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentnl@gentoo.org>
Date: Wed, 27 Dec 2017 16:19:05 +1300
Subject: Fence for NO_NETWORK_TESTING
---
t/00basic.t | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/t/00basic.t b/t/00basic.t
index e9ceaf5..108e0ec 100644
--- a/t/00basic.t
+++ b/t/00basic.t
@@ -1,10 +1,15 @@
#!/usr/bin/perl -w
-use Test::More tests => 5;
+
+use Test::More tests => 6;
$|++;
use_ok('ParaDNS');
+use_ok('ParaDNS::Resolver');
+
+SKIP: {
+ skip "NO_NETWORK_TESTING set", 4 if $ENV{NO_NETWORK_TESTING};
my $done = 0;
@@ -59,3 +64,4 @@ ParaDNS->new(
Danga::Socket->EventLoop;
+}
--
2.15.1