summaryrefslogtreecommitdiff
path: root/guix/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-12-05 16:32:40 +0100
committerLudovic Courtès <ludo@gnu.org>2017-12-05 16:32:40 +0100
commit91c9b5d016ac8bed127557d378c70fbc56cec0e5 (patch)
tree5f2b318d1a857f647406504b69f4122f072eb34a /guix/packages.scm
parentf3e3f4d934ee0ecd71f5c73a57252ed1d0bad88e (diff)
downloadgnu-guix-91c9b5d016ac8bed127557d378c70fbc56cec0e5.tar
gnu-guix-91c9b5d016ac8bed127557d378c70fbc56cec0e5.tar.gz
packages: 'package-grafts' trims native inputs.
'package-grafts' returns a list of potentially applicable grafts, which 'cumulative-grafts' then narrows by looking at store item references and determining the subset of the grafts that's actually applicable. Until now, 'package-grafts' would traverse native inputs and would thus return a large superset of the applicable grafts, since native inputs are not in the reference graph by definition. This patch fixes that by having 'package-grafts' ignore entirely native inputs from the dependency graph. * guix/packages.scm (fold-bag-dependencies)[bag-direct-inputs*]: Add special case for libc. * guix/packages.scm (bag-grafts)[native-grafts, target-grafts]: Remove. [grafts]: New procedure. Use it. * tests/packages.scm ("package-grafts, grafts of native inputs ignored"): New test.
Diffstat (limited to 'guix/packages.scm')
-rw-r--r--guix/packages.scm53
1 files changed, 31 insertions, 22 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index c6d3b811f2..490ec86906 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1004,7 +1004,21 @@ dependencies; otherwise, restrict to target dependencies."
(if (bag-target bag)
'()
(bag-host-inputs bag))))
- bag-host-inputs))
+ (lambda (bag)
+ (if (bag-target bag)
+ (bag-host-inputs bag)
+
+ ;; XXX: Currently libc wrongfully ends up in 'build-inputs',
+ ;; even tough it's something that's still referenced at run time
+ ;; and thus conceptually a 'host-inputs'. Because of that, we
+ ;; re-add it here.
+ (if (assoc-ref (bag-host-inputs bag) "libc")
+ (bag-host-inputs bag)
+ (append (let ((libc (assoc-ref (bag-build-inputs bag)
+ "libc")))
+ (or (and libc `(("libc" ,@libc)))
+ '()))
+ (bag-host-inputs bag)))))))
(define nodes
(match (bag-direct-inputs* bag)
@@ -1038,33 +1052,28 @@ to (see 'graft-derivation'.)"
(define system (bag-system bag))
(define target (bag-target bag))
- (define native-grafts
- (let ((->graft (input-graft store system)))
- (fold-bag-dependencies (lambda (package grafts)
- (match (->graft package)
- (#f grafts)
- (graft (cons graft grafts))))
- '()
- bag)))
-
- (define target-grafts
- (if target
- (let ((->graft (input-cross-graft store target system)))
- (fold-bag-dependencies (lambda (package grafts)
- (match (->graft package)
- (#f grafts)
- (graft (cons graft grafts))))
- '()
- bag
- #:native? #f))
- '()))
+ (define (grafts package->graft)
+ (fold-bag-dependencies (lambda (package grafts)
+ (match (package->graft package)
+ (#f grafts)
+ (graft (cons graft grafts))))
+ '()
+ bag
+
+ ;; Grafts that apply to native inputs do not matter
+ ;; since, by definition, native inputs are not
+ ;; referred to at run time. Thus, ignore
+ ;; 'native-inputs' and focus on the others.
+ #:native? #f))
;; We can end up with several identical grafts if we stumble upon packages
;; that are not 'eq?' but map to the same derivation (this can happen when
;; using things like 'package-with-explicit-inputs'.) Hence the
;; 'delete-duplicates' call.
(delete-duplicates
- (append native-grafts target-grafts)))
+ (if target
+ (grafts (input-cross-graft store target system))
+ (grafts (input-graft store system)))))
(define* (package-grafts store package
#:optional (system (%current-system))