guix-commits
[Top][All Lists]
Advanced

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

02/02: build-system/gnu: Do not patch symlinks in the source.


From: Ludovic Courtès
Subject: 02/02: build-system/gnu: Do not patch symlinks in the source.
Date: Mon, 12 Sep 2016 19:56:36 +0000 (UTC)

civodul pushed a commit to branch core-updates
in repository guix.

commit 5c9632c75afd57f2ee2d9ee7467ba9abcd2cb292
Author: Ludovic Courtès <address@hidden>
Date:   Mon Sep 12 21:51:25 2016 +0200

    build-system/gnu: Do not patch symlinks in the source.
    
    This is a followup to 13a9feb5b64fd819eaed38a17da0284bbe2b8d9.
    
    * guix/build/gnu-build-system.scm (patch-source-shebangs): Remove call
    to 'remove'.  Pass a second argument to 'find-files' to filter out
    symlinks; pass #:stat lstat.
    (patch-generated-file-shebangs): Likewise, and also filter out
    non-executable files.
---
 guix/build/gnu-build-system.scm |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index ab97c92..93ddc9a 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -172,22 +172,23 @@ files such as `.in' templates.  Most scripts honor $SHELL 
and
 $CONFIG_SHELL, but some don't, such as `mkinstalldirs' or Automake's
 `missing' script."
   (for-each patch-shebang
-            (remove (lambda (file)
-                      (or (not (file-exists? file)) ;dangling symlink
-                          (file-is-directory? file)))
-                    (find-files "."))))
+            (find-files "."
+                        (lambda (file stat)
+                          ;; Filter out symlinks.
+                          (eq? 'regular (stat:type stat)))
+                        #:stat lstat)))
 
 (define (patch-generated-file-shebangs . rest)
   "Patch shebangs in generated files, including `SHELL' variables in
 makefiles."
-  ;; Patch executable files, some of which might have been generated by
-  ;; `configure'.
+  ;; Patch executable regular files, some of which might have been generated
+  ;; by `configure'.
   (for-each patch-shebang
-            (filter (lambda (file)
-                      (and (file-exists? file)
-                           (executable-file? file)
-                           (not (file-is-directory? file))))
-                    (find-files ".")))
+            (find-files "."
+                        (lambda (file stat)
+                          (and (eq? 'regular (stat:type stat))
+                               (not (zero? (logand (stat:mode stat) #o100)))))
+                        #:stat lstat))
 
   ;; Patch `SHELL' in generated makefiles.
   (for-each patch-makefile-SHELL (find-files "." "^(GNU)?[mM]akefile$")))



reply via email to

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