diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-09-02 15:39:50 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-09-02 15:39:50 +0200 |
commit | 072e10615fc786db02dc44f3cd5f25aed2969111 (patch) | |
tree | dbae10eaf8cf13a28c0151a418971fb770243eda /guix/packages.scm | |
parent | 3964e358ab65dfd157427560bfb44de8a150068b (diff) | |
parent | 135ba811c6f55c22bfa8969143d83e7fdf166763 (diff) | |
download | gnu-guix-072e10615fc786db02dc44f3cd5f25aed2969111.tar gnu-guix-072e10615fc786db02dc44f3cd5f25aed2969111.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/packages.scm')
-rw-r--r-- | guix/packages.scm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index 728b3afcae..52204b1e09 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -95,6 +95,7 @@ package-transitive-propagated-inputs package-transitive-native-search-paths package-transitive-supported-systems + package-input-rewriting package-source-derivation package-derivation package-cross-derivation @@ -735,6 +736,35 @@ dependencies are known to build on SYSTEM." "Return the \"target inputs\" of BAG, recursively." (transitive-inputs (bag-target-inputs bag))) +(define* (package-input-rewriting replacements + #:optional (rewrite-name identity)) + "Return a procedure that, when passed a package, replaces its direct and +indirect dependencies (but not its implicit inputs) according to REPLACEMENTS. +REPLACEMENTS is a list of package pairs; the first element of each pair is the +package to replace, and the second one is the replacement. + +Optionally, REWRITE-NAME is a one-argument procedure that takes the name of a +package and returns its new name after rewrite." + (define (rewrite input) + (match input + ((label (? package? package) outputs ...) + (match (assq-ref replacements package) + (#f (cons* label (replace package) outputs)) + (new (cons* label new outputs)))) + (_ + input))) + + (define-memoized/v (replace p) + "Return a variant of P with its inputs rewritten." + (package + (inherit p) + (name (rewrite-name (package-name p))) + (inputs (map rewrite (package-inputs p))) + (native-inputs (map rewrite (package-native-inputs p))) + (propagated-inputs (map rewrite (package-propagated-inputs p))))) + + replace) + ;;; ;;; Package derivations. |