all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
@ 2022-05-26 13:09 Attila Lendvai
  2022-05-26 13:13 ` [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2) Attila Lendvai
  2022-06-16 21:11 ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Attila Lendvai @ 2022-05-26 13:09 UTC (permalink / raw)
  To: 55659; +Cc: Attila Lendvai

Prior to this fix it has serialized "extra-options=..." into the ddclient.conf
file.

* gnu/services/dns.scm (serialize-field): Special case for extra-options.
(serialize-extra-options): Deleted unused function.
(ddclient-configuration): Change the type of the extra-options field to be a
string, and emit it verbatime into the ddclient.conf file. Change
docstring accordingly.
---

please note that even though this does fix an issue, i have abandoned
further work on ddclient. so, this is an improvement indeed, but i
suspect that this does not fully fix ddclient. looks like the conf
file format is different than what the current code emits.

the next patch updates ddclient to an RC2 of the next version,
which will be a major upgrade.

 gnu/services/dns.scm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 50753b7ab6..c2ede312e8 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -904,8 +904,11 @@ (define (uglify-field-name field-name)
   (string-delete #\? (symbol->string field-name)))
 
 (define (serialize-field field-name val)
-  (when (not (member field-name '(group secret-file user)))
-    (format #t "~a=~a\n" (uglify-field-name field-name) val)))
+  (cond
+   ((eq? field-name 'extra-options)
+    (display val))
+   ((not (member field-name '(group secret-file user)))
+    (format #t "~a=~a\n" (uglify-field-name field-name) val))))
 
 (define (serialize-boolean field-name val)
   (serialize-field field-name (if val "yes" "no")))
@@ -921,9 +924,6 @@ (define (serialize-string field-name val)
 (define (serialize-list field-name val)
   (if (null? val) "" (serialize-field field-name (string-join val))))
 
-(define (serialize-extra-options extra-options)
-  (string-join extra-options "\n" 'suffix))
-
 (define-configuration ddclient-configuration
   (ddclient
    (file-like ddclient)
@@ -959,8 +959,8 @@ (define-configuration ddclient-configuration
 file contains credentials for use by ddclient.  You are expected to create it
 manually.")
   (extra-options
-   (list '())
-   "Extra options will be appended to @file{ddclient.conf} file."))
+   (string "")
+   "Extra options will be appended verbatim to the @file{ddclient.conf} file."))
 
 (define (ddclient-account config)
   "Return the user accounts and user groups for CONFIG."
-- 
2.35.1





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2).
  2022-05-26 13:09 [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Attila Lendvai
@ 2022-05-26 13:13 ` Attila Lendvai
  2022-05-27 11:40   ` Attila Lendvai
  2022-06-17  5:38   ` [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Oleg Pykhalov
  2022-06-16 21:11 ` Ludovic Courtès
  1 sibling, 2 replies; 7+ messages in thread
From: Attila Lendvai @ 2022-05-26 13:13 UTC (permalink / raw)
  To: 55659; +Cc: Attila Lendvai

---

note that this seems to work, but is not fully tested. i have
abandoned the use of ddclient and with that this patchset.

also note that i'm not sure why the use of wrap-program is needed, but
without that it was missing some perl modules at runtime.

 gnu/packages/dns.scm | 76 ++++++++++++++++----------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)

diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index fea255c930..0430415b3f 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -64,6 +64,7 @@ (define-module (gnu packages dns)
   #: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)
@@ -1094,7 +1095,7 @@ (define-public knot-resolver
 (define-public ddclient
   (package
     (name "ddclient")
-    (version "3.9.1")
+    (version "3.10.0_2")
     (source
      (origin
        (method git-fetch)
@@ -1103,62 +1104,39 @@ (define-public ddclient
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0hf377g4j9r9sac75xp17nk2h58mazswz4vkg4g2gl2yyhvzq91w"))))
-    (build-system trivial-build-system) ; no Makefile.PL
+        (base32 "0jl658yr867y65hh054wg5gbzxsgpsf57qlc182ni4vwgqkrsrd1"))))
+    (build-system gnu-build-system)
     (native-inputs
-     (list bash perl))
+     (list bash autoconf automake
+           perl
+           ;; For the tests.
+           perl-try-tiny perl-test-warnings perl-http-daemon-ssl
+           perl-io-socket-inet6 perl-test-www-mechanize-psgi
+           perl-test-mockmodule))
     (inputs
      (list inetutils ; logger
            net-tools
+           perl
            perl-data-validate-ip
            perl-digest-sha1
            perl-io-socket-ssl))
     (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.*$"))))))
+     ;; The tests run mostly clean (6 failures), but I think they depend on
+     ;; the network config of the machine running them, so I turned them off.
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'change-dependencies
+           (lambda* (#:key native-inputs target #:allow-other-keys)
+             (substitute* "configure.ac"
+               (("HTTP::Daemon=6.12") "HTTP::Daemon=6.14"))))
+         (add-after 'install 'wrap-ddclient
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (wrap-program (string-append out "/bin/ddclient")
+                 `("PERL5LIB" ":" prefix
+                   (,(getenv "PERL5LIB")
+                    ,(string-append out "/lib/perl5/site_perl"))))))))))
     (home-page "https://ddclient.net/")
     (synopsis "Address updating utility for dynamic DNS services")
     (description "This package provides a client to update dynamic IP
-- 
2.35.1





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2).
  2022-05-26 13:13 ` [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2) Attila Lendvai
@ 2022-05-27 11:40   ` Attila Lendvai
  2022-06-17  5:38   ` [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Oleg Pykhalov
  1 sibling, 0 replies; 7+ messages in thread
From: Attila Lendvai @ 2022-05-27 11:40 UTC (permalink / raw)
  To: 55659

note: this requires https://issues.guix.gnu.org/55656

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“In a democracy, mass opinion creates power. Power diverts funds to the manufacturers of opinion, who manufacture more, etc. […] This feedback loop generates a playing field on which the most competitive ideas are not those which best correspond to reality, but those which produce the strongest feedback.”
	— Mencius Moldbug





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
  2022-05-26 13:09 [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Attila Lendvai
  2022-05-26 13:13 ` [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2) Attila Lendvai
