From 336692df15e77f9d90619d0fe60e864c4d2fb37a Mon Sep 17 00:00:00 2001 From: Leo Prikler
Date: Tue, 17 Dec 2019 14:04:12 +0100 Subject: [PATCH 2/2] guix: Build to be installed packages in parallel. * guix/scripts/package.scm (options->buildable): New procedure. (process-actions): Build packages before acquiring profile lock. --- guix/scripts/package.scm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 202a6d6470..1278d1a65f 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -587,6 +587,19 @@ the resulting manifest entry." (package->manifest-entry package output #:properties (provenance-properties package))) +(define (options->buildable opts) + (filter-map (match-lambda + (('install . (? package? p)) + p) + (('install . (? string? spec)) + (if (store-path? spec) + #f ;; assume already interned + (specification->package spec))) + (('install . obj) + (leave (G_ "cannot build non-package object: ~s~%") + obj)) + (_ #f)) + opts)) (define (options->installable opts manifest transaction) "Given MANIFEST, the current manifest, and OPTS, the result of 'args-fold', @@ -861,8 +874,15 @@ processed, #f otherwise." (package-version item) (manifest-entry-version entry)))))) + ;; First, process installations, as these can be handled in parallel. + (unless dry-run? + (let* ((drv (map (compose (lambda (drv) (drv store)) package->derivation) + (options->buildable opts)))) + (show-what-to-build store drv + #:use-substitutes? substitutes?) + (build-derivations store drv))) - ;; First, acquire a lock on the profile, to ensure only one guix process + ;; Now, acquire a lock on the profile, to ensure only one guix process ;; is modifying it at a time. (format #t "Waiting for lock on ~a...~%" profile) (with-profile-lock profile -- 2.24.1