mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-26 22:38:07 -05:00
kconfig: Move pair->config-string up.
* guix/build/kconfig.scm (pair->config-string): Move earlier, to match the natural dependency of declarations (useful when experimenting at the REPL).
This commit is contained in:
parent
4a4f2d226e
commit
d368210af5
1 changed files with 10 additions and 10 deletions
|
@ -31,6 +31,16 @@ (define-module (guix build kconfig)
|
||||||
;;
|
;;
|
||||||
;; Code:
|
;; Code:
|
||||||
|
|
||||||
|
(define (pair->config-string pair)
|
||||||
|
"Convert a PAIR back to a config-string."
|
||||||
|
(let* ((key (first pair))
|
||||||
|
(value (cdr pair)))
|
||||||
|
(if (string? key)
|
||||||
|
(if (string? value)
|
||||||
|
(string-append key "=" value)
|
||||||
|
(string-append "# " key " is not set"))
|
||||||
|
value)))
|
||||||
|
|
||||||
(define (config-string->pair config-string)
|
(define (config-string->pair config-string)
|
||||||
"Parse a configuration string like \"CONFIG_EXAMPLE=m\" into a key-value pair.
|
"Parse a configuration string like \"CONFIG_EXAMPLE=m\" into a key-value pair.
|
||||||
An error is thrown for invalid configurations.
|
An error is thrown for invalid configurations.
|
||||||
|
@ -77,16 +87,6 @@ (define config-comment-regexp
|
||||||
(cons #f config-string) ;keep valid comments
|
(cons #f config-string) ;keep valid comments
|
||||||
(error "Invalid configuration" config-string)))))
|
(error "Invalid configuration" config-string)))))
|
||||||
|
|
||||||
(define (pair->config-string pair)
|
|
||||||
"Convert a PAIR back to a config-string."
|
|
||||||
(let* ((key (first pair))
|
|
||||||
(value (cdr pair)))
|
|
||||||
(if (string? key)
|
|
||||||
(if (string? value)
|
|
||||||
(string-append key "=" value)
|
|
||||||
(string-append "# " key " is not set"))
|
|
||||||
value)))
|
|
||||||
|
|
||||||
(define (defconfig->alist defconfig)
|
(define (defconfig->alist defconfig)
|
||||||
"Convert the content of a DEFCONFIG (or .config) file into an alist."
|
"Convert the content of a DEFCONFIG (or .config) file into an alist."
|
||||||
(with-input-from-file defconfig
|
(with-input-from-file defconfig
|
||||||
|
|
Loading…
Reference in a new issue