installer: keymap: Fix optional fields handling.
Fixes: <https://issues.guix.gnu.org/50723>. The keymap xml contains optional shortDescription and description fields. The assoc-ref call on those fields can return false, handle it correctly. * gnu/installer/keymap.scm (xkb-rules->models+layouts): Introduce a new "maybe-empty" helper to deal with optional fields. Use it for shortDescription and description fields.
This commit is contained in:
parent
a3324e5753
commit
d58e52b071
@ -1,5 +1,5 @@
|
|||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2018, 2021 Mathieu Othacehe <othacehe@gnu.org>
|
||||||
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
|
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
@ -79,6 +79,11 @@
|
|||||||
"Parse FILE and return two values, the list of supported X11-KEYMAP-MODEL
|
"Parse FILE and return two values, the list of supported X11-KEYMAP-MODEL
|
||||||
and X11-KEYMAP-LAYOUT records. FILE is an XML file from the X Keyboard
|
and X11-KEYMAP-LAYOUT records. FILE is an XML file from the X Keyboard
|
||||||
Configuration Database, describing possible XKB configurations."
|
Configuration Database, describing possible XKB configurations."
|
||||||
|
(define maybe-empty
|
||||||
|
(match-lambda
|
||||||
|
((x) x)
|
||||||
|
(#f "")))
|
||||||
|
|
||||||
(define (model m)
|
(define (model m)
|
||||||
(sxml-match m
|
(sxml-match m
|
||||||
[(model
|
[(model
|
||||||
@ -108,7 +113,7 @@ Configuration Database, describing possible XKB configurations."
|
|||||||
. ,rest-variant))
|
. ,rest-variant))
|
||||||
(x11-keymap-variant
|
(x11-keymap-variant
|
||||||
(name name)
|
(name name)
|
||||||
(description (car
|
(description (maybe-empty
|
||||||
(assoc-ref rest-variant 'description))))]))
|
(assoc-ref rest-variant 'description))))]))
|
||||||
|
|
||||||
(define (layout l)
|
(define (layout l)
|
||||||
@ -120,9 +125,9 @@ Configuration Database, describing possible XKB configurations."
|
|||||||
(variantList ,[variant -> v] ...))
|
(variantList ,[variant -> v] ...))
|
||||||
(x11-keymap-layout
|
(x11-keymap-layout
|
||||||
(name name)
|
(name name)
|
||||||
(synopsis (car
|
(synopsis (maybe-empty
|
||||||
(assoc-ref rest-layout 'shortDescription)))
|
(assoc-ref rest-layout 'shortDescription)))
|
||||||
(description (car
|
(description (maybe-empty
|
||||||
(assoc-ref rest-layout 'description)))
|
(assoc-ref rest-layout 'description)))
|
||||||
(variants (list v ...)))]
|
(variants (list v ...)))]
|
||||||
[(layout
|
[(layout
|
||||||
@ -131,9 +136,9 @@ Configuration Database, describing possible XKB configurations."
|
|||||||
. ,rest-layout))
|
. ,rest-layout))
|
||||||
(x11-keymap-layout
|
(x11-keymap-layout
|
||||||
(name name)
|
(name name)
|
||||||
(synopsis (car
|
(synopsis (maybe-empty
|
||||||
(assoc-ref rest-layout 'shortDescription)))
|
(assoc-ref rest-layout 'shortDescription)))
|
||||||
(description (car
|
(description (maybe-empty
|
||||||
(assoc-ref rest-layout 'description)))
|
(assoc-ref rest-layout 'description)))
|
||||||
(variants '()))]))
|
(variants '()))]))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user