[2/2] gnu: ghc-process: Replace reference to /bin/sh.

Message ID 20161001155110.9024-2-rekado@elephly.net
State New
Headers

Commit Message

Ricardo Wurmus Oct. 1, 2016, 3:51 p.m. UTC
  * gnu/packages/haskell.scm (ghc-process)[arguments]: Add phases
"patch-reference-to-/bin/sh" to replace reference to /bin/sh.
---
 gnu/packages/haskell.scm | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Ludovic Courtès Oct. 2, 2016, 1:41 p.m. UTC | #1
Ricardo Wurmus <rekado@elephly.net> skribis:

> * gnu/packages/haskell.scm (ghc-process)[arguments]: Add phases
> "patch-reference-to-/bin/sh" to replace reference to /bin/sh.

OK!

[...]

> +;; Do not use this as an input.  It is part of GHC.
>  (define-public ghc-process

Should it be private then?

Ludo’.
  
Ricardo Wurmus Oct. 2, 2016, 3:03 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:

> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> * gnu/packages/haskell.scm (ghc-process)[arguments]: Add phases
>> "patch-reference-to-/bin/sh" to replace reference to /bin/sh.
>
> OK!
>
> [...]
>
>> +;; Do not use this as an input.  It is part of GHC.
>>  (define-public ghc-process
>
> Should it be private then?

People may want to install this package into a profile, but we as
packagers should make sure that we don’t use it as an input.  The same
applies to the “ghc-bytestring” package (and possibly others).

Using them as inputs results in two versions to be present at compile
time, with different packages using different versions.  GHC detects
this and issues warnings about this as it can lead to all sorts of
errors.

The importer should probably avoid adding standard packages to the
inputs.

~~ Ricardo
  

Patch

diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index d79dfd6..cf17c4f 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -6918,6 +6918,7 @@  supported.  A module of colour names (\"Data.Colour.Names\") is provided.")
 files and directories in a portable way.")
     (license license:bsd-3)))
 
+;; Do not use this as an input.  It is part of GHC.
 (define-public ghc-process
   (package
     (name "ghc-process")
@@ -6932,6 +6933,14 @@  files and directories in a portable way.")
         (base32
          "1v1bav5isqxq9fc4lw714x94qbfsjbm2nn12kjp69r1ql8jaaaqw"))))
     (build-system haskell-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-reference-to-/bin/sh
+           (lambda _
+             (substitute* "System/Process/Posix.hs"
+               (("/bin/sh") (which "sh")))
+             #t)))))
     (home-page "http://hackage.haskell.org/package/process")
     (synopsis "System process libraries")
     (description