diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-10-13 23:12:44 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-10-14 00:08:10 +0200 |
commit | 8f417ed28061c11c7ff2649cfa15e35b00ef9a0b (patch) | |
tree | acfd4a0f0b70ef7ff802777c448942898d3b7c4a | |
parent | f618134e4c518e87ea916d717eb25934a0fe7282 (diff) | |
download | patches-8f417ed28061c11c7ff2649cfa15e35b00ef9a0b.tar patches-8f417ed28061c11c7ff2649cfa15e35b00ef9a0b.tar.gz |
gnu: commencement: Further optimize the package object graph.
For a package like:
(define-public xxx
(package
(inherit (@ (gnu packages base) coreutils))
(name "xxx")
(inputs (@ (gnu packages commencement) %final-inputs))
(native-inputs '())
(propagated-inputs '())
(arguments '(#:implicit-inputs? #f))))
this reduces the package object graph from 176 nodes (1852 edges) to 113
nodes (1114 edges).
The number of 'add-data-to-store' calls in "guix build coreutils -nd"
drops from 2045 to 1301, and the number of memoization tables drops from
102 to 40.
"guix build libreoffice -nd" goes from 2.40s to 2.27s.
* gnu/packages/commencement.scm (with-boot4): New variable.
(guile-final, glibc-utf8-locales-final): Use it.
(with-boot4, with-boot5): New variable.
(gnu-make-final): Rewrite to avoid 'package-with-explicit-inputs'.
(coreutils-final): Use 'with-boot5' instead of
'package-with-explicit-inputs'.
(grep-final): Likewise.
(with-boot6): New variable.
(sed-final, %final-inputs): Use it.
-rw-r--r-- | gnu/packages/commencement.scm | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index d113acaba8..fd976e0c2f 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -2365,14 +2365,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" `(("bash" ,bash-final) ,@(alist-delete "bash" (%boot3-inputs)))) +(define with-boot4 + (package-with-explicit-inputs %boot4-inputs %bootstrap-guile)) + (define-public guile-final ;; This package must be public because other modules refer to it. However, ;; mark it as hidden so that 'fold-packages' ignores it. - (package-with-bootstrap-guile - (package-with-explicit-inputs (hidden-package guile-2.2/fixed) - %boot4-inputs - (current-source-location) - #:guile %bootstrap-guile))) + (with-boot4 (hidden-package + (package-with-bootstrap-guile guile-2.2/fixed)))) (define glibc-utf8-locales-final ;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed @@ -2384,10 +2384,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" (inherit glibc-utf8-locales) (native-inputs `(("glibc" ,glibc-final) - ("gzip" - ,(package-with-explicit-inputs gzip %boot4-inputs - (current-source-location) - #:guile %bootstrap-guile)))))) + ("gzip" ,(with-boot4 gzip)))))) (define-public ld-wrapper ;; The final 'ld' wrapper, which uses the final Guile and Binutils. @@ -2403,35 +2400,45 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" `(("locales" ,glibc-utf8-locales-final) ,@(%boot4-inputs))) +(define with-boot5 + (package-with-explicit-inputs %boot5-inputs)) + (define gnu-make-final ;; The final GNU Make, which uses the final Guile. - (package-with-explicit-inputs (package-with-bootstrap-guile gnu-make) - (lambda _ - `(("guile" ,guile-final) - ,@(%boot5-inputs))) - (current-source-location))) + ;; FIXME: This is a mistake: we shouldn't be propagating GUILE-FINAL to + ;; PKG-CONFIG. + ;; TODO: Fix that on the next rebuild cycle. + (let ((pkg-config (package + (inherit pkg-config) + (inputs `(("guile" ,guile-final) + ,@(%boot5-inputs))) + (arguments + `(#:implicit-inputs? #f + ,@(package-arguments pkg-config)))))) + (package + (inherit (package-with-bootstrap-guile gnu-make)) + (inputs `(("guile" ,guile-final) + ,@(%boot5-inputs))) + (native-inputs `(("pkg-config" ,pkg-config))) + (arguments + `(#:implicit-inputs? #f + ,@(package-arguments gnu-make)))))) + (define coreutils-final ;; The final Coreutils. Treat them specially because some packages, such as ;; Findutils, keep a reference to the Coreutils they were built with. - (package-with-explicit-inputs (package-with-bootstrap-guile coreutils) - %boot5-inputs - (current-source-location) - - ;; Use the final Guile, linked against the - ;; final libc with working iconv, so that - ;; 'substitute*' works well when touching - ;; test files in Gettext. - #:guile guile-final)) + (with-boot5 (package-with-bootstrap-guile coreutils) + ;; Use the final Guile, linked against the + ;; final libc with working iconv, so that + ;; 'substitute*' works well when touching + ;; test files in Gettext. + )) (define grep-final ;; The final grep. Gzip holds a reference to it (via zgrep), so it must be ;; built before gzip. - (let ((grep (package-with-explicit-inputs - (package-with-bootstrap-guile grep) - %boot5-inputs - (current-source-location) - #:guile guile-final))) + (let ((grep (with-boot5 (package-with-bootstrap-guile grep)))) (package/inherit grep (inputs (alist-delete "pcre" (package-inputs grep))) (native-inputs `(("perl" ,perl-boot0)))))) @@ -2442,12 +2449,12 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ("grep" ,grep-final) ,@(%boot5-inputs))) +(define with-boot6 + (package-with-explicit-inputs %boot6-inputs)) + (define sed-final ;; The final sed. - (let ((sed (package-with-explicit-inputs (package-with-bootstrap-guile sed) - %boot6-inputs - (current-source-location) - #:guile guile-final))) + (let ((sed (with-boot6 (package-with-bootstrap-guile sed)))) (package/inherit sed (native-inputs `(("perl" ,perl-boot0)))))) (define-public %final-inputs @@ -2455,8 +2462,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are ;; used for origins that have patches, thereby avoiding circular ;; dependencies. - (let ((finalize (compose (cut package-with-explicit-inputs <> %boot6-inputs - (current-source-location)) + (let ((finalize (compose with-boot6 package-with-bootstrap-guile))) `(,@(map (match-lambda ((name package) |