summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-08-30 14:22:35 +0200
committerLudovic Courtès <ludo@gnu.org>2021-08-30 14:22:35 +0200
commitbaf4272df2350a40bfa198f5cdb42e707e32ad71 (patch)
tree4173152cbfa23741e52a9cf684204cea5d09e494 /gnu
parent8e8d85f722c7fa44ee6320b219274d716046b51f (diff)
bootloader: Report location of the deprecated 'target' field.
This is a followup to 2ca982ff41270288913ad6b7d5d9e1cad87b06d9. * gnu/bootloader.scm (warn-target-field-deprecation): New macro. (<bootloader-configuration>)[target]: Add 'sanitize' property. (%warn-target-field-deprecation): New procedure. (bootloader-configuration-target): Define using 'define-deprecated'. (bootloader-configuration-targets): Use '%bootloader-configuration-target' rather than the deprecated one.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/bootloader.scm27
1 files changed, 19 insertions, 8 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 98807a4810b..d1c72c0c854 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -2,7 +2,7 @@
2;;; Copyright © 2017 David Craven <david@craven.ch> 2;;; Copyright © 2017 David Craven <david@craven.ch>
3;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> 3;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
4;;; Copyright © 2017 Leo Famulari <leo@famulari.name> 4;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
5;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> 5;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org>
6;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 6;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
7;;; 7;;;
8;;; This file is part of GNU Guix. 8;;; This file is part of GNU Guix.
@@ -25,7 +25,10 @@
25 #:use-module (guix gexp) 25 #:use-module (guix gexp)
26 #:use-module (guix profiles) 26 #:use-module (guix profiles)
27 #:use-module (guix records) 27 #:use-module (guix records)
28 #:use-module (guix ui) 28 #:use-module (guix deprecation)
29 #:use-module ((guix ui) #:select (warn-about-load-error))
30 #:use-module (guix diagnostics)
31 #:use-module (guix i18n)
29 #:use-module (srfi srfi-1) 32 #:use-module (srfi srfi-1)
30 #:use-module (ice-9 match) 33 #:use-module (ice-9 match)
31 #:export (menu-entry 34 #:export (menu-entry
@@ -180,6 +183,9 @@ record."
180;; The <bootloader-configuration> record contains bootloader independant 183;; The <bootloader-configuration> record contains bootloader independant
181;; configuration used to fill bootloader configuration file. 184;; configuration used to fill bootloader configuration file.
182 185
186(define-syntax-rule (warn-target-field-deprecation value)
187 (%warn-target-field-deprecation value (current-source-location)))
188
183(define-record-type* <bootloader-configuration> 189(define-record-type* <bootloader-configuration>
184 bootloader-configuration make-bootloader-configuration 190 bootloader-configuration make-bootloader-configuration
185 bootloader-configuration? 191 bootloader-configuration?
@@ -187,7 +193,7 @@ record."
187 (targets %bootloader-configuration-targets ;list of strings 193 (targets %bootloader-configuration-targets ;list of strings
188 (default #f)) 194 (default #f))
189 (target %bootloader-configuration-target ;deprecated 195 (target %bootloader-configuration-target ;deprecated
190 (default #f)) 196 (default #f) (sanitize warn-target-field-deprecation))
191 (menu-entries bootloader-configuration-menu-entries ;list of <menu-entry> 197 (menu-entries bootloader-configuration-menu-entries ;list of <menu-entry>
192 (default '())) 198 (default '()))
193 (default-entry bootloader-configuration-default-entry ;integer 199 (default-entry bootloader-configuration-default-entry ;integer
@@ -207,16 +213,21 @@ record."
207 (serial-speed bootloader-configuration-serial-speed ;integer | #f 213 (serial-speed bootloader-configuration-serial-speed ;integer | #f
208 (default #f))) 214 (default #f)))
209 215
210;;; Deprecated. 216(define (%warn-target-field-deprecation value location)
211(define (bootloader-configuration-target config) 217 (when value
212 (warning (G_ "the 'target' field is deprecated, please use 'targets' \ 218 (warning (source-properties->location location)
213instead~%")) 219 (G_ "the 'target' field is deprecated, please use 'targets' \
220instead~%")))
221 value)
222
223(define-deprecated (bootloader-configuration-target config)
224 bootloader-configuration-targets
214 (%bootloader-configuration-target config)) 225 (%bootloader-configuration-target config))
215 226
216(define (bootloader-configuration-targets config) 227(define (bootloader-configuration-targets config)
217 (or (%bootloader-configuration-targets config) 228 (or (%bootloader-configuration-targets config)
218 ;; TODO: Remove after the deprecated 'target' field is removed. 229 ;; TODO: Remove after the deprecated 'target' field is removed.
219 (list (bootloader-configuration-target config)) 230 (list (%bootloader-configuration-target config))
220 ;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this 231 ;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this
221 ;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f, 232 ;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f,
222 ;; hence the default value of '(#f) rather than '(). 233 ;; hence the default value of '(#f) rather than '().