From f574dbd163f8b2d417c6d7ee08559626ae52b7c5 Mon Sep 17 00:00:00 2001 From: Josselin Poiret Date: Mon, 15 Nov 2021 20:26:28 +0000 Subject: system: Warn about swap-devices format change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/system.scm (warn-swap-devices-change, %warn-swap-devices-change): Add them. * gnu/system.scm (operating-system) [swap-devices]: Use it. Signed-off-by: Ludovic Courtès --- gnu/system.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gnu') diff --git a/gnu/system.scm b/gnu/system.scm index 3281c0e79b..2e5a5ff7c8 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -235,6 +235,8 @@ (define-record-type* operating-system (file-systems operating-system-file-systems) ; list of fs (swap-devices operating-system-swap-devices ; list of string | (default '()) + (delayed) + (sanitize warn-swap-devices-change)) (users operating-system-users ; list of user accounts (default %base-user-accounts)) @@ -583,6 +585,20 @@ (define (device-mapping-services os) (map device-mapping-service (operating-system-user-mapped-devices os))) +(define-syntax-rule (warn-swap-devices-change value) + (%warn-swap-devices-change value (current-source-location))) + +(define (%warn-swap-devices-change value location) + (map (lambda (x) + (unless (swap-space? x) + (warning + (source-properties->location + location) + (G_ "List elements of the field 'swap-devices' should \ +now use the record, as the old method is deprecated. \ +See \"(guix) operating-system Reference\" for more details.~%"))) + x) value)) + (define (swap-services os) "Return the list of swap services for OS." (map swap-service (operating-system-swap-devices os))) -- cgit v1.2.3