guix build: Rewrite '--with-input' in terms of 'package-input-rewriting'.
* guix/scripts/build.scm (transform-package-inputs): Rewrite in terms of 'package-input-rewriting'.
This commit is contained in:
parent
2a75b0b63d
commit
4e49163f76
|
@ -193,33 +193,17 @@ of \"guile\"."
|
||||||
(map (lambda (spec)
|
(map (lambda (spec)
|
||||||
(match (string-tokenize spec not-equal)
|
(match (string-tokenize spec not-equal)
|
||||||
((old new)
|
((old new)
|
||||||
(cons old (specification->package new)))
|
(cons (specification->package old)
|
||||||
|
(specification->package new)))
|
||||||
(_
|
(_
|
||||||
(leave (_ "invalid replacement specification: ~s~%") spec))))
|
(leave (_ "invalid replacement specification: ~s~%") spec))))
|
||||||
replacement-specs))
|
replacement-specs))
|
||||||
|
|
||||||
(define (rewrite input)
|
(let ((rewrite (package-input-rewriting replacements)))
|
||||||
(match input
|
(lambda (store obj)
|
||||||
((label (? package? package) outputs ...)
|
(if (package? obj)
|
||||||
(match (assoc-ref replacements (package-name package))
|
(rewrite obj)
|
||||||
(#f (cons* label (replace package) outputs))
|
obj))))
|
||||||
(new (cons* label new outputs))))
|
|
||||||
(_
|
|
||||||
input)))
|
|
||||||
|
|
||||||
(define replace
|
|
||||||
(memoize ;XXX: use eq?
|
|
||||||
(lambda (p)
|
|
||||||
(package
|
|
||||||
(inherit p)
|
|
||||||
(inputs (map rewrite (package-inputs p)))
|
|
||||||
(native-inputs (map rewrite (package-native-inputs p)))
|
|
||||||
(propagated-inputs (map rewrite (package-propagated-inputs p)))))))
|
|
||||||
|
|
||||||
(lambda (store obj)
|
|
||||||
(if (package? obj)
|
|
||||||
(replace obj)
|
|
||||||
obj)))
|
|
||||||
|
|
||||||
(define %transformations
|
(define %transformations
|
||||||
;; Transformations that can be applied to things to build. The car is the
|
;; Transformations that can be applied to things to build. The car is the
|
||||||
|
|
Loading…
Reference in New Issue