bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63082: [PATCH v3 07/16] services: mpd; Refactor start slot directory


From: Bruno Victal
Subject: bug#63082: [PATCH v3 07/16] services: mpd; Refactor start slot directory initialization.
Date: Wed, 24 May 2023 17:26:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1

On 2023-05-05 19:29, Maxim Cournoyer wrote:
> -                  (make-forkexec-constructor
> -                   (list #$(file-append package "/bin/mpd")
> -                         "--no-daemon"
> -                         #$config-file)
> -                   #:environment-variables '#$environment-variables)))
> +       (start
> +        (with-imported-modules (source-module-closure
> +                                '((gnu build activation)))

How about adding '(gnu build activation) into %default-imported-modules
(and %default-modules) at gnu/services/shepherd.scm?
Services should be using the start field to perform these kinds of tasks
anyways. (rather than extend activation-service-type which is incorrect use)

> +          #~(begin
> +              (use-modules (gnu build activation))

In general, rather than #~(begin (use-modules ...)), it's preferred to specify
additional modules using the 'modules' field e.g.

--8<---------------cut here---------------start------------->8---
(modules (cons '(gnu build activation)
                %default-modules))
--8<---------------cut here---------------end--------------->8---

> +
> +              (let ((user (getpw #$username)))
> +
> +                (define (init-directory directory)
> +                  (unless (file-exists? directory)
> +                    (mkdir-p/perms directory user #o755)))
> +
> +                (for-each
> +                 init-directory
> +                 '#$(map dirname
> +                         ;; XXX: Delete the potential "syslog"
> +                         ;; log-file value, which is not a directory.
> +                         (delete "syslog"
> +                                 (filter-map maybe-value
> +                                             (list db-file
> +                                                   log-file
> +                                                   state-file
> +                                                   sticker-file))))))

Perhaps treat “syslog” as a symbol instead?
Strings seem more adequate when the value is a path, with a symbol
being a sign that the value is to be treated “specially”.
(this aligns with how mympd handles this)


-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]