summary refs log tree commit diff
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-02-06 17:21:52 +0000
committerLudovic Courtès <ludo@gnu.org>2023-02-11 00:09:39 +0100
commitfb2bf136f0e27b2b6fd48fb3bb38c121f81af7f9 (patch)
tree3f5d33414975f0717bbbe638dafc24f7f9acff7b
parenta7e174a45894b34d154b8106a9ac55dd3e9413ef (diff)
downloadguix-fb2bf136f0e27b2b6fd48fb3bb38c121f81af7f9.tar.gz
gnu: ddclient: Update to 3.10.0.
3.10.0 switched to autotools based build system.

* gnu/packages/dns.scm (ddclient): Update to 3.10.0.
[source]: Patch test-suite to skip tests that require networking.
[build-system]: Switch to gnu-build-system.
[native-inputs]: Remove bash. Move perl to inputs.
[inputs]: Add perl, perl-io-socket-inet6, perl-json. Remove perl-data-validate-ip.
[native-search-paths]: Add $SSL_CERT_DIR, $SSL_CERT_FILE. Required for SSL support.
* gnu/packages/patches/ddclient-skip-test.patch: New file.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/dns.scm89
-rw-r--r--gnu/packages/patches/ddclient-skip-test.patch43
3 files changed, 82 insertions, 51 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 51dea859a3..b432a95026 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1033,6 +1033,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/dbus-c++-gcc-compat.patch		\
   %D%/packages/patches/dbus-c++-threading-mutex.patch		\
   %D%/packages/patches/dbxfs-remove-sentry-sdk.patch		\
+  %D%/packages/patches/ddclient-skip-test.patch			\
   %D%/packages/patches/debops-constants-for-external-program-names.patch \
   %D%/packages/patches/debops-debops-defaults-fall-back-to-less.patch \
   %D%/packages/patches/dee-vapi.patch			\
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index 6eac4fa542..aa44de2d65 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2020 Simon South <simon@simonsouth.net>
 ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -64,6 +65,7 @@
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages perl-check)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
@@ -81,6 +83,7 @@
   #:use-module (guix gexp)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
