Subject: Re: [bug#44130] [PATCH] Add a recursive version of mkdir-p

From: Ludovic Courtès <[email-masked]>
Date: Mon, 26 Oct 2020 17:57:50 +0100

Hello!

divoplade <[email-masked]> skribis:

> Le vendredi 23 octobre 2020 à 18:37 +0200, Ludovic Courtès a écrit :
>> 
>> What I was questioning is the temptation to make one-function
>> packages
>> as is common for instance in npm.
>
> Ah, so I can summarize. My solutions are:
>
> 1. Guile provides mkdir-p: Perfect!

Yes, we can work towards that goal.

> 2. I put the function in a package: not great, but acceptable.
> 3. I depend on gash: not acceptable, there's only mkdir-p that's
> interesting, the rest is for advanced system tools.
> 4. I copy that function around: not acceptable.

I agree that #4 is suboptimal, but I think you’re overstating it.

> So, there's no temptation to make one-function packages.

Well…  :-)

> Should I understand that you question the integration of one-function
> packages into guix? If you don't want it in guix, then it's fine, I can
> just use it only for myself, I have my own channel. In which case,
> please just say so, so we can all move on to more interesting things.

No no, like I wrote, I’m fine adding the ‘mkdir-p’ package, no problem;
the project currently has no guideline against one-function packages.

Anyway, I’ve applied the patch with the cosmetic changes below.

Thanks!

Ludo’.

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index e3f547412b..d09e8d9737 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4016,12 +4016,14 @@ errors.")
        (method git-fetch)
        (uri (git-reference
              (url "https://code.divoplade.fr/mkdir-p.git")
-             (commit "83e955ba612369336a69fe50fe023ad14fbe5d7c")))
-       (sha256 (base32 "01k20rjcv6p0spmw8ls776aar6bfw0jxw46d2n12w0cb2p79xjv8"))
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "01k20rjcv6p0spmw8ls776aar6bfw0jxw46d2n12w0cb2p79xjv8"))
+       (file-name (git-file-name name version))
        (snippet
         `(begin
            (with-output-to-file ".tarball-version"
-             (lambda _ (format #t "~a~%" "1.0.1")))
+             (lambda _ (format #t "~a~%" ,version)))
            #t))))
     (build-system gnu-build-system)
     (arguments `())
@@ -4034,14 +4036,12 @@ errors.")
        ("pkg-config" ,pkg-config)
        ("gettext" ,gnu-gettext)))
     (inputs `(("guile" ,guile-3.0)))
-    (propagated-inputs
-     `(("guile" ,guile-3.0)))
-    (synopsis "Implementation of a recursive mkdir for guile")
+    (synopsis "Implementation of a recursive @code{mkdir} for Guile")
     (description
-     "This package provides within the (mkdir-p) module the mkdir-p function
-that tries to create the chain of directories recursively.  It also provides
-new versions of open-output-file, call-with-output-file and
-with-output-to-file to create the directory of its argument if it does not
-exist.")
+     "This package provides within the @code{(mkdir-p)} module the
+@code{mkdir-p} function that tries to create the chain of directories
+recursively.  It also provides new versions of @code{open-output-file},
+@code{call-with-output-file} and @code{with-output-to-file} to create the
+directory of its argument if it does not exist.")
     (home-page "https://mkdir-p.divoplade.fr")
     (license license:asl2.0)))