[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/03: packages: 'modify-inputs' preserves and introduces input labels i
From: |
guix-commits |
Subject: |
01/03: packages: 'modify-inputs' preserves and introduces input labels if needed. |
Date: |
Mon, 13 Dec 2021 12:31:13 -0500 (EST) |
civodul pushed a commit to branch core-updates-frozen
in repository guix.
commit aca2defe0172868295941fd9f0e97886f6e9b2d4
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Dec 13 17:43:02 2021 +0100
packages: 'modify-inputs' preserves and introduces input labels if needed.
Fixes a bug whereby, in an expression like this:
(modify-inputs lst
(delete ...)
(prepend ...))
the 'delete' clause would have no effect because 'prepend' would pass it
a label-less input list.
* guix/packages.scm (inputs-sans-labels): Remove.
(modify-inputs): In the 'prepend' and 'append' cases, preserve/add input
labels instead of removing them.
---
guix/packages.scm | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index b3c5a00..b00fa2f 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1083,13 +1083,6 @@ otherwise."
otherwise."
(lookup-input (package-direct-inputs package) name))
-(define (inputs-sans-labels inputs)
- "Return INPUTS stripped of any input labels."
- (map (match-lambda
- ((label obj) obj)
- ((label obj output) `(,obj ,output)))
- inputs))
-
(define (replace-input name replacement inputs)
"Replace input NAME by REPLACEMENT within INPUTS."
(map (lambda (input)
@@ -1124,7 +1117,10 @@ inputs of Coreutils and adds libcap:
(delete \"gmp\" \"acl\")
(append libcap))
-Other types of clauses include 'prepend' and 'replace'."
+Other types of clauses include 'prepend' and 'replace'.
+
+The first argument must be a labeled input list; the result is also a labeled
+input list."
;; Note: This macro hides the fact that INPUTS, as returned by
;; 'package-inputs' & co., is actually an alist with labels. Eventually,
;; it will operate on list of inputs without labels.
@@ -1135,10 +1131,10 @@ Other types of clauses include 'prepend' and 'replace'."
(modify-inputs (fold alist-delete inputs (list names ...))
clauses ...))
((_ inputs (prepend lst ...) clauses ...)
- (modify-inputs (append (list lst ...) (inputs-sans-labels inputs))
+ (modify-inputs (append (map add-input-label (list lst ...)) inputs)
clauses ...))
((_ inputs (append lst ...) clauses ...)
- (modify-inputs (append (inputs-sans-labels inputs) (list lst ...))
+ (modify-inputs (append inputs (map add-input-label (list lst ...)))
clauses ...))
((_ inputs (replace name replacement) clauses ...)
(modify-inputs (replace-input name replacement inputs)