@@ -1098,7 +1101,7 @@ LuaJIT, both a resolver library and a daemon.")
 (define-public ddclient
   (package
     (name "ddclient")
-    (version "3.9.1")
+    (version "3.10.0")
     (source
      (origin
        (method git-fetch)
@@ -1107,62 +1110,46 @@ LuaJIT, both a resolver library and a daemon.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
-    (build-system trivial-build-system) ; no Makefile.PL
+        (base32 "0l87d72apwrg6ipc9gix5gv64d4hr1ykxmss8x4r8d8mgj6j8rf1"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; XXX: erroneous version value, this is fixed in master
+        #~(begin
+            (substitute* "configure.ac"
+              (("3.10.0_2") #$version))))
+       (patches (search-patches "ddclient-skip-test.patch"))))
+    (build-system gnu-build-system)
     (native-inputs
-     (list bash perl))
+     (list autoconf automake libtool
+           perl-test-warnings perl-test-mockmodule))
     (inputs
      (list inetutils ; logger
            net-tools
-           perl-data-validate-ip
+           bash-minimal                           ;for 'wrap-program'
+           perl
            perl-digest-sha1
-           perl-io-socket-ssl))
+           perl-io-socket-ssl
+           perl-io-socket-inet6  ;; XXX: this is likely to be removed in a future ddclient release
+                                 ;; https://github.com/ddclient/ddclient/issues/461
+           perl-json))
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (begin
-         (use-modules (guix build utils)
-                      (ice-9 match)
-                      (srfi srfi-26))
-         (setenv "PATH" (string-append
-                         (assoc-ref %build-inputs "bash") "/bin" ":"
-                         (assoc-ref %build-inputs "perl") "/bin"))
-
-         ;; Copy the (read-only) source into the (writable) build directory.
-         (copy-recursively (assoc-ref %build-inputs "source") ".")
-
-         ;; Install.
-         (let* ((out (assoc-ref %outputs "out"))
-                (bin (string-append out "/bin")))
-           (let ((file "ddclient"))
-             (substitute* file
-               (("/usr/bin/perl") (which "perl"))
-               ;; Strictly use ‘/etc/ddclient/ddclient.conf’.
-               (("\\$\\{program\\}\\.conf") "/etc/ddclient/ddclient.conf")
-               (("\\$etc\\$program.conf") "/etc/ddclient/ddclient.conf")
-               ;; Strictly use ‘/var/cache/ddclient/ddclient.cache’
-               (("\\$cachedir\\$program\\.cache")
-                "/var/cache/ddclient/ddclient.cache"))
-             (install-file file bin)
-             (wrap-program (string-append bin "/" file)
-               `("PATH" ":" =
-                 ("$PATH"
-                  ,@(map (lambda (input)
-                           (match input
-                                  ((name . store)
-                                   (string-append store "/bin"))))
-                         %build-inputs)))
-               `("PERL5LIB" ":" =
-                 ,(delete
-                   ""
-                   (map (match-lambda
-                         (((? (cut string-prefix? "perl-" <>) name) . dir)
-                          (string-append dir "/lib/perl5/site_perl"))
-                         (_ ""))
-                        %build-inputs)))))
-           (for-each (cut install-file <> (string-append out
-                                                         "/share/ddclient"))
-                     (find-files "." "sample.*$"))))))
+     (list
+      #:configure-flags #~(list "--localstatedir=/var")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            (lambda _
+              ;; XXX: Do not create /var
+              (invoke "make" "localstatedir=/tmp/discard" "install")))
+          (add-after 'wrap 'wrap-ddclient
+            (lambda* (#:key inputs #:allow-other-keys)
+              (wrap-program (string-append #$output "/bin/ddclient")
+                `("PERL5LIB" ":" prefix ,(string-split (getenv "PERL5LIB") #\:))
+                `("PATH" prefix ,(map (lambda (x)
+                                        (string-append (assoc-ref inputs x) "/bin"))
+                                      '("inetutils" "net-tools")))))))))
+    (native-search-paths
+     (list $SSL_CERT_DIR $SSL_CERT_FILE))
     (home-page "https://ddclient.net/")
     (synopsis "Address updating utility for dynamic DNS services")
     (description "This package provides a client to update dynamic IP
diff --git a/gnu/packages/patches/ddclient-skip-test.patch b/gnu/packages/patches/ddclient-skip-test.patch
new file mode 100644
index 0000000000..28d748997b
--- /dev/null
+++ b/gnu/packages/patches/ddclient-skip-test.patch
@@ -0,0 +1,43 @@
+From e5657802025f238b39581534f3b4d408565c8943 Mon Sep 17 00:00:00 2001
+From: Bruno Victal <mirai@makinata.eu>
+Date: Sun, 5 Feb 2023 21:05:00 +0000
+Subject: [PATCH] Disable sandbox incompatible tests.
+
+See: https://github.com/ddclient/ddclient/issues/465
+---
+ t/get_ip_from_if.pl | 21 ---------------------
+ 1 file changed, 21 deletions(-)
+
+diff --git a/t/get_ip_from_if.pl b/t/get_ip_from_if.pl
+index 6f08e5d..d78c3d0 100644
+--- a/t/get_ip_from_if.pl
++++ b/t/get_ip_from_if.pl
+@@ -39,25 +39,4 @@ subtest "get_ip_from_interface tests" => sub {
+     }
+ };
+ 
+-subtest "Get default interface and IP for test system" => sub {
+-    my $interface = ddclient::get_default_interface(4);
+-    if ($interface) {
+-        isnt($interface, "lo", "Check for loopback 'lo'");
+-        isnt($interface, "lo0", "Check for loopback 'lo0'");
+-        my $ip1 = ddclient::get_ip_from_interface("default", 4);
+-        my $ip2 = ddclient::get_ip_from_interface($interface, 4);
+-        is($ip1, $ip2, "Check IPv4 from default interface");
+-        ok(ddclient::is_ipv4($ip1), "Valid IPv4 from get_ip_from_interface($interface)");
+-    }
+-    $interface = ddclient::get_default_interface(6);
+-    if ($interface) {
+-        isnt($interface, "lo", "Check for loopback 'lo'");
+-        isnt($interface, "lo0", "Check for loopback 'lo0'");
+-        my $ip1 = ddclient::get_ip_from_interface("default", 6);
+-        my $ip2 = ddclient::get_ip_from_interface($interface, 6);
+-        is($ip1, $ip2, "Check IPv6 from default interface");
+-        ok(ddclient::is_ipv6($ip1), "Valid IPv6 from get_ip_from_interface($interface)");
+-    }
+-};
+-
+ done_testing();
+-- 
+2.38.1
+