summary refs log tree commit diff
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2023-06-22 08:30:25 +0200
committerJanneke Nieuwenhuizen <janneke@gnu.org>2023-07-21 17:54:44 +0200
commit5623ab503fa70eab95e6f859e82c89581c3f69f4 (patch)
tree7d88acb6c0318c4fff04b7c7d1829599f581300b
parent06438c2a7edf1f0c90392858fc86480c6e5c2195 (diff)
downloadguix-5623ab503fa70eab95e6f859e82c89581c3f69f4.tar.gz
self: Build gnu/packages/*.go in 26 steps on the Hurd.
Similar to the Makefile.am change, this breaks-up packages into 26 chunks
when building for the Hurd.  Also force garbage collection.

* guix/self.scm (compiled-modules)[process-directory/hurd]: New inner define.
Use it when building on the Hurd.
-rw-r--r--guix/self.scm30
1 files changed, 28 insertions, 2 deletions
diff --git a/guix/self.scm b/guix/self.scm
index 81a36e007f..5f7fae6d90 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))
@@ -1251,6 +1255,26 @@ containing MODULE-FILES and possibly other files as well."
                              #:report-load report-load
                              #:report-compilation report-compilation)))
 
+          (define (process-directory/hurd directory files output)
+            (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)
+                 (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)
 
@@ -1277,7 +1301,9 @@ containing MODULE-FILES and possibly other files as well."
 
           (mkdir #$output)
           (chdir #+module-tree)
-          (process-directory "." '#+module-files #$output)
+          (if (string-ci= "GNU" (vector-ref (uname) 0))
+              (process-directory/hurd "." '#+module-files #$output)
+              (process-directory "." '#+module-files #$output))
           (newline))))
 
   (computed-file name build