guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/3] support: Rename user-dmddir to %user-shepherd-dir.


From: Mathieu Lirzin
Subject: Re: [PATCH 3/3] support: Rename user-dmddir to %user-shepherd-dir.
Date: Sun, 17 Jan 2016 15:05:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Mathieu Lirzin <address@hidden> writes:

> * modules/shepherd/support.scm (user-dmddir): Rename to ...
> (%user-shepherd-dir): ... this.  Honor XDG variables and use
> '~/.config/shepherd' as default value.  All consumers changed.
> (mkdir-p): New procedure.  Export it.
> (default-config-file): Use it.
> (verify-dir): Likewise.
> ---
>  modules/shepherd/support.scm | 45 
> ++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 37 insertions(+), 8 deletions(-)
[...]
> +(define* (mkdir-p dir #:optional (mode (umask))) ;copied from Guix
                         ^^^
                         not in Guix yet.
> +  "Create directory DIR and all its ancestors."
> +  (define absolute?
> +    (string-prefix? "/" dir))
> +
> +  (define not-slash
> +    (char-set-complement (char-set #\/)))
> +
> +  (let loop ((components (string-tokenize dir not-slash))
> +             (root       (if absolute?
> +                             ""
> +                             ".")))
> +    (match components
> +      ((head tail ...)
> +       (let ((path (string-append root "/" head)))
> +         (catch 'system-error
> +           (lambda ()
> +             (mkdir path mode)
> +             (loop tail path))
> +           (lambda args
> +             (if (= EEXIST (system-error-errno args))
> +                 (loop tail path)
> +                 (apply throw args))))))
> +      (() #t))))

I have tried to apply this change (add an optional parameter) on top of
Guix, but it produces a ton of failures for ‘make check’ :).

So my conclusion is that it is not possible to set a default value. So I
think it required to do something like:

  (define* (mkdir-p dir #:optional mode)
    ...
    (if mode
        (mkdir path mode)
        (mkdir path))
    ...)

Am I correct?

--
Mathieu Lirzin



reply via email to

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