diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-01-31 23:32:56 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-01-31 23:32:56 +0100 |
commit | 0747328e317de4bf936fab50e795d1e1523adfc1 (patch) | |
tree | 291d4f07a801b147d64faec31e4394c5cd46ce35 /gnu/build | |
parent | df09e1d6e71f68a8fb44bcc9f13e625f9f9701a5 (diff) | |
parent | ff75441fcf0ba1212b0342f933a8999bafe60f03 (diff) | |
download | guix-0747328e317de4bf936fab50e795d1e1523adfc1.tar guix-0747328e317de4bf936fab50e795d1e1523adfc1.tar.gz |
Merge branch 'master' into staging
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/linux-modules.scm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index 2d81175041..d69bcbf5a2 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -33,6 +33,7 @@ ensure-dot-ko module-aliases module-dependencies + module-soft-dependencies normalize-module-name file-name->module-name find-module-file @@ -100,6 +101,33 @@ contains module names, not actual file names." (('depends . what) (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 (string-drop-right token 1))) + (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) "Return the list of aliases of module FILE." (let ((info (modinfo-section-contents file))) |