Eric Bavier <ericbav...@gmail.com> skribis:

> 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

Oops.

> --- 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)

Please add a line break after the regexp.

>        (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))))

Are you sure the \n is no longer needed?  (I can never remember when it
is matched and when it’s not.)

OK to commit with \n correctly handled.

Thanks!

Ludo’.

Reply via email to