diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-03-08 12:53:20 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-03-13 15:08:33 +0100 |
commit | eee95b5a879b7096dffd533f24107cf8926b621e (patch) | |
tree | b6cef032a6e3a103374bfd0cf47bf2ad8046ed0c /guix | |
parent | 5dd0d7f99f4a71a6ed4a2dab66d32e4b7ed2b70c (diff) |
packages: 'package-input-rewriting/spec' ignores hidden packages.
The primary motivation is to support things like:
guix build guix --with-input=guile=guile-next
without triggering a rebuild of (@@ (gnu packages commencement)
guile-final) and similar things.
It is also consistent with package name resolution on the command line:
a package that cannot be named cannot be replaced.
* guix/packages.scm (package-input-rewriting/spec)[rewrite]: When P is
hidden, return it as-is.
* tests/packages.scm ("package-input-rewriting/spec, hidden package"):
New test.
* doc/guix.texi (Defining Package Variants): Update.
(Package Transformation Options): Update '--with-input' example.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/packages.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index ca958c6eae..4c0c194652 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1533,9 +1533,11 @@ package and returns its new name after rewrite." (define* (package-input-rewriting/spec replacements #:key (deep? #t)) "Return a procedure that, given a package, applies the given REPLACEMENTS to all the package graph, including implicit inputs unless DEEP? is false. + REPLACEMENTS is a list of spec/procedures pair; each spec is a package specification such as \"gcc\" or \"guile@2\", and each procedure takes a -matching package and returns a replacement for that package." +matching package and returns a replacement for that package. Matching +packages that have the 'hidden?' property set are not replaced." (define table (fold (lambda (replacement table) (match replacement @@ -1563,7 +1565,8 @@ matching package and returns a replacement for that package." (gensym " package-replacement")) (define (rewrite p) - (if (assq-ref (package-properties p) replacement-property) + (if (or (assq-ref (package-properties p) replacement-property) + (hidden-package? p)) p (match (find-replacement p) (#f p) |