[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] utils: Preserve makefile shell arguments during patch.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] utils: Preserve makefile shell arguments during patch. |
Date: |
Thu, 28 Aug 2014 13:44:23 +0200 |
User-agent: |
Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux) |
Eric Bavier <address@hidden> 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’.