From 2d17c6bd7c7dd466c0aee14beaa47055af0ceb6d Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 7 Feb 2016 16:45:25 +0100 Subject: [PATCH] build-system/gnu: Do not patch symlinks, v2. This fixes location-aware scripts. * guix/build/gnu-build-system.scm (file-is-symlink?): new function. (patch-source-shebangs): use it to skip symlinks. --- guix/build/gnu-build-system.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index 34edff7..427f020 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -166,6 +166,10 @@ things like the ABI being used." (find-files "." "^configure$"))) #t) +(define (file-is-symlink? file) + (and (file-exists? file) + (eq? 'symlink (stat:type (lstat file))))) + (define* (patch-source-shebangs #:key source #:allow-other-keys) "Patch shebangs in all source files; this includes non-executable files such as `.in' templates. Most scripts honor $SHELL and @@ -174,6 +178,7 @@ $CONFIG_SHELL, but some don't, such as `mkinstalldirs' or Automake's (for-each patch-shebang (remove (lambda (file) (or (not (file-exists? file)) ;dangling symlink + (file-is-symlink? file) (file-is-directory? file))) (find-files ".")))) -- 2.1.4