diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-08-25 13:12:33 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-08-25 13:12:45 +0200 |
commit | 8773648e35b18b2f4b29e43258d1eb38b792f27c (patch) | |
tree | 6ce80c30be2f529edef04871c1af6b5876002b19 | |
parent | 22b5d9c9a5736b4fac7ddfb33a24c3481920fa4f (diff) | |
download | guix-8773648e35b18b2f4b29e43258d1eb38b792f27c.tar.gz guix-8773648e35b18b2f4b29e43258d1eb38b792f27c.zip |
utils: Change `substitute*' to accept a list of files to patch.
* guix/build/utils.scm (substitute*): Support a list of files as the
first argument.
-rw-r--r-- | guix/build/utils.scm | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 7e572c0388..13ea4b82d8 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -210,10 +210,9 @@ as (PROC MATCH OUTPUT-PORT)." ((let-matches index match () body ...) (begin body ...)))) -(define-syntax-rule (substitute* file - ((regexp match-var ...) body ...) - ...) - "Substitute REGEXP in FILE by the string returned by BODY. BODY is +(define-syntax substitute* + (syntax-rules () + "Substitute REGEXP in FILE by the string returned by BODY. BODY is evaluated with each MATCH-VAR bound to the corresponding positional regexp sub-expression. For example: @@ -230,12 +229,17 @@ bound to the last one. When one of the MATCH-VAR is `_', no variable is bound to the corresponding match substring." - (substitute file - (list (cons regexp - (lambda (m p) - (let-matches 0 m (match-var ...) - (display (begin body ...) p)))) - ...))) + ((substitute* (file ...) clause ...) + (begin + (substitute* file clause ...) + ...)) + ((substitute* file ((regexp match-var ...) body ...) ...) + (substitute file + (list (cons regexp + (lambda (m p) + (let-matches 0 m (match-var ...) + (display (begin body ...) p)))) + ...))))) ;;; |