guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] gnu-build-system: do not patch symlinks. Fixes location-awar


From: Jan Nieuwenhuizen
Subject: Re: [PATCH] gnu-build-system: do not patch symlinks. Fixes location-aware scripts.
Date: Tue, 09 Feb 2016 20:19:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Ludovic Courtès writes:

> Out of curiosity, what package was this?

I encountered it first in jison, a javascript parser generator.

> Since this is a rebuild-the-world change, I applied to to a new
> ‘core-updates’ branch (and adjusted the commit log.)

Yes, I got bitten by that, trying to test it.  I had an interesting
learning experience getting to know guix and getting this to work and
reverted to using

    (#phases
     (replace 'patch-source-shebangs
              ;;patch-source-shebangs-no-symlinks
              (lambda* (#:key outputs #:allow-other-keys)
                (for-each patch-shebang
                          (remove (lambda (file)
                                    (or (not (file-exists? file)) ;dangling 
symlink
                                        ;;(file-is-symlink? file)
                                        (and (file-exists? file)
                                             (eq? 'symlink (stat:type (lstat 
file))))
                                        (file-is-directory? file)))
                                  (find-files ".")))))

in the package itself.  Rebuilding the world is no fun when you want to
get things done.

When I actually got to test it, it appears that something like the above
is still necessary.  It seems that the previous patch merely avoids
visiting any symlinked directories, while this version actually looks
at the script to be patched.

Greetings, Jan

>From 5a1793944b6ba1368a355edfa5be1b5c542ba48c Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Sat, 6 Feb 2016 15:59:51 +0100
Subject: [PATCH] gnu-build-system: do not patch symlinks.  Fixes
 location-aware scripts.

* guix/build/gnu-build-system.scm (patch-shebangs): avoid patching symlinks.
  Fixes scripts
---
 guix/build/gnu-build-system.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 2abaa6e..34edff7 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -303,7 +303,7 @@ makefiles."
   (define (list-of-files dir)
     (map (cut string-append dir "/" <>)
          (or (scandir dir (lambda (f)
-                            (let ((s (stat (string-append dir "/" f))))
+                            (let ((s (lstat (string-append dir "/" f))))
                               (eq? 'regular (stat:type s)))))
              '())))
 
-- 
2.1.4

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

reply via email to

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