all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: 34195@debbugs.gnu.org, ludo@gnu.org
Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies.
Date: Fri, 25 Jan 2019 12:48:38 +0100	[thread overview]
Message-ID: <20190125114838.8680-1-dannym@scratchpost.org> (raw)
In-Reply-To: <20190125113032.8372-1-dannym@scratchpost.org>

* gnu/build/linux-modules.scm (not-softdep-whitespace): New variable.
(module-soft-dependencies): New procedure.
---
 gnu/build/linux-modules.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 2d8117504..1632f20d5 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,37 @@ 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 mode 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 _ ...)
+        (if (string=? (string-take-right token 1) ":") ; section
+            (loop value
+                  (cdr tokens)
+                  (string-trim-both token))
+            (loop (cons (cons section token) value)
+                  (cdr tokens)
+                  section)))
+       (()
+        value))))
+
+  ;; Note: Multiple 'softdep sections are allowed.
+  (let ((info (modinfo-section-contents file)))
+    (apply append
+     (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)))

  reply	other threads:[~2019-01-25 11:49 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         ` Danny Milosavljevic [this message]
2019-01-25 17:07           ` [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies 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                       ` [bug#34195] [PATCH v2] " Danny Milosavljevic
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=20190125114838.8680-1-dannym@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=34195@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.