summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2021-11-17 14:43:48 +0000
committerLudovic Courtès <ludo@gnu.org>2021-11-17 23:05:58 +0100
commit7c4142628a397f7863f346635591dbe92b667b45 (patch)
tree63fae672e4127f5010c4f9f4ecdd03c7c5d9c141 /gnu
parent346d2f64889b0c82111e790e999bf6c754027e04 (diff)
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>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/bootloader.scm16
-rw-r--r--gnu/system.scm11
2 files changed, 13 insertions, 14 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index d1c72c0c854..9cf54578731 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -183,8 +183,13 @@ record."
183;; The <bootloader-configuration> record contains bootloader independant 183;; The <bootloader-configuration> record contains bootloader independant
184;; configuration used to fill bootloader configuration file. 184;; configuration used to fill bootloader configuration file.
185 185
186(define-syntax-rule (warn-target-field-deprecation value) 186(define-with-syntax-properties (warn-target-field-deprecation
187 (%warn-target-field-deprecation value (current-source-location))) 187 (value properties))
188 (when value
189 (warning (source-properties->location properties)
190 (G_ "the 'target' field is deprecated, please use 'targets' \
191instead~%")))
192 value)
188 193
189(define-record-type* <bootloader-configuration> 194(define-record-type* <bootloader-configuration>
190 bootloader-configuration make-bootloader-configuration 195 bootloader-configuration make-bootloader-configuration
@@ -213,13 +218,6 @@ record."
213 (serial-speed bootloader-configuration-serial-speed ;integer | #f 218 (serial-speed bootloader-configuration-serial-speed ;integer | #f
214 (default #f))) 219 (default #f)))
215 220
216(define (%warn-target-field-deprecation value location)
217 (when value
218 (warning (source-properties->location location)
219 (G_ "the 'target' field is deprecated, please use 'targets' \
220instead~%")))
221 value)
222
223(define-deprecated (bootloader-configuration-target config) 221(define-deprecated (bootloader-configuration-target config)
224 bootloader-configuration-targets 222 bootloader-configuration-targets
225 (%bootloader-configuration-target config)) 223 (%bootloader-configuration-target config))
diff --git a/gnu/system.scm b/gnu/system.scm
index 17653682c56..73e6b58f2a9 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1073,16 +1073,17 @@ use 'plain-file' instead~%")
1073 ;; TODO: Remove when glibc@2.23 is long gone. 1073 ;; TODO: Remove when glibc@2.23 is long gone.
1074 ("GUIX_LOCPATH" . "/run/current-system/locale"))) 1074 ("GUIX_LOCPATH" . "/run/current-system/locale")))
1075 1075
1076(define-syntax-rule (ensure-setuid-program-list lst) 1076;; Ensure LST is a list of <setuid-program> records and warn otherwise.
1077 "Ensure LST is a list of <setuid-program> records and warn otherwise." 1077(define-with-syntax-properties (ensure-setuid-program-list (lst properties))
1078 (%ensure-setuid-program-list lst (current-source-location))) 1078 (%ensure-setuid-program-list lst properties))
1079 1079
1080(define (%ensure-setuid-program-list lst location) 1080;; We want to be able to use defines, so define a procedure.
1081(define (%ensure-setuid-program-list lst properties)
1081 (define warned? #f) 1082 (define warned? #f)
1082 1083
1083 (define (warn-once) 1084 (define (warn-once)
1084 (unless warned? 1085 (unless warned?
1085 (warning (source-properties->location location) 1086 (warning (source-properties->location properties)
1086 (G_ "representing setuid programs with file-like objects is \ 1087 (G_ "representing setuid programs with file-like objects is \
1087deprecated; use 'setuid-program' instead~%")) 1088deprecated; use 'setuid-program' instead~%"))
1088 (set! warned? #t))) 1089 (set! warned? #t)))