With the talk of potentially merging the core-updates branch, I thought
I should get this patch reviewed, since it triggers a full rebuild.

While working with some Imake-based packages recently, I found that
patch-makefile-SHELL did not like when the SHELL definition contained
arguments.  For example, one package would define::

  SHELL = /bin/sh -e

And patch-makefile-SHELL would turn that into::

  SHELL = /gnu/store/.../bin/bash
  -e

which Make would subsequently choke on.

Thoughts?

>From e1743a6de5b72cc7150c4e01e79a200e1667f627 Mon Sep 17 00:00:00 2001
From: Eric Bavier <[email protected]>
Date: Wed, 27 Aug 2014 10:26:54 -0500
Subject: [PATCH] utils: Preserve makefile shell arguments during patch.

* guix/build/utils.scm (patch-makefile-SHELL): Preserve shell arguments.
---
 guix/build/utils.scm |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 2f3dc9c..7ec44fd 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -582,14 +582,14 @@ When KEEP-MTIME? is true, the atime/mtime of FILE are kept unchanged."
 
   (let ((st (stat file)))
    (substitute* file
-     (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*" _ dir shell)
+     (("^ *SHELL[[:blank:]]*=[[:blank:]]*([[:graph:]]*/)([[:graph:]]+)[[:blank:]]*(.*)$" _ dir shell args)
       (let* ((old (string-append dir shell))
              (new (or (find-shell shell) old)))
         (unless (string=? new old)
           (format (current-error-port)
                   "patch-makefile-SHELL: ~a: changing `SHELL' from `~a' to `~a'~%"
                   file old new))
-        (string-append "SHELL = " new "\n"))))
+        (string-append "SHELL = " new " " args))))
 
    (when keep-mtime?
      (set-file-time file st))))
-- 
1.7.9.5

-- 
Eric Bavier

Reply via email to