summary refs log tree commit diff
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2016-07-28 23:38:20 +0200
committerLeo Famulari <leo@famulari.name>2016-08-08 22:36:36 -0400
commit8d60dd71745d8e76df408378e56f8cfdcf0122c5 (patch)
treeb7a6acf417b5a8f548b6cedb10601c13de567389
parent87b14091409f2d2ea7bec39edb6e727d6df909a3 (diff)
downloadguix-8d60dd71745d8e76df408378e56f8cfdcf0122c5.tar.gz
gnu: Add perl-net-dns-resolver-programmable.
* gnu/packages/networking.scm (perl-net-dns-resolver-programmable): New variable.
* gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Signed-off-by: Leo Famulari <leo@famulari.name>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/networking.scm29
-rw-r--r--gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch30
3 files changed, 60 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 7630b2d238..8eb29719c5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -704,6 +704,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch \
   %D%/packages/patches/perl-net-amazon-s3-moose-warning.patch	\
   %D%/packages/patches/perl-net-ssleay-disable-ede-test.patch	\
+  %D%/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch	\
   %D%/packages/patches/perl-no-build-time.patch			\
   %D%/packages/patches/perl-no-sys-dirs.patch			\
   %D%/packages/patches/perl-module-pluggable-search.patch	\
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 98ac87a54e..8b0a28591c 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -30,6 +30,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages adns)
   #:use-module (gnu packages algebra)
@@ -469,3 +470,31 @@ application stack itself.")
   (description "Socket6 binds the IPv6 related part of the C socket header
 definitions and structure manipulators for Perl.")
   (license license:bsd-3)))
+
+(define-public perl-net-dns-resolver-programmable
+ (package
+  (name "perl-net-dns-resolver-programmable")
+  (version "v0.003")
+  (source
+    (origin
+      (method url-fetch)
+      (uri (string-append
+             "mirror://cpan/authors/id/J/JM/JMEHNLE/net-dns-resolver-programmable/"
+             "Net-DNS-Resolver-Programmable-" version ".tar.gz"))
+      (sha256
+        (base32
+          "1v3nl2kaj4fs55n1617n53q8sa3mir06898vpy1rq98zjih24h4d"))
+      (patches
+        (search-patches
+          "perl-net-dns-resolver-programmable-Fix-broken-interface.patch"))))
+  (build-system perl-build-system)
+  (native-inputs
+    `(("perl-module-build" ,perl-module-build)))
+  (inputs `(("perl-net-dns" ,perl-net-dns)))
+  (home-page
+    "http://search.cpan.org/dist/Net-DNS-Resolver-Programmable")
+  (synopsis
+    "Programmable DNS resolver class for offline emulation of DNS")
+  (description "Net::DNS::Resolver::Programmable is a programmable DNS resolver for
+offline emulation of DNS.")
+  (license (package-license perl))))
diff --git a/gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch b/gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch
new file mode 100644
index 0000000000..371693dca1
--- /dev/null
+++ b/gnu/packages/patches/perl-net-dns-resolver-programmable-Fix-broken-interface.patch
@@ -0,0 +1,30 @@
+perl-net-dns-resolver-programmable used the undocumented and internal
+method Net::DNS::rcodesbyname [0], and that interface is no longer
+exposed.
+
+This patch, copied from [1], makes the program check for the existence
+of the method before trying to use it.
+
+[0]
+<https://rt.cpan.org/Public/Bug/Display.html?id=95901>
+
+[1]
+<https://rt.cpan.org/Public/Bug/Display.html?id=95901#txn-1575108>
+
+diff --git a/lib/Net/DNS/Resolver/Programmable.pm b/lib/Net/DNS/Resolver/Programmable.pm
+index 1af72ce..e09a2f0 100644
+--- a/lib/Net/DNS/Resolver/Programmable.pm
++++ b/lib/Net/DNS/Resolver/Programmable.pm
+@@ -203,8 +203,10 @@ sub send {
+     if (defined(my $resolver_code = $self->{resolver_code})) {
+         ($result, $aa, @answer_rrs) = $resolver_code->($domain, $rr_type, $class);
+     }
+-    
+-    if (not defined($result) or defined($Net::DNS::rcodesbyname{$result})) {
++
++    if (not defined($result)
++         or defined($Net::DNS::Parameters::rcodebyname{$result})
++         or defined($Net::DNS::rcodesbyname{$result})) {
+         # Valid RCODE, return a packet:
+         
+         $aa     = TRUE      if not defined($aa);