diff options
author | Janneke Nieuwenhuizen <janneke@gnu.org> | 2023-06-22 08:30:25 +0200 |
---|---|---|
committer | Janneke Nieuwenhuizen <janneke@gnu.org> | 2023-08-22 21:21:34 +0200 |
commit | 5898b2e8a3dbf7797e83b39a2783c5b543015725 (patch) | |
tree | 8dccd6f5cabc43cad5dbe13f9db4bbf1ebd8a389 | |
parent | c650019e756b9c26f19df8e5c5011c3af335a45d (diff) | |
download | guix-5898b2e8a3dbf7797e83b39a2783c5b543015725.tar.gz guix-5898b2e8a3dbf7797e83b39a2783c5b543015725.zip |
self: Build gnu/packages/*.go in 26 steps.
Similar to the Makefile.am change, this breaks-up gnu/packages into 26 chunks
when building on 32bit. Also force garbage collection.
* guix/self.scm (compiled-modules)[process-directory]: Split building of
"gnu/packages" into 26 chunks.
-rw-r--r-- | guix/self.scm | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/guix/self.scm b/guix/self.scm index 81a36e007f..239727dfa8 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> +;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -1210,9 +1211,12 @@ containing MODULE-FILES and possibly other files as well." '((guix build compile) (guix build utils))) #~(begin - (use-modules (srfi srfi-26) + (use-modules (srfi srfi-1) + (srfi srfi-26) + (srfi srfi-71) (ice-9 match) (ice-9 format) + (ice-9 regex) (ice-9 threads) (guix build compile) (guix build utils)) @@ -1244,12 +1248,27 @@ containing MODULE-FILES and possibly other files as well." (force-output)) (define (process-directory directory files output) - ;; Hide compilation warnings. - (parameterize ((current-warning-port (%make-void-port "w"))) - (compile-files directory #$output files - #:workers (parallel-job-count) - #:report-load report-load - #:report-compilation report-compilation))) + ;; Split gnu/packages in 26 chunks to avoid OOM errors + (let* ((chunks (map (compose + (cute partition <> files) + (lambda (regex) + (cute string-match regex <>)) + (cute string-append "^gnu/packages/" <>) + (cute make-string 1 <>) + integer->char + (cute + (char->integer #\a) <>)) + (iota 26))) + (chunks (filter pair? chunks))) + (for-each + (lambda (chunck) + ;; Hide compilation warnings. + (parameterize ((current-warning-port (%make-void-port "w"))) + (compile-files directory #$output chunck + #:workers (parallel-job-count) + #:report-load report-load + #:report-compilation report-compilation)) + (gc)) + chunks))) (setvbuf (current-output-port) 'line) (setvbuf (current-error-port) 'line) |