bootloader: Report location of the deprecated 'target' field.
This is a followup to 2ca982ff41
.
* 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.
parent
8e8d85f722
commit
baf4272df2
|
@ -2,7 +2,7 @@
|
||||||
;;; Copyright © 2017 David Craven <david@craven.ch>
|
;;; Copyright © 2017 David Craven <david@craven.ch>
|
||||||
;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
|
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
|
||||||
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
|
@ -25,7 +25,10 @@
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (guix profiles)
|
#:use-module (guix profiles)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix ui)
|
#:use-module (guix deprecation)
|
||||||
|
#:use-module ((guix ui) #:select (warn-about-load-error))
|
||||||
|
#:use-module (guix diagnostics)
|
||||||
|
#:use-module (guix i18n)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:export (menu-entry
|
#:export (menu-entry
|
||||||
|
@ -180,6 +183,9 @@ record."
|
||||||
;; The <bootloader-configuration> record contains bootloader independant
|
;; The <bootloader-configuration> record contains bootloader independant
|
||||||
;; configuration used to fill bootloader configuration file.
|
;; configuration used to fill bootloader configuration file.
|
||||||
|
|
||||||
|
(define-syntax-rule (warn-target-field-deprecation value)
|
||||||
|
(%warn-target-field-deprecation value (current-source-location)))
|
||||||
|
|
||||||
(define-record-type* <bootloader-configuration>
|
(define-record-type* <bootloader-configuration>
|
||||||
bootloader-configuration make-bootloader-configuration
|
bootloader-configuration make-bootloader-configuration
|
||||||
bootloader-configuration?
|
bootloader-configuration?
|
||||||
|
@ -187,7 +193,7 @@ record."
|
||||||
(targets %bootloader-configuration-targets ;list of strings
|
(targets %bootloader-configuration-targets ;list of strings
|
||||||
(default #f))
|
(default #f))
|
||||||
(target %bootloader-configuration-target ;deprecated
|
(target %bootloader-configuration-target ;deprecated
|
||||||
(default #f))
|
(default #f) (sanitize warn-target-field-deprecation))
|
||||||
(menu-entries bootloader-configuration-menu-entries ;list of <menu-entry>
|
(menu-entries bootloader-configuration-menu-entries ;list of <menu-entry>
|
||||||
(default '()))
|
(default '()))
|
||||||
(default-entry bootloader-configuration-default-entry ;integer
|
(default-entry bootloader-configuration-default-entry ;integer
|
||||||
|
@ -207,16 +213,21 @@ record."
|
||||||
(serial-speed bootloader-configuration-serial-speed ;integer | #f
|
(serial-speed bootloader-configuration-serial-speed ;integer | #f
|
||||||
(default #f)))
|
(default #f)))
|
||||||
|
|
||||||
;;; Deprecated.
|
(define (%warn-target-field-deprecation value location)
|
||||||
(define (bootloader-configuration-target config)
|
(when value
|
||||||
(warning (G_ "the 'target' field is deprecated, please use 'targets' \
|
(warning (source-properties->location location)
|
||||||
instead~%"))
|
(G_ "the 'target' field is deprecated, please use 'targets' \
|
||||||
|
instead~%")))
|
||||||
|
value)
|
||||||
|
|
||||||
|
(define-deprecated (bootloader-configuration-target config)
|
||||||
|
bootloader-configuration-targets
|
||||||
(%bootloader-configuration-target config))
|
(%bootloader-configuration-target config))
|
||||||
|
|
||||||
(define (bootloader-configuration-targets config)
|
(define (bootloader-configuration-targets config)
|
||||||
(or (%bootloader-configuration-targets config)
|
(or (%bootloader-configuration-targets config)
|
||||||
;; TODO: Remove after the deprecated 'target' field is removed.
|
;; TODO: Remove after the deprecated 'target' field is removed.
|
||||||
(list (bootloader-configuration-target config))
|
(list (%bootloader-configuration-target config))
|
||||||
;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this
|
;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this
|
||||||
;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f,
|
;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f,
|
||||||
;; hence the default value of '(#f) rather than '().
|
;; hence the default value of '(#f) rather than '().
|
||||||
|
|
Reference in New Issue