aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-18 23:28:54 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-19 23:35:41 +0200
commit9b762b8d7cd6b90bde5bc21c1d63601aad3d3885 (patch)
treed9123201d3d563581731c68fc00f5faff9fef049
parenteef4096c14568deae818287d23ad5da6a2f41d92 (diff)
downloadguix-9b762b8d7cd6b90bde5bc21c1d63601aad3d3885.tar
guix-9b762b8d7cd6b90bde5bc21c1d63601aad3d3885.tar.gz
system: Prefer packages from %FINAL-INPUTS.
* gnu/packages/base.scm (canonical-package): New procedure. * gnu/system.scm (%base-packages): Pass BASH, COREUTILS, FINDUTILS, GREP, and SED through 'canonical-package'.
-rw-r--r--gnu/packages/base.scm35
-rw-r--r--gnu/system.scm16
2 files changed, 45 insertions, 6 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index f14baa9409..c280cff198 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -42,6 +42,7 @@
#:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (ice-9 vlist)
#:use-module (ice-9 match))
;;; Commentary:
@@ -1204,6 +1205,40 @@ store.")
("gcc" ,gcc-final)
("libc" ,glibc-final))))
+(define-public canonical-package
+ (let ((name->package (fold (lambda (input result)
+ (match input
+ ((_ package)
+ (vhash-cons (package-full-name package)
+ package result))))
+ vlist-null
+ `(("guile" ,guile-final)
+ ,@%final-inputs))))
+ (lambda (package)
+ "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
+the implicit inputs of 'gnu-build-system', return that one, otherwise return
+PACKAGE.
+
+The goal is to avoid duplication in cases like GUILE-FINAL vs. GUILE-2.0,
+COREUTILS-FINAL vs. COREUTILS, etc."
+ ;; XXX: This doesn't handle dependencies of the final inputs, such as
+ ;; libunistring, GMP, etc.
+ (match (vhash-assoc (package-full-name package) name->package)
+ ((_ . canon)
+ ;; In general we want CANON, except if we're cross-compiling: CANON
+ ;; uses explicit inputs, so it is "anchored" in the bootstrapped
+ ;; process, with dependencies on things that cannot be
+ ;; cross-compiled.
+ (if (%current-target-system)
+ package
+ canon))
+ (_ package)))))
+
+
+;;;
+;;; GCC toolchain.
+;;;
+
(define (gcc-toolchain gcc)
"Return a complete toolchain for GCC."
(package
diff --git a/gnu/system.scm b/gnu/system.scm
index 4dc6ebd5a7..c2be74b6d5 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -216,12 +216,16 @@ explicitly appear in OS."
(define %base-packages
;; Default set of packages globally visible. It should include anything
;; required for basic administrator tasks.
- (list bash coreutils findutils grep sed
- procps psmisc less zile
- guile-final (@ (gnu packages admin) dmd) guix
- util-linux inetutils isc-dhcp
- net-tools ; XXX: remove when Inetutils suffices
- module-init-tools kbd))
+ (cons* procps psmisc less zile
+ guile-final (@ (gnu packages admin) dmd) guix
+ util-linux inetutils isc-dhcp
+ net-tools ; XXX: remove when Inetutils suffices
+ module-init-tools kbd
+
+ ;; The packages below are also in %FINAL-INPUTS, so take them from
+ ;; there to avoid duplication.
+ (map canonical-package
+ (list bash coreutils findutils grep sed))))
(define %default-issue
;; Default contents for /etc/issue.