diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2021-09-21 20:35:49 +0000 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-09-21 20:35:49 +0000 |
| commit | d58e52b0713648dd30d41b41277854a935d8d15a (patch) | |
| tree | d50ce303f957e20ffe96217ae034119f1609dd18 /gnu/installer | |
| parent | a3324e57531186a42feb3aa488556faa67386e9c (diff) | |
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.
Diffstat (limited to 'gnu/installer')
| -rw-r--r-- | gnu/installer/keymap.scm | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gnu/installer/keymap.scm b/gnu/installer/keymap.scm index c42b308009d..83b65a0427f 100644 --- a/gnu/installer/keymap.scm +++ b/gnu/installer/keymap.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> | 2 | ;;; Copyright © 2018, 2021 Mathieu Othacehe <othacehe@gnu.org> |
| 3 | ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> | 3 | ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| @@ -79,6 +79,11 @@ | |||
| 79 | "Parse FILE and return two values, the list of supported X11-KEYMAP-MODEL | 79 | "Parse FILE and return two values, the list of supported X11-KEYMAP-MODEL |
| 80 | and X11-KEYMAP-LAYOUT records. FILE is an XML file from the X Keyboard | 80 | and X11-KEYMAP-LAYOUT records. FILE is an XML file from the X Keyboard |
| 81 | Configuration Database, describing possible XKB configurations." | 81 | Configuration Database, describing possible XKB configurations." |
| 82 | (define maybe-empty | ||
| 83 | (match-lambda | ||
| 84 | ((x) x) | ||
| 85 | (#f ""))) | ||
| 86 | |||
| 82 | (define (model m) | 87 | (define (model m) |
| 83 | (sxml-match m | 88 | (sxml-match m |
| 84 | [(model | 89 | [(model |
| @@ -108,7 +113,7 @@ Configuration Database, describing possible XKB configurations." | |||
| 108 | . ,rest-variant)) | 113 | . ,rest-variant)) |
| 109 | (x11-keymap-variant | 114 | (x11-keymap-variant |
| 110 | (name name) | 115 | (name name) |
| 111 | (description (car | 116 | (description (maybe-empty |
| 112 | (assoc-ref rest-variant 'description))))])) | 117 | (assoc-ref rest-variant 'description))))])) |
| 113 | 118 | ||
| 114 | (define (layout l) | 119 | (define (layout l) |
| @@ -120,9 +125,9 @@ Configuration Database, describing possible XKB configurations." | |||
| 120 | (variantList ,[variant -> v] ...)) | 125 | (variantList ,[variant -> v] ...)) |
| 121 | (x11-keymap-layout | 126 | (x11-keymap-layout |
| 122 | (name name) | 127 | (name name) |
| 123 | (synopsis (car | 128 | (synopsis (maybe-empty |
| 124 | (assoc-ref rest-layout 'shortDescription))) | 129 | (assoc-ref rest-layout 'shortDescription))) |
| 125 | (description (car | 130 | (description (maybe-empty |
| 126 | (assoc-ref rest-layout 'description))) | 131 | (assoc-ref rest-layout 'description))) |
| 127 | (variants (list v ...)))] | 132 | (variants (list v ...)))] |
| 128 | [(layout | 133 | [(layout |
| @@ -131,9 +136,9 @@ Configuration Database, describing possible XKB configurations." | |||
| 131 | . ,rest-layout)) | 136 | . ,rest-layout)) |
| 132 | (x11-keymap-layout | 137 | (x11-keymap-layout |
| 133 | (name name) | 138 | (name name) |
| 134 | (synopsis (car | 139 | (synopsis (maybe-empty |
| 135 | (assoc-ref rest-layout 'shortDescription))) | 140 | (assoc-ref rest-layout 'shortDescription))) |
| 136 | (description (car | 141 | (description (maybe-empty |
| 137 | (assoc-ref rest-layout 'description))) | 142 | (assoc-ref rest-layout 'description))) |
| 138 | (variants '()))])) | 143 | (variants '()))])) |
| 139 | 144 | ||
