From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:60307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnQkV-0001dX-0M for guix-patches@gnu.org; Sat, 26 Jan 2019 11:24:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnQkU-0001OD-1Y for guix-patches@gnu.org; Sat, 26 Jan 2019 11:24:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47460) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnQkT-0001O8-UR for guix-patches@gnu.org; Sat, 26 Jan 2019 11:24:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gnQkT-0002d0-MZ for guix-patches@gnu.org; Sat, 26 Jan 2019 11:24:01 -0500 Subject: [bug#34195] [PATCH v2] linux-modules: module-soft-dependencies: Partition the result and return it as two lists. Resent-Message-ID: From: Danny Milosavljevic Date: Sat, 26 Jan 2019 17:23:13 +0100 Message-Id: <20190126162313.31998-1-dannym@scratchpost.org> In-Reply-To: <20190126161919.31889-1-dannym@scratchpost.org> References: <20190126161919.31889-1-dannym@scratchpost.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 34195-done@debbugs.gnu.org, ludo@gnu.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."