@ 2022-06-16 21:11 ` Ludovic Courtès
  2022-06-17  8:53   ` Attila Lendvai
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2022-06-16 21:11 UTC (permalink / raw)
  To: Attila Lendvai; +Cc: 55659

Hi,

Attila Lendvai <attila@lendvai.name> skribis:

> Prior to this fix it has serialized "extra-options=..." into the ddclient.conf
> file.

[...]

>  (define (serialize-field field-name val)
> -  (when (not (member field-name '(group secret-file user)))
> -    (format #t "~a=~a\n" (uglify-field-name field-name) val)))
> +  (cond
> +   ((eq? field-name 'extra-options)
> +    (display val))
> +   ((not (member field-name '(group secret-file user)))
> +    (format #t "~a=~a\n" (uglify-field-name field-name) val))))
>  
>  (define (serialize-boolean field-name val)
>    (serialize-field field-name (if val "yes" "no")))
> @@ -921,9 +924,6 @@ (define (serialize-string field-name val)
>  (define (serialize-list field-name val)
>    (if (null? val) "" (serialize-field field-name (string-join val))))
>  
> -(define (serialize-extra-options extra-options)
> -  (string-join extra-options "\n" 'suffix))
> -
>  (define-configuration ddclient-configuration
>    (ddclient
>     (file-like ddclient)
> @@ -959,8 +959,8 @@ (define-configuration ddclient-configuration
>  file contains credentials for use by ddclient.  You are expected to create it
>  manually.")
>    (extra-options
> -   (list '())
> -   "Extra options will be appended to @file{ddclient.conf} file."))
> +   (string "")
> +   "Extra options will be appended verbatim to the @file{ddclient.conf} file."))

In other places, such as (gnu home services desktop), I’ve used an extra
‘raw-configuration-string’ field type to handle this cases.  This might
be clearer than adding the ‘cond’ above in ‘serialize-field’.  WDYT?

The change above also changes the interface (from list to string), but I
think that’s OK.

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
  2022-05-26 13:13 ` [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2) Attila Lendvai
  2022-05-27 11:40   ` Attila Lendvai
@ 2022-06-17  5:38   ` Oleg Pykhalov
  2022-06-17  8:26     ` Attila Lendvai
  1 sibling, 1 reply; 7+ messages in thread
From: Oleg Pykhalov @ 2022-06-17  5:38 UTC (permalink / raw)
  To: Attila Lendvai; +Cc: 55659

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

Hi,

Attila Lendvai <attila@lendvai.name> writes:

> note that this seems to work, but is not fully tested. i have
> abandoned the use of ddclient and with that this patchset.

I use it on my system, and could test it.

[…]

>      (native-inputs
> -     (list bash perl))
> +     (list bash autoconf automake
> +           perl
> +           ;; For the tests.
> +           perl-try-tiny perl-test-warnings perl-http-daemon-ssl
> +           perl-io-socket-inet6 perl-test-www-mechanize-psgi
> +           perl-test-mockmodule))

Applied on current master 6fc33d91ba6b07beae8a9a38a5b768511bb79ced:
--8<---------------cut here---------------start------------->8---
oleg@guixsd ~/src/guix [env]$ ./pre-inst-env guix build ddclient
gnu/packages/dns.scm:1113:44: In procedure native-inputs:
error: perl-http-daemon-ssl: unbound variable
hint: Did you forget a `use-modules' form?
--8<---------------cut here---------------end--------------->8---

Did you forget to attach a patch adding the perl-http-daemon-ssl?

[…]

Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
  2022-06-17  5:38   ` [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Oleg Pykhalov
@ 2022-06-17  8:26     ` Attila Lendvai
  0 siblings, 0 replies; 7+ messages in thread
From: Attila Lendvai @ 2022-06-17  8:26 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 55659

> Applied on current master 6fc33d91ba6b07beae8a9a38a5b768511bb79ced:
> --8<---------------cut here---------------start------------->8---
>
> oleg@guixsd ~/src/guix [env]$ ./pre-inst-env guix build ddclient
> gnu/packages/dns.scm:1113:44: In procedure native-inputs:
> error: perl-http-daemon-ssl: unbound variable
> hint: Did you forget a `use-modules' form?
> --8<---------------cut here---------------end--------------->8---
>
>
> Did you forget to attach a patch adding the perl-http-daemon-ssl?

forgot to say that this depends on https://issues.guix.gnu.org/55656

i was advised to split patchsets, but i think i really shouldn't have in this case.

sorry for the confusion, and thanks for testing it!

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“Without love the acquisition of knowledge only increases confusion and leads to self-destruction.”
	— Jiddu Krishnamurti (1895–1986)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization.
  2022-06-16 21:11 ` Ludovic Courtès
@ 2022-06-17  8:53   ` Attila Lendvai
  0 siblings, 0 replies; 7+ messages in thread
From: Attila Lendvai @ 2022-06-17  8:53 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 55659

> In other places, such as (gnu home services desktop), I’ve used an extra
> ‘raw-configuration-string’ field type to handle this cases. This might
> be clearer than adding the ‘cond’ above in ‘serialize-field’. WDYT?


i agree, it's a much better, more intuitive name. i'll use it from now on.

(note that i'm not planning to work on this more. i hope someone will pick this up who actually uses ddclient, and therefore has the ability to test it with little effort. feel free to close it, too.)

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There is no leader, there is no teacher, there is nobody to tell you what to do. You are alone in this mad, brutal world.”
	— Jiddu Krishnamurti (1895–1986)





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-17  8:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 13:09 [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Attila Lendvai
2022-05-26 13:13 ` [bug#55659] [PATCH 2/2] gnu: ddclient: Update to 3.10.0_2 (RC2) Attila Lendvai
2022-05-27 11:40   ` Attila Lendvai
2022-06-17  5:38   ` [bug#55659] [PATCH 1/2] services: ddclient: Fix extra-options serialization Oleg Pykhalov
2022-06-17  8:26     ` Attila Lendvai
2022-06-16 21:11 ` Ludovic Courtès
2022-06-17  8:53   ` Attila Lendvai

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.