From 49c35bbb71f80bdd7c01b4d74e08335c3ec5331c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 7 Jan 2019 22:57:34 +0100 Subject: self: Move all modules into a single directory. This halves the number of elements in %LOAD-PATH and %LOAD-COMPILED-PATH and halves the number of 'stat' calls as reported by: env -i $(type -P guix) build -e '(@ (gnu packages base) coreutils)' -nd * guix/self.scm (node-source+compiled, guile-module-union): New procedures. (guix-command): Remove 'compiled-modules' parameter. Remove 'source-directories' and 'object-directories' variables and add 'module-directory'. Change command so that it adds nothing but MODULE-DIRECTORY to %LOAD-PATH and %LOAD-COMPILED-PATH. (whole-package): Remove #:compiled-modules. Assume MODULES contains 'share/guile/site' and 'lib/guile' and adjust code accordingly. (compiled-guix): When PULL-VERSION is 1, use 'node-source+compiled' only. Remove #:compiled-modules argument to 'whole-package'. * guix/channels.scm (whole-package-for-legacy): Add 'module+compiled' and pass it to 'whole-package'. --- guix/channels.scm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'guix/channels.scm') diff --git a/guix/channels.scm b/guix/channels.scm index 75503bb0ae..6b860f3bd8 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018 Ludovic Courtès +;;; Copyright © 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. @@ -335,6 +335,26 @@ modules in the old ~/.config/guix/latest style." (define packages (resolve-interface '(gnu packages guile))) + (define modules+compiled + ;; Since MODULES contains both .scm and .go files at its root, re-bundle + ;; it so that it has share/guile/site and lib/guile, which is what + ;; 'whole-package' expects. + (computed-file (derivation-name modules) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + (define version + (effective-version)) + (define share + (string-append #$output "/share/guile/site")) + (define lib + (string-append #$output "/lib/guile/" version)) + + (mkdir-p share) (mkdir-p lib) + (symlink #$modules (string-append share "/" version)) + (symlink #$modules (string-append lib "/site-ccache")))))) + (letrec-syntax ((list (syntax-rules (->) ((_) '()) @@ -346,7 +366,7 @@ modules in the old ~/.config/guix/latest style." ((_ variable rest ...) (cons (module-ref packages 'variable) (list rest ...)))))) - (whole-package name modules + (whole-package name modules+compiled ;; In the "old style", %SELF-BUILD-FILE would simply return a ;; derivation that builds modules. We have to infer what the -- cgit v1.2.3