aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/linux-modules.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2019-01-26 17:23:13 +0100
committerDanny Milosavljevic <dannym@scratchpost.org>2019-03-05 13:43:34 +0100
commitf347fb79df1b174c37a1d277b1c1de36684ed1e7 (patch)
treee9a0176084ea1f98a81c66434ed261ed40f9cf7b /gnu/build/linux-modules.scm
parent1a3db0b22fdb4f545fb6fd8ecea478d93ec0ae5a (diff)
downloadguix-f347fb79df1b174c37a1d277b1c1de36684ed1e7.tar
guix-f347fb79df1b174c37a1d277b1c1de36684ed1e7.tar.gz
linux-modules: module-soft-dependencies: Partition the result and return it as two lists.
* gnu/build/linux-modules.scm (module-soft-dependencies): Partition the result and return it as two lists.
Diffstat (limited to 'gnu/build/linux-modules.scm')
-rw-r--r--gnu/build/linux-modules.scm29
1 files changed, 21 insertions, 8 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index d69bcbf5a2..d99d1f01a4 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -25,6 +25,7 @@
#:use-module (rnrs io ports)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (ice-9 vlist)
#:use-module (ice-9 match)
@@ -105,7 +106,8 @@ contains module names, not actual file names."
(char-set-complement (char-set #\space #\tab)))
(define (module-soft-dependencies file)
- "Return a list of (cons section soft-dependency) of module FILE."
+ "Return the list of modules that can be preloaded, and then the list of
+modules that can be postloaded, of the soft dependencies of module FILE."
;; TEXT: "pre: baz blubb foo post: bax bar"
(define (parse-softdep text)
(let loop ((value '())
@@ -120,13 +122,24 @@ contains module names, not actual file names."
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)))))
+ (let* ((info (modinfo-section-contents file))
+ (entries (concatenate
+ (filter-map (match-lambda
+ (('softdep . value)
+ (parse-softdep value))
+ (_ #f))
+ (modinfo-section-contents file)))))
+ (let-values (((pres posts)
+ (partition (match-lambda
+ (("pre" . _) #t)
+ (("post" . _) #f))
+ entries)))
+ (values (map (match-lambda
+ ((_ . value) value))
+ pres)
+ (map (match-lambda
+ ((_ . value) value))
+ posts)))))
(define (module-aliases file)
"Return the list of aliases of module FILE."