offload: Test each machine only once.

* guix/scripts/offload.scm (check-machine-availability)[build-machine=?]:
New procedure.
Add call to 'delete-duplicates'.
This commit is contained in:
Ludovic Courtès 2016-12-09 23:00:08 +01:00
parent bd8345777f
commit 2b513387cd
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 8 additions and 1 deletions

View File

@ -710,7 +710,14 @@ allowed on MACHINE. Return +∞ if MACHINE is unreachable."
(define (check-machine-availability machine-file)
"Check that each machine in MACHINE-FILE is usable as a build machine."
(let ((machines (build-machines machine-file)))
(define (build-machine=? m1 m2)
(and (string=? (build-machine-name m1) (build-machine-name m2))
(= (build-machine-port m1) (build-machine-port m2))))
;; A given build machine may appear several times (e.g., once for
;; "x86_64-linux" and a second time for "i686-linux"); test them only once.
(let ((machines (delete-duplicates (build-machines machine-file)
build-machine=?)))
(info (_ "testing ~a build machines defined in '~a'...~%")
(length machines) machine-file)
(let* ((names (map build-machine-name machines))