guix-devel
[Top][All Lists]
Advanced

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

[PATCH] gnu: Remove redundancy where mkdir-p <dir> is followed by insta


From: Petter
Subject: [PATCH] gnu: Remove redundancy where mkdir-p <dir> is followed by install-file <file> <dir>.
Date: Sun, 20 Nov 2016 16:25:59 +0100

Hi.

Following up on an encouragement by Leo to remove a redundancy in the package
recipes.

In several places (mkdir-p) is used right before (install-file), to the same
directory. However, (install-file) does (mkdir-p) itself, which makes an
explicit (mkdir-p) redundant.


For reference:

=== guix/build/utils.scm ===
(define (install-file file directory)
"Create DIRECTORY if it does not exist and copy FILE in there under the same
name."
  (mkdir-p directory)
  (copy-file file (string-append directory "/" (basename file))))



I assume the (mkdir-p)s here could be removed as well.

=== gnu/packages/bioinformatics.scm ===
                (mkdir-p lib)
                (mkdir-p include)
                (for-each (cut install-file <> lib)
                          (find-files "." "\\.o$"))
                (for-each (cut install-file <> include)
                          (find-files "." "\\.hpp$")))


And this (mkdir-p).

=== gnu/packages/ocaml.scm ===
                 (mkdir-p doc)
                 ;; This file needs write-permissions, because it's
;; overwritten by 'docs' during documentation generation.
                 (chmod "src/strings.ml" #o600)
                 (and (zero? (system* "make" "docs"
                                      "TEXDIRECTIVES=\\\\draftfalse"))
                      (begin
                        (for-each (lambda (f)
                                    (install-file f doc))


I did not include them because they're not trivial (to me).



I have not build all the affected packages! It's all a little too much.
Hopefully, someone about to compile these packages can include this patch first.


Also, I'm inexperienced with this, so please be extra alert.


Best,
Petter


P.S. If it's of interest to anyone. I used this sed script to locate areas with
a possible redundant (mkdir-p):

sed -n '/mkdir-p/{ h; :a; /))))/!{n; H; ba;}; x; /install-file/{F; p;}; };'
gnu/packages/*.scm



reply via email to

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