--- Begin Message ---
Subject: |
[PATCH] Add a recursive version of mkdir-p |
Date: |
Thu, 22 Oct 2020 01:29:48 +0200 |
User-agent: |
Evolution 3.34.2 |
Dear guix,
I need this mkdir-p function in any non-trivial program I write. I had
3 bad choices:
1. Lobby guile to provide this function out of the box (this will take
time);
2. Copy that of guix, or gash, or any other: this does not seem
acceptable to me, because this function will surely evolve (for
instance, if guile gets suport for mingw and we start running guile
programs on windows) and I don't want to update more than one version
of this function;
3. Depend on guix, gash or another package: this would be too large a
dependency for my programs.
So I wrote it in its own package and I intend to depend on it for my
other projects. It would be best if you could accept this package in
guix proper.
What do you think?
Best regards,
divoplade
0001-Add-guile-mkdir-p.patch
Description: Text Data
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#44130] [PATCH] Add a recursive version of mkdir-p |
Date: |
Mon, 26 Oct 2020 17:57:50 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Hello!
divoplade <d@divoplade.fr> 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)))
--- End Message ---