gnu: system: Improve location of some configuration warnings.
* gnu/bootloader.scm (%warn-target-field-deprecation): Remove it. * gnu/bootloader.scm (warn-target-field-deprecation): Use define-with-syntax-properties. * gnu/system.scm (ensure-setuid-program-list): Ditto. Also rename the 'location' variable to 'properties'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>master
parent
346d2f6488
commit
7c4142628a
|
@ -183,8 +183,13 @@ 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)
|
(define-with-syntax-properties (warn-target-field-deprecation
|
||||||
(%warn-target-field-deprecation value (current-source-location)))
|
(value properties))
|
||||||
|
(when value
|
||||||
|
(warning (source-properties->location properties)
|
||||||
|
(G_ "the 'target' field is deprecated, please use 'targets' \
|
||||||
|
instead~%")))
|
||||||
|
value)
|
||||||
|
|
||||||
(define-record-type* <bootloader-configuration>
|
(define-record-type* <bootloader-configuration>
|
||||||
bootloader-configuration make-bootloader-configuration
|
bootloader-configuration make-bootloader-configuration
|
||||||
|
@ -213,13 +218,6 @@ record."
|
||||||
(serial-speed bootloader-configuration-serial-speed ;integer | #f
|
(serial-speed bootloader-configuration-serial-speed ;integer | #f
|
||||||
(default #f)))
|
(default #f)))
|
||||||
|
|
||||||
(define (%warn-target-field-deprecation value location)
|
|
||||||
(when value
|
|
||||||
(warning (source-properties->location location)
|
|
||||||
(G_ "the 'target' field is deprecated, please use 'targets' \
|
|
||||||
instead~%")))
|
|
||||||
value)
|
|
||||||
|
|
||||||
(define-deprecated (bootloader-configuration-target config)
|
(define-deprecated (bootloader-configuration-target config)
|
||||||
bootloader-configuration-targets
|
bootloader-configuration-targets
|
||||||
(%bootloader-configuration-target config))
|
(%bootloader-configuration-target config))
|
||||||
|
|
|
@ -1073,16 +1073,17 @@ use 'plain-file' instead~%")
|
||||||
;; TODO: Remove when glibc@2.23 is long gone.
|
;; TODO: Remove when glibc@2.23 is long gone.
|
||||||
("GUIX_LOCPATH" . "/run/current-system/locale")))
|
("GUIX_LOCPATH" . "/run/current-system/locale")))
|
||||||
|
|
||||||
(define-syntax-rule (ensure-setuid-program-list lst)
|
;; Ensure LST is a list of <setuid-program> records and warn otherwise.
|
||||||
"Ensure LST is a list of <setuid-program> records and warn otherwise."
|
(define-with-syntax-properties (ensure-setuid-program-list (lst properties))
|
||||||
(%ensure-setuid-program-list lst (current-source-location)))
|
(%ensure-setuid-program-list lst properties))
|
||||||
|
|
||||||
(define (%ensure-setuid-program-list lst location)
|
;; We want to be able to use defines, so define a procedure.
|
||||||
|
(define (%ensure-setuid-program-list lst properties)
|
||||||
(define warned? #f)
|
(define warned? #f)
|
||||||
|
|
||||||
(define (warn-once)
|
(define (warn-once)
|
||||||
(unless warned?
|
(unless warned?
|
||||||
(warning (source-properties->location location)
|
(warning (source-properties->location properties)
|
||||||
(G_ "representing setuid programs with file-like objects is \
|
(G_ "representing setuid programs with file-like objects is \
|
||||||
deprecated; use 'setuid-program' instead~%"))
|
deprecated; use 'setuid-program' instead~%"))
|
||||||
(set! warned? #t)))
|
(set! warned? #t)))
|
||||||
|
|
Reference in New Issue