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.
			
			
This commit is contained in:
		
							parent
							
								
									f618134e4c
								
							
						
					
					
						commit
						8f417ed280
					
				
					 1 changed files with 40 additions and 34 deletions
				
			
		|  | @ -2365,14 +2365,14 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" | ||||||
|   `(("bash" ,bash-final) |   `(("bash" ,bash-final) | ||||||
|     ,@(alist-delete "bash" (%boot3-inputs)))) |     ,@(alist-delete "bash" (%boot3-inputs)))) | ||||||
| 
 | 
 | ||||||
|  | (define with-boot4 | ||||||
|  |   (package-with-explicit-inputs %boot4-inputs %bootstrap-guile)) | ||||||
|  | 
 | ||||||
| (define-public guile-final | (define-public guile-final | ||||||
|   ;; This package must be public because other modules refer to it.  However, |   ;; This package must be public because other modules refer to it.  However, | ||||||
|   ;; mark it as hidden so that 'fold-packages' ignores it. |   ;; mark it as hidden so that 'fold-packages' ignores it. | ||||||
|   (package-with-bootstrap-guile |   (with-boot4 (hidden-package | ||||||
|    (package-with-explicit-inputs (hidden-package guile-2.2/fixed) |                (package-with-bootstrap-guile guile-2.2/fixed)))) | ||||||
|                                  %boot4-inputs |  | ||||||
|                                  (current-source-location) |  | ||||||
|                                  #:guile %bootstrap-guile))) |  | ||||||
| 
 | 
 | ||||||
| (define glibc-utf8-locales-final | (define glibc-utf8-locales-final | ||||||
|   ;; Now that we have GUILE-FINAL, build the UTF-8 locales.  They are needed |   ;; 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) |     (inherit glibc-utf8-locales) | ||||||
|     (native-inputs |     (native-inputs | ||||||
|      `(("glibc" ,glibc-final) |      `(("glibc" ,glibc-final) | ||||||
|        ("gzip" |        ("gzip" ,(with-boot4 gzip)))))) | ||||||
|         ,(package-with-explicit-inputs gzip %boot4-inputs |  | ||||||
|                                        (current-source-location) |  | ||||||
|                                        #:guile %bootstrap-guile)))))) |  | ||||||
| 
 | 
 | ||||||
| (define-public ld-wrapper | (define-public ld-wrapper | ||||||
|   ;; The final 'ld' wrapper, which uses the final Guile and Binutils. |   ;; 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) |   `(("locales" ,glibc-utf8-locales-final) | ||||||
|     ,@(%boot4-inputs))) |     ,@(%boot4-inputs))) | ||||||
| 
 | 
 | ||||||
|  | (define with-boot5 | ||||||
|  |   (package-with-explicit-inputs %boot5-inputs)) | ||||||
|  | 
 | ||||||
| (define gnu-make-final | (define gnu-make-final | ||||||
|   ;; The final GNU Make, which uses the final Guile. |   ;; The final GNU Make, which uses the final Guile. | ||||||
|   (package-with-explicit-inputs (package-with-bootstrap-guile gnu-make) |   ;; FIXME: This is a mistake: we shouldn't be propagating GUILE-FINAL to | ||||||
|                                 (lambda _ |   ;; PKG-CONFIG. | ||||||
|                                   `(("guile" ,guile-final) |   ;; TODO: Fix that on the next rebuild cycle. | ||||||
|                                     ,@(%boot5-inputs))) |   (let ((pkg-config (package | ||||||
|                                 (current-source-location))) |                       (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 | (define coreutils-final | ||||||
|   ;; The final Coreutils.  Treat them specially because some packages, such as |   ;; The final Coreutils.  Treat them specially because some packages, such as | ||||||
|   ;; Findutils, keep a reference to the Coreutils they were built with. |   ;; Findutils, keep a reference to the Coreutils they were built with. | ||||||
|   (package-with-explicit-inputs (package-with-bootstrap-guile coreutils) |   (with-boot5 (package-with-bootstrap-guile coreutils) | ||||||
|                                 %boot5-inputs |               ;; Use the final Guile, linked against the | ||||||
|                                 (current-source-location) |               ;; final libc with working iconv, so that | ||||||
| 
 |               ;; 'substitute*' works well when touching | ||||||
|                                 ;; Use the final Guile, linked against the |               ;; test files in Gettext. | ||||||
|                                 ;; final libc with working iconv, so that |               )) | ||||||
|                                 ;; 'substitute*' works well when touching |  | ||||||
|                                 ;; test files in Gettext. |  | ||||||
|                                 #:guile guile-final)) |  | ||||||
| 
 | 
 | ||||||
| (define grep-final | (define grep-final | ||||||
|   ;; The final grep.  Gzip holds a reference to it (via zgrep), so it must be |   ;; The final grep.  Gzip holds a reference to it (via zgrep), so it must be | ||||||
|   ;; built before gzip. |   ;; built before gzip. | ||||||
|   (let ((grep (package-with-explicit-inputs |   (let ((grep (with-boot5 (package-with-bootstrap-guile grep)))) | ||||||
|                (package-with-bootstrap-guile grep) |  | ||||||
|                %boot5-inputs |  | ||||||
|                (current-source-location) |  | ||||||
|                #:guile guile-final))) |  | ||||||
|     (package/inherit grep |     (package/inherit grep | ||||||
|                      (inputs (alist-delete "pcre" (package-inputs grep))) |                      (inputs (alist-delete "pcre" (package-inputs grep))) | ||||||
|                      (native-inputs `(("perl" ,perl-boot0)))))) |                      (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) |     ("grep" ,grep-final) | ||||||
|     ,@(%boot5-inputs))) |     ,@(%boot5-inputs))) | ||||||
| 
 | 
 | ||||||
|  | (define with-boot6 | ||||||
|  |   (package-with-explicit-inputs %boot6-inputs)) | ||||||
|  | 
 | ||||||
| (define sed-final | (define sed-final | ||||||
|   ;; The final sed. |   ;; The final sed. | ||||||
|   (let ((sed (package-with-explicit-inputs (package-with-bootstrap-guile sed) |   (let ((sed (with-boot6 (package-with-bootstrap-guile sed)))) | ||||||
|                                            %boot6-inputs |  | ||||||
|                                            (current-source-location) |  | ||||||
|                                            #:guile guile-final))) |  | ||||||
|     (package/inherit sed (native-inputs `(("perl" ,perl-boot0)))))) |     (package/inherit sed (native-inputs `(("perl" ,perl-boot0)))))) | ||||||
| 
 | 
 | ||||||
| (define-public %final-inputs | (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 |   ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are | ||||||
|   ;; used for origins that have patches, thereby avoiding circular |   ;; used for origins that have patches, thereby avoiding circular | ||||||
|   ;; dependencies. |   ;; dependencies. | ||||||
|   (let ((finalize (compose (cut package-with-explicit-inputs <> %boot6-inputs |   (let ((finalize (compose with-boot6 | ||||||
|                                 (current-source-location)) |  | ||||||
|                            package-with-bootstrap-guile))) |                            package-with-bootstrap-guile))) | ||||||
|     `(,@(map (match-lambda |     `(,@(map (match-lambda | ||||||
|                ((name package) |                ((name package) | ||||||
|  |  | ||||||
		Reference in a new issue