[Top][All Lists]

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

[no subject]

From: Ludovic Courtès
Date: Thu, 25 Jan 2018 05:33:13 -0500 (EST)

branch: master
commit c2cbee8b4f19924ef374e480981645328cbe9a00
Author: Ludovic Courtès <address@hidden>
Date:   Thu Jan 25 11:31:06 2018 +0100

    base: Delete duplicate builds when restarting them.
    * src/cuirass/base.scm (build-derivation=?): New procedure.
    (restart-builds): Call 'delete-duplicates' on BUILDS.
 src/cuirass/base.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 1ac9e60..9e80766 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -356,14 +356,21 @@ updating DB accordingly."
      (log-message "build event: ~s" event))))
+(define (build-derivation=? build1 build2)
+  "Return true if BUILD1 and BUILD2 correspond to the same derivation."
+  (string=? (assq-ref build1 #:derivation)
+            (assq-ref build2 #:derivation)))
 (define (restart-builds db builds)
   "Restart builds whose status in DB is \"pending\" (scheduled or started)."
   (with-store store
-    (let-values (((valid stale)
-                  (partition (lambda (build)
-                               (let ((drv (assq-ref build #:derivation)))
-                                 (valid-path? store drv)))
-                             builds)))
+    (let*-values (((builds)
+                   (delete-duplicates builds build-derivation=?))
+                  ((valid stale)
+                   (partition (lambda (build)
+                                (let ((drv (assq-ref build #:derivation)))
+                                  (valid-path? store drv)))
+                              builds)))
       ;; We cannot restart builds listed in STALE, so mark them as canceled.
       (log-message "canceling ~a pending builds" (length stale))
       (for-each (lambda (build)

reply via email to

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