guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/17: self: Build directories in chunks of max 25 files at a time.


From: guix-commits
Subject: 01/17: self: Build directories in chunks of max 25 files at a time.
Date: Thu, 14 Sep 2023 18:19:01 -0400 (EDT)

janneke pushed a commit to branch hurd-team
in repository guix.

commit 6c1646d64a005a0b47cc985723a094ddf8b2f9cd
Author: Janneke Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Thu Jun 22 08:30:25 2023 +0200

    self: Build directories in chunks of max 25 files at a time.
    
    Similar to split build of make-go in Makefile.am, this breaks-up building
    directories into chunks of max 25 files.
    
    * guix/self.scm (compiled-modules)[process-directory]: Split building of
    directories into chunks of max 25 files.
---
 guix/self.scm | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/guix/self.scm b/guix/self.scm
index 81a36e007f..af387c02ad 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,7 +1211,8 @@ 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)
                        (ice-9 match)
                        (ice-9 format)
                        (ice-9 threads)
@@ -1244,12 +1246,22 @@ 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)))
+            (let* ((size 25)                      ;compile max 25 files a time
+                   (chunks (unfold
+                            (lambda (seed) (< (length seed) size)) ;p
+                            (cute take <> size)                    ;f
+                            (cute drop <> size)                    ;g
+                            files                                  ;seed
+                            list)))                                ;tail
+              (for-each
+               (lambda (chunk)
+                 ;; Hide compilation warnings.
+                 (parameterize ((current-warning-port (%make-void-port "w")))
+                   (compile-files directory output chunk
+                                  #:workers (parallel-job-count)
+                                  #:report-load report-load
+                                  #:report-compilation report-compilation)))
+               chunks)))
 
           (setvbuf (current-output-port) 'line)
           (setvbuf (current-error-port) 'line)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]