all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: 34195-done@debbugs.gnu.org, ludo@gnu.org
Subject: [bug#34195] [PATCH v2] linux-modules: module-soft-dependencies: Partition the result and return it as two lists.
Date: Sat, 26 Jan 2019 17:23:13 +0100	[thread overview]
Message-ID: <20190126162313.31998-1-dannym@scratchpost.org> (raw)
In-Reply-To: <20190126161919.31889-1-dannym@scratchpost.org>

* gnu/build/linux-modules.scm (module-soft-dependencies): Partition the
result and return it as two lists.
---
 gnu/build/linux-modules.scm | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index d69bcbf5a..d99d1f01a 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."

  reply	other threads:[~2019-01-26 16:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 19:48 bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Vagrant Cascadian
2019-01-23 10:54 ` Ludovic Courtès
2019-01-23 17:48   ` Vagrant Cascadian
2019-01-25  8:59     ` Ludovic Courtès
2019-01-25 11:30       ` [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies Danny Milosavljevic
2019-01-25 11:48         ` [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies Danny Milosavljevic
2019-01-25 17:07           ` Ludovic Courtès
2019-01-25 17:25             ` bug#34195: " Danny Milosavljevic
2019-01-26 14:10               ` [bug#34195] " Ludovic Courtès
2019-01-26 15:00                 ` Danny Milosavljevic
2019-01-26 15:19                   ` Ludovic Courtès
2019-01-26 16:19                     ` [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists Danny Milosavljevic
2019-01-26 16:23                       ` Danny Milosavljevic [this message]
2019-01-23 17:54   ` bug#34162: linux-libre 4.20+ fails to mount ext4 on aarch64 Efraim Flashner
2019-01-23 17:57     ` Efraim Flashner
2019-01-25  8:49       ` Ludovic Courtès
2019-01-23 20:58 ` Mark H Weaver
2019-01-24  0:44   ` Vagrant Cascadian
2019-01-24  4:02     ` Mark H Weaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190126162313.31998-1-dannym@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=34195-done@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.