gnu: node: Make sure 'npm' remains a symlink after 'patch-shebangs'.

Fixes <http://bugs.gnu.org/23744>.
Reported by Jovany Leandro G.C <bit4bit@riseup.net>
and Jelle Licht <jlicht@fsfe.org>.

* gnu/packages/node.scm (node)[arguments]: Replace 'patch-shebangs'
phase.
This commit is contained in:
Ludovic Courtès 2016-06-29 10:02:58 +02:00
parent c2c36f5fab
commit 2de091f0c8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 18 additions and 1 deletions

View File

@ -2,6 +2,7 @@
;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com> ;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org> ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -99,7 +100,23 @@
(zero? (apply system* (zero? (apply system*
(string-append (assoc-ref inputs "python") (string-append (assoc-ref inputs "python")
"/bin/python") "/bin/python")
"configure" flags)))))))) "configure" flags)))))
(replace 'patch-shebangs
(lambda* (#:key outputs #:allow-other-keys #:rest all)
;; Work around <http://bugs.gnu.org/23723>.
(let* ((patch (assoc-ref %standard-phases 'patch-shebangs))
(npm (string-append (assoc-ref outputs "out")
"/bin/npm"))
(target (readlink npm)))
(and (apply patch all)
(with-directory-excursion (dirname npm)
;; Turn NPM into a symlink to TARGET again, which 'npm'
;; relies on for the resolution of relative file names
;; in JS files.
(delete-file target)
(rename-file npm target)
(symlink target npm)
#t))))))))
(native-inputs (native-inputs
`(("python" ,python-2) `(("python" ,python-2)
("perl" ,perl) ("perl" ,perl)