mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
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.
This commit is contained in:
parent
22b5d9c9a5
commit
8773648e35
1 changed files with 14 additions and 10 deletions
|
@ -210,10 +210,9 @@ (define-syntax let-matches
|
||||||
((let-matches index match () body ...)
|
((let-matches index match () body ...)
|
||||||
(begin body ...))))
|
(begin body ...))))
|
||||||
|
|
||||||
(define-syntax-rule (substitute* file
|
(define-syntax substitute*
|
||||||
((regexp match-var ...) body ...)
|
(syntax-rules ()
|
||||||
...)
|
"Substitute REGEXP in FILE by the string returned by BODY. BODY is
|
||||||
"Substitute REGEXP in FILE by the string returned by BODY. BODY is
|
|
||||||
evaluated with each MATCH-VAR bound to the corresponding positional regexp
|
evaluated with each MATCH-VAR bound to the corresponding positional regexp
|
||||||
sub-expression. For example:
|
sub-expression. For example:
|
||||||
|
|
||||||
|
@ -230,12 +229,17 @@ (define-syntax-rule (substitute* file
|
||||||
|
|
||||||
When one of the MATCH-VAR is `_', no variable is bound to the corresponding
|
When one of the MATCH-VAR is `_', no variable is bound to the corresponding
|
||||||
match substring."
|
match substring."
|
||||||
(substitute file
|
((substitute* (file ...) clause ...)
|
||||||
(list (cons regexp
|
(begin
|
||||||
(lambda (m p)
|
(substitute* file clause ...)
|
||||||
(let-matches 0 m (match-var ...)
|
...))
|
||||||
(display (begin body ...) p))))
|
((substitute* file ((regexp match-var ...) body ...) ...)
|
||||||
...)))
|
(substitute file
|
||||||
|
(list (cons regexp
|
||||||
|
(lambda (m p)
|
||||||
|
(let-matches 0 m (match-var ...)
|
||||||
|
(display (begin body ...) p))))
|
||||||
|
...)))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Reference in a new issue