From a2b89a3319dc1d621c546855f578acae5baaf6da Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 27 Jul 2022 15:18:51 -0400 Subject: services: configuration: Step back from *unspecified*. Fixes . This partially reverts 8cb1a49a3998c39f315a4199b7d4a121a6d66449. Rationale: *unspecified* cannot be serialized thus used as a G-Expression input, which is problematic/inconvenient when using deeply nested records. As an example, jami-service-type was broken when using partially defined records. * gnu/services/configuration.scm (define-maybe-helper): Check against the 'unset symbol. (normalize-field-type+def): Adjust value to 'unset. (define-configuration-helper): Use 'unset as the default value thunk. * gnu/services/file-sharing.scm (serialize-maybe-string): Check against the 'unset symbol. (serialize-maybe-file-object): Likewise. * gnu/services/messaging.scm (define-all-configurations): Use 'unset as value. (raw-content?): Check against 'unset symbol. (prosody-configuration)[http-max-content-size]: Default to 'unset. [http-external-url]: Likewise. [mod-muc]: Likewise. [raw-content]: Likewise. * gnu/services/networking.scm (opendht-configuration): Adjust documentation. * gnu/services/telephony.scm (jami-shepherd-services): Replace *undefined* with the 'unset symbol. * tests/services/configuration.scm ("maybe type, no default"): Check against the 'unset symbol. * doc/guix.texi: Regenerate the opendht-configuration, openvpn-client-configuration and openvpn-server-configuration documentation. --- gnu/services/configuration.scm | 11 +++++------ gnu/services/file-sharing.scm | 4 ++-- gnu/services/messaging.scm | 12 ++++++------ gnu/services/networking.scm | 6 +++--- gnu/services/telephony.scm | 6 +++--- 5 files changed, 19 insertions(+), 20 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index e3c101d042..3007e8de35 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017, 2018 Clément Lassieur ;;; Copyright © 2021 Xinglu Chen -;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos ;;; @@ -142,8 +142,7 @@ does not have a default value" field kind))) (id #'stem #'serialize-maybe- #'stem)))) #`(begin (define (maybe-stem? val) - (or (unspecified? val) - (stem? val))) + (or (eq? val 'unset) (stem? val))) #,@(if serialize? (list #'(define (serialize-maybe-stem field-name val) (if (stem? val) @@ -171,10 +170,10 @@ does not have a default value" field kind))) (values #'(field-type def))) ((field-type) (identifier? #'field-type) - (values #'(field-type *unspecified*))) + (values #'(field-type 'unset))) (field-type (identifier? #'field-type) - (values #'(field-type *unspecified*))))) + (values #'(field-type 'unset))))) (define (define-configuration-helper serialize? serializer-prefix syn) (syntax-case syn () @@ -262,7 +261,7 @@ does not have a default value" field kind))) (lambda () (display '#,(id #'stem #'% #'stem)) (if (eq? (syntax->datum field-default) - '*unspecified*) + 'unset) (configuration-missing-default-value '#,(id #'stem #'% #'stem) 'field) field-default))) diff --git a/gnu/services/file-sharing.scm b/gnu/services/file-sharing.scm index e32d1f145d..5df8b0d597 100644 --- a/gnu/services/file-sharing.scm +++ b/gnu/services/file-sharing.scm @@ -115,7 +115,7 @@ type generated and used by Transmission clients, suitable for passing to the (set! serialize-maybe-string (lambda (field-name val) (serialize-string field-name - (if (unspecified? val) + (if (eq? val 'unset) "" val)))) @@ -180,7 +180,7 @@ type generated and used by Transmission clients, suitable for passing to the (define-maybe file-object) (set! serialize-maybe-file-object (lambda (field-name val) - (if (unspecified? val) + (if (eq? val 'unset) (serialize-string field-name "") (serialize-file-object field-name val)))) diff --git a/gnu/services/messaging.scm b/gnu/services/messaging.scm index 651f90adb2..00a1c80a14 100644 --- a/gnu/services/messaging.scm +++ b/gnu/services/messaging.scm @@ -90,7 +90,7 @@ ((new-def ...) (map (lambda (def target) (if (eq? 'common (syntax->datum target)) - #'*unspecified* def)) + #''unset def)) #'(def ...) #'(target ...))) ((new-doc ...) (map (lambda (doc target) @@ -200,7 +200,7 @@ (define-maybe file-object-list) (define (raw-content? val) - (not (unspecified? val))) + (not (eq? val 'unset))) (define (serialize-raw-content field-name val) val) (define-maybe raw-content) @@ -474,12 +474,12 @@ by the Prosody service. See @url{https://prosody.im/doc/logging}." global) (http-max-content-size - (maybe-non-negative-integer *unspecified*) + (maybe-non-negative-integer 'unset) "Maximum allowed size of the HTTP body (in bytes)." common) (http-external-url - (maybe-string *unspecified*) + (maybe-string 'unset) "Some modules expose their own URL in various ways. This URL is built from the protocol, host and port used. If Prosody sits behind a proxy, the public URL will be @code{http-external-url} instead. See @@ -556,7 +556,7 @@ support. To add an external component, you simply fill the hostname field. See int-component) (mod-muc - (maybe-mod-muc-configuration *unspecified*) + (maybe-mod-muc-configuration 'unset) "Multi-user chat (MUC) is Prosody's module for allowing you to create hosted chatrooms/conferences for XMPP users. @@ -573,7 +573,7 @@ See also @url{https://prosody.im/doc/modules/mod_muc}." ext-component) (raw-content - (maybe-raw-content *unspecified*) + (maybe-raw-content 'unset) "Raw content that will be added to the configuration file." common))) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 3ddcdcc251..3c6395b6ca 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -772,11 +772,11 @@ logging is disabled.") network. A specific port value can be provided by appending the @code{:PORT} suffix. By default, it uses the Jami bootstrap nodes, but any host can be specified here. It's also possible to disable bootstrapping by explicitly -setting this field to the @code{*unspecified*} value.") +setting this field to the @code{'unset} value.") (port (maybe-number 4222) - "The UDP port to bind to. When set to @code{*unspecified*}, an available -port is automatically selected.") + "The UDP port to bind to. When left unspecified, an available port is +automatically selected.") (proxy-server-port maybe-number "Spawn a proxy server listening on the specified port.") diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm index e8bfbc88c5..7152f3b38d 100644 --- a/gnu/services/telephony.scm +++ b/gnu/services/telephony.scm @@ -307,7 +307,7 @@ CONFIG, a object." (dbus (jami-configuration-dbus config)) (dbus-daemon (file-append dbus "/bin/dbus-daemon")) (accounts (jami-configuration-accounts config)) - (declarative-mode? (not (unspecified? accounts)))) + (declarative-mode? (not (eq? 'unset accounts)))) (with-extensions (list guile-packrat ;used by guile-ac-d-bus guile-ac-d-bus @@ -649,7 +649,7 @@ argument, either a registered username or the fingerprint of the account.") account-details) (let ((username (archive-name->username archive))) - (when (not (unspecified? allowed-contacts)) + (when (not (eq? 'unset allowed-contacts)) ;; Reject calls from unknown contacts. (set-account-details '(("DHT.PublicInCalls" . "false")) username) @@ -659,7 +659,7 @@ argument, either a registered username or the fingerprint of the account.") ;; Add allowed ones. (for-each (cut add-contact <> username) allowed-contacts)) - (when (not (unspecified? moderators)) + (when (not (eq? 'unset moderators)) ;; Disable the 'AllModerators' property. (set-all-moderators #f username) ;; Remove all moderators. -- cgit v1.2.3