From 4b5a6fbc9b754c0ca70d033dd99f17c4f028733a Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 24 Aug 2020 16:26:14 -0400 Subject: offload: Modify the build-machine record to accept multiple systems. * guix/scripts/offload.scm ()[systems]: New field. [system]: Accessor changed to %build-machine-system. Default to #f. * guix/scripts/offload.scm (build-machine-system): Wrap %build-machine-system with a deprecation warning. (build-machine-systems): Access the new systems field or fallback to use build-machine-system, for backward compatibility. (machine-matches?): Adjust. * tests/offload.scm: Add tests... * Makefile.am (SCM_TESTS): ...and register them. * doc/guix.texi (Daemon Offload Setup): Update doc. --- guix/scripts/offload.scm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'guix/scripts/offload.scm') diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index 20ae7a9469..a56701f07a 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2017 Ricardo Wurmus +;;; Copyright © 2020 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -66,14 +67,16 @@ ;;; ;;; Code: - (define-record-type* build-machine make-build-machine build-machine? (name build-machine-name) ; string (port build-machine-port ; number (default 22)) - (system build-machine-system) ; string + (systems %build-machine-systems ; list of strings + (default #f)) ; drop default after system is removed + (system %build-machine-system ; deprecated + (default #f)) (user build-machine-user) ; string (private-key build-machine-private-key ; file name (default (user-openssh-private-key))) @@ -91,6 +94,19 @@ (features build-machine-features ; list of strings (default '()))) +;;; Deprecated. +(define (build-machine-system machine) + (warning (G_ "The 'system' field is deprecated, \ +please use 'systems' instead.~%")) + (%build-machine-system machine)) + +;;; TODO: Remove after the deprecated 'system' field is removed. +(define (build-machine-systems machine) + (or (%build-machine-systems machine) + (list (build-machine-system machine)) + (leave (G_ "The build-machine object lacks a value for its 'systems' +field.")))) + (define-record-type* build-requirements make-build-requirements build-requirements? @@ -359,8 +375,8 @@ of free disk space on '~a'~%") (define (machine-matches? machine requirements) "Return #t if MACHINE matches REQUIREMENTS." - (and (string=? (build-requirements-system requirements) - (build-machine-system machine)) + (and (member (build-requirements-system requirements) + (build-machine-systems machine)) (lset<= string=? (build-requirements-features requirements) (build-machine-features machine)))) -- cgit v1.2.3