linux-modules: Add module-soft-dependencies.
* gnu/build/linux-modules.scm (not-softdep-whitespace): New variable. (module-soft-dependencies): New procedure.
This commit is contained in:
parent
1faf0a0459
commit
1a5f46621b
1 changed files with 28 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
||||||
ensure-dot-ko
|
ensure-dot-ko
|
||||||
module-aliases
|
module-aliases
|
||||||
module-dependencies
|
module-dependencies
|
||||||
|
module-soft-dependencies
|
||||||
normalize-module-name
|
normalize-module-name
|
||||||
file-name->module-name
|
file-name->module-name
|
||||||
find-module-file
|
find-module-file
|
||||||
|
@ -100,6 +101,33 @@ contains module names, not actual file names."
|
||||||
(('depends . what)
|
(('depends . what)
|
||||||
(string-tokenize what %not-comma)))))
|
(string-tokenize what %not-comma)))))
|
||||||
|
|
||||||
|
(define not-softdep-whitespace
|
||||||
|
(char-set-complement (char-set #\space #\tab)))
|
||||||
|
|
||||||
|
(define (module-soft-dependencies file)
|
||||||
|
"Return a list of (cons section soft-dependency) of module FILE."
|
||||||
|
;; TEXT: "pre: baz blubb foo post: bax bar"
|
||||||
|
(define (parse-softdep text)
|
||||||
|
(let loop ((value '())
|
||||||
|
(tokens (string-tokenize text not-softdep-whitespace))
|
||||||
|
(section #f))
|
||||||
|
(match tokens
|
||||||
|
((token rest ...)
|
||||||
|
(if (string=? (string-take-right token 1) ":") ; section
|
||||||
|
(loop value rest (string-trim-both token))
|
||||||
|
(loop (cons (cons section token) value) rest section)))
|
||||||
|
(()
|
||||||
|
value))))
|
||||||
|
|
||||||
|
;; Note: Multiple 'softdep sections are allowed.
|
||||||
|
(let ((info (modinfo-section-contents file)))
|
||||||
|
(concatenate
|
||||||
|
(filter-map (match-lambda
|
||||||
|
(('softdep . value)
|
||||||
|
(parse-softdep value))
|
||||||
|
(_ #f))
|
||||||
|
(modinfo-section-contents file)))))
|
||||||
|
|
||||||
(define (module-aliases file)
|
(define (module-aliases file)
|
||||||
"Return the list of aliases of module FILE."
|
"Return the list of aliases of module FILE."
|
||||||
(let ((info (modinfo-section-contents file)))
|
(let ((info (modinfo-section-contents file)))
|
||||||
|
|
Reference in a new issue