From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH] linux-modules: Add module-soft-dependencies. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Jan 2019 11:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34195@debbugs.gnu.org, ludo@gnu.org Cc: Danny Milosavljevic X-Debbugs-Original-To: guix-patches@gnu.org, ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154841585912241 (code B ref -1); Fri, 25 Jan 2019 11:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2019 11:30:59 +0000 Received: from localhost ([127.0.0.1]:44600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gmzhL-0003BN-16 for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:30:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gmzhI-0003B8-MG for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:30:56 -0500 Received: from lists.gnu.org ([209.51.188.17]:54636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmzhC-0001bd-48 for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:30:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzhB-0000hO-Cg for guix-patches@gnu.org; Fri, 25 Jan 2019 06:30:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmzh9-0001Zn-D7 for guix-patches@gnu.org; Fri, 25 Jan 2019 06:30:49 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:44334) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmzh9-0001XS-6t; Fri, 25 Jan 2019 06:30:47 -0500 Received: from dayas.3.home (178.112.231.18.wireless.dyn.drei.com [178.112.231.18]) by dd26836.kasserver.com (Postfix) with ESMTPSA id A72A0336006B; Fri, 25 Jan 2019 12:30:41 +0100 (CET) From: Danny Milosavljevic Date: Fri, 25 Jan 2019 12:30:32 +0100 Message-Id: <20190125113032.8372-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <87h8dxru3m.fsf@gnu.org> References: <87h8dxru3m.fsf@gnu.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 85.13.145.193 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/build/linux-modules.scm (not-softdep-whitespace): New variable. (module-soft-dependencies): New procedure. --- gnu/build/linux-modules.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index 2d8117504..631c5f577 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,42 @@ contains module names, not actual file names." (('depends . what) (string-tokenize what %not-comma))))) =20 +(define not-softdep-whitespace + (char-set-complement (char-set #\space #\tab))) + +(define (module-soft-dependencies file) + "Return the list of soft dependencies of module FILE." + (define (add-to-first-acons value alist) + (match alist + (((k . v) . b) + (cons (cons k (cons value v)) b)))) + + ;; 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=3D? (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))) From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Jan 2019 11:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34195@debbugs.gnu.org, ludo@gnu.org Cc: Danny Milosavljevic Received: via spool by 34195-submit@debbugs.gnu.org id=B34195.154841693113799 (code B ref 34195); Fri, 25 Jan 2019 11:49:01 +0000 Received: (at 34195) by debbugs.gnu.org; 25 Jan 2019 11:48:51 +0000 Received: from localhost ([127.0.0.1]:44605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gmzyc-0003aV-M2 for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:48:50 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:51390) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gmzya-0003aN-R3 for 34195@debbugs.gnu.org; Fri, 25 Jan 2019 06:48:49 -0500 Received: from dayas.3.home (178.112.231.18.wireless.dyn.drei.com [178.112.231.18]) by dd26836.kasserver.com (Postfix) with ESMTPSA id EF88B33614B8; Fri, 25 Jan 2019 12:48:46 +0100 (CET) From: Danny Milosavljevic Date: Fri, 25 Jan 2019 12:48:38 +0100 Message-Id: <20190125114838.8680-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190125113032.8372-1-dannym@scratchpost.org> References: <20190125113032.8372-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * 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))) From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Jan 2019 17:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 34195@debbugs.gnu.org Received: via spool by 34195-submit@debbugs.gnu.org id=B34195.15484360342714 (code B ref 34195); Fri, 25 Jan 2019 17:08:01 +0000 Received: (at 34195) by debbugs.gnu.org; 25 Jan 2019 17:07:14 +0000 Received: from localhost ([127.0.0.1]:45496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gn4wj-0000hi-Rj for submit@debbugs.gnu.org; Fri, 25 Jan 2019 12:07:14 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:39132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gn4wh-0000hZ-Cf for 34195@debbugs.gnu.org; Fri, 25 Jan 2019 12:07:12 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F02AC69FC; Fri, 25 Jan 2019 18:07:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JGRdV2ldliSh; Fri, 25 Jan 2019 18:07:08 +0100 (CET) Received: from ribbon (unknown [IPv6:2001:660:6102:320:e120:2c8f:8909:cdfe]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C7B9D69FB; Fri, 25 Jan 2019 18:07:07 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190125113032.8372-1-dannym@scratchpost.org> <20190125114838.8680-1-dannym@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 6 =?UTF-8?Q?Pluvi=C3=B4se?= an 227 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 25 Jan 2019 18:07:07 +0100 In-Reply-To: <20190125114838.8680-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Fri, 25 Jan 2019 12:48:38 +0100") Message-ID: <87bm44oedg.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hi Danny, Danny Milosavljevic skribis: > * gnu/build/linux-modules.scm (not-softdep-whitespace): New variable. > (module-soft-dependencies): New procedure. That was fast! :-) [...] > +(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=3D? (string-take-right token 1) ":") ; section > + (loop value > + (cdr tokens) > + (string-trim-both token)) You can use the pattern (token rest ...) and then: (loop value rest (string-trim-both token)) instead of the not-so-nice =E2=80=98cdr=E2=80=99. :-) > + (let ((info (modinfo-section-contents file))) > + (apply append > + (filter-map (match-lambda > + (('softdep . value) > + (parse-softdep value)) > + (_ #f)) > + (modinfo-section-contents file))))) Replace =E2=80=98apply append=E2=80=99 with =E2=80=98concatenate=E2=80=99. OK with these changes, thank you! Ludo=E2=80=99. From unknown Mon Jun 23 04:15:40 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Danny Milosavljevic Subject: bug#34195: closed (Re: [PATCH v2] linux-modules: Add modules-soft-dependencies.) Message-ID: References: <20190125182537.0535b710@scratchpost.org> <20190125113032.8372-1-dannym@scratchpost.org> X-Gnu-PR-Message: they-closed 34195 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 34195@debbugs.gnu.org Date: Fri, 25 Jan 2019 17:26:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1548437163-4634-1" This is a multi-part message in MIME format... ------------=_1548437163-4634-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #34195: [PATCH] linux-modules: Add module-soft-dependencies. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 34195@debbugs.gnu.org. --=20 34195: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D34195 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1548437163-4634-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 34195-done) by debbugs.gnu.org; 25 Jan 2019 17:25:45 +0000 Received: from localhost ([127.0.0.1]:45520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gn5Ee-0001CD-Kw for submit@debbugs.gnu.org; Fri, 25 Jan 2019 12:25:44 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:51966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gn5Ec-0001C5-OD for 34195-done@debbugs.gnu.org; Fri, 25 Jan 2019 12:25:43 -0500 Received: from localhost (178.113.131.130.wireless.dyn.drei.com [178.113.131.130]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 39AF4336031B; Fri, 25 Jan 2019 18:25:41 +0100 (CET) Date: Fri, 25 Jan 2019 18:25:37 +0100 From: Danny Milosavljevic To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Subject: Re: [PATCH v2] linux-modules: Add modules-soft-dependencies. Message-ID: <20190125182537.0535b710@scratchpost.org> In-Reply-To: <87bm44oedg.fsf@gnu.org> References: <20190125113032.8372-1-dannym@scratchpost.org> <20190125114838.8680-1-dannym@scratchpost.org> <87bm44oedg.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/vzV60tToxFvWL=r=qG_0EIT"; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 34195-done Cc: 34195-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/vzV60tToxFvWL=r=qG_0EIT Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Ludo, >That was fast! :-) Yeah, I dislike ticking boot time bombs ;-) Thanks for the review! Pushed as 1a5f46621b44aa1458ad7acd4eca5fe1d4574f92=20 and 519be98c3536b5113cde368f9dc6db2e1ebe073e (tiny fix) to guix master. Note that it returns something like (("pre" . "module-1") ("pre" . "module-2")) So the user might want to (1) map cdr (or match ;) ) it (2) replace dashes by underscores if a filename is desired (normalize-modul= e-name) (although in practise nobody in the mainline Linux seems to use dashes there right now, their example in include/linux/module.h has dashes :P) Example result: scheme> (module-soft-dependencies "/tmp/vfio.ko") $2 =3D (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1")) --Sig_/vzV60tToxFvWL=r=qG_0EIT Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlxLRpEACgkQ5xo1VCww uqWNPQf8DXkHQZbnZHYXglmni38TXv/PDFHMli0ggI2fuUxVNnxDOh8Zx58u7Ffm GTreJx+KEYrXk30lyaoaTGYig6DCCDrJIlSa6UD2e1WZgRIq19yBFxYc4aYJWvnf FQDYUbg6afvacms4Cr+cq14S6VST3zpvxVySSYiD+HkgEYbu32cFfngZ+a30Fzaz EJBZtirLkwVZnJUhFw/l4FVzXuX5GBPQxAUTEE4RDzwE+QEYbroH9vzbbRzg1/H1 FvjYulGerBaa5L8snsr+OCj5DpC2frteq+MdPnyG1poo/33Wxp/awk7VhrNigQQp QfuCizEyKDaqDCli3/m/gSMhsr33Rw== =HldS -----END PGP SIGNATURE----- --Sig_/vzV60tToxFvWL=r=qG_0EIT-- ------------=_1548437163-4634-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Jan 2019 11:30:59 +0000 Received: from localhost ([127.0.0.1]:44600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gmzhL-0003BN-16 for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:30:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44413) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gmzhI-0003B8-MG for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:30:56 -0500 Received: from lists.gnu.org ([209.51.188.17]:54636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmzhC-0001bd-48 for submit@debbugs.gnu.org; Fri, 25 Jan 2019 06:30:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmzhB-0000hO-Cg for guix-patches@gnu.org; Fri, 25 Jan 2019 06:30:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmzh9-0001Zn-D7 for guix-patches@gnu.org; Fri, 25 Jan 2019 06:30:49 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:44334) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmzh9-0001XS-6t; Fri, 25 Jan 2019 06:30:47 -0500 Received: from dayas.3.home (178.112.231.18.wireless.dyn.drei.com [178.112.231.18]) by dd26836.kasserver.com (Postfix) with ESMTPSA id A72A0336006B; Fri, 25 Jan 2019 12:30:41 +0100 (CET) From: Danny Milosavljevic To: guix-patches@gnu.org, ludo@gnu.org Subject: [PATCH] linux-modules: Add module-soft-dependencies. Date: Fri, 25 Jan 2019 12:30:32 +0100 Message-Id: <20190125113032.8372-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <87h8dxru3m.fsf@gnu.org> References: <87h8dxru3m.fsf@gnu.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 85.13.145.193 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: Danny Milosavljevic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/build/linux-modules.scm (not-softdep-whitespace): New variable. (module-soft-dependencies): New procedure. --- gnu/build/linux-modules.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index 2d8117504..631c5f577 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,42 @@ contains module names, not actual file names." (('depends . what) (string-tokenize what %not-comma))))) =20 +(define not-softdep-whitespace + (char-set-complement (char-set #\space #\tab))) + +(define (module-soft-dependencies file) + "Return the list of soft dependencies of module FILE." + (define (add-to-first-acons value alist) + (match alist + (((k . v) . b) + (cons (cons k (cons value v)) b)))) + + ;; 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=3D? (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))) ------------=_1548437163-4634-1-- From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Jan 2019 14:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 34195-done@debbugs.gnu.org Received: via spool by 34195-done@debbugs.gnu.org id=D34195.154851183828380 (code D ref 34195); Sat, 26 Jan 2019 14:11:02 +0000 Received: (at 34195-done) by debbugs.gnu.org; 26 Jan 2019 14:10:38 +0000 Received: from localhost ([127.0.0.1]:45913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnOfO-0007Ne-Em for submit@debbugs.gnu.org; Sat, 26 Jan 2019 09:10:38 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:53220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnOfG-0007NQ-9h for 34195-done@debbugs.gnu.org; Sat, 26 Jan 2019 09:10:37 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 2EC57746D; Sat, 26 Jan 2019 15:10:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AWL1OxU-mtlJ; Sat, 26 Jan 2019 15:10:28 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 19201746C; Sat, 26 Jan 2019 15:10:27 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190125113032.8372-1-dannym@scratchpost.org> <20190125114838.8680-1-dannym@scratchpost.org> <87bm44oedg.fsf@gnu.org> <20190125182537.0535b710@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 7 =?UTF-8?Q?Pluvi=C3=B4se?= an 227 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 26 Jan 2019 15:10:27 +0100 In-Reply-To: <20190125182537.0535b710@scratchpost.org> (Danny Milosavljevic's message of "Fri, 25 Jan 2019 18:25:37 +0100") Message-ID: <87womrjyr0.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello, Danny Milosavljevic skribis: > scheme> (module-soft-dependencies "/tmp/vfio.ko") > $2 =3D (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1")) That=E2=80=99s probably not the best interface. :-) Perhaps it should return two values: the list of modules to be loaded before (=E2=80=9Cpre=E2=80=9D), followed by the list of modules to be loade= d after (=E2=80=9Cpost=E2=80=9D). WDYT? Ludo=E2=80=99. From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Jan 2019 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 34195-done@debbugs.gnu.org Received: via spool by 34195-done@debbugs.gnu.org id=D34195.15485148461530 (code D ref 34195); Sat, 26 Jan 2019 15:01:02 +0000 Received: (at 34195-done) by debbugs.gnu.org; 26 Jan 2019 15:00:46 +0000 Received: from localhost ([127.0.0.1]:46686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnPRt-0000Oc-N0 for submit@debbugs.gnu.org; Sat, 26 Jan 2019 10:00:45 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:39220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnPRr-0000OS-3v for 34195-done@debbugs.gnu.org; Sat, 26 Jan 2019 10:00:43 -0500 Received: from localhost (178.113.131.130.wireless.dyn.drei.com [178.113.131.130]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 46055336041D; Sat, 26 Jan 2019 16:00:41 +0100 (CET) Date: Sat, 26 Jan 2019 16:00:36 +0100 From: Danny Milosavljevic Message-ID: <20190126160036.17dda684@scratchpost.org> In-Reply-To: <87womrjyr0.fsf@gnu.org> References: <20190125113032.8372-1-dannym@scratchpost.org> <20190125114838.8680-1-dannym@scratchpost.org> <87bm44oedg.fsf@gnu.org> <20190125182537.0535b710@scratchpost.org> <87womrjyr0.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/K3Uo0z3ou=D55/YIM4q.mFG"; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --Sig_/K3Uo0z3ou=D55/YIM4q.mFG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, On Sat, 26 Jan 2019 15:10:27 +0100 Ludovic Court=C3=A8s wrote: > Danny Milosavljevic skribis: >=20 > > scheme> (module-soft-dependencies "/tmp/vfio.ko") =20 > > $2 =3D (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1")= ) =20 >=20 > That=E2=80=99s probably not the best interface. :-) >=20 > Perhaps it should return two values: the list of modules to be loaded > before (=E2=80=9Cpre=E2=80=9D), followed by the list of modules to be loa= ded after > (=E2=80=9Cpost=E2=80=9D). I had thought about it - but for our use case it makes it slower and more complicated. I still have the previous version (see below). Moreover, it did the wrong thing for multiple 'softdep sections. I guess I can use an external grouper routine (something like a hypothetical group-by-first - does it exist?) on the result of module-soft-dependencies. But at that point the caller can call it himself :-> We could hard-code "pre" and "post" as the two only possible sections (and kmod does), but that would make it break in the future even though we don't care about the sections, just the module names. Complicated version: (define (module-soft-dependencies file) "Return the list of soft dependencies of module FILE." (define (add-to-first-acons value alist) (match alist (((k . v) . b) (cons (cons k (cons value v)) b)))) (define (parse-softdep text) (let loop ((value '()) (tokens (string-tokenize text not-softdep-whitespace)) (section #f)) (write tokens) (newline) (match tokens ((token _ ...) (if (string=3D? (string-take-right token 1) ":") ; section (loop (acons (string-drop-right token 1) '() value) (cdr tokens) (string-trim-both token)) (loop (add-to-first-acons token value) (cdr tokens) section))) (() value)))) (let ((info (modinfo-section-contents file))) (filter-map (match-lambda (('softdep . value) (parse-softdep value)) (_ #f)) (modinfo-section-contents file)))) --Sig_/K3Uo0z3ou=D55/YIM4q.mFG Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlxMdhQACgkQ5xo1VCww uqXqOQgAlVZm/4VW+vELWXvdxOt0CEhDFO5oyFuT9lf69wQEQgZOoJHagWauL21+ xJjC6E0dCRDYB/M1uuBAEY5Bxvwqgtoo1zspp2nb6GEWySnMCSv0oCmWmfanDNUL oSg899KGF7Uc6Ry6pJ1tAGZk6D8szzOZMSmE0LIdUAeX2wEEmj82pNb80svSyFG4 AH7e42IPi95W2cIBBx58oGj25Nsy2H6W1bhCkcF4mmYr6FnTAVrDxbY+0ioD+t+Q 5/PnE5a4MWBWlZwYLVCzL8pSZAD9BdcJrbwSkbpqS/pd9f87fve1T/HL/ahSlXJQ bb7lMdQf3+QN2u0nyCYIfa2GyrvW0Q== =sTur -----END PGP SIGNATURE----- --Sig_/K3Uo0z3ou=D55/YIM4q.mFG-- From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH v2] linux-modules: Add modules-soft-dependencies. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Jan 2019 15:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Danny Milosavljevic Cc: 34195-done@debbugs.gnu.org Received: via spool by 34195-done@debbugs.gnu.org id=D34195.15485159613427 (code D ref 34195); Sat, 26 Jan 2019 15:20:02 +0000 Received: (at 34195-done) by debbugs.gnu.org; 26 Jan 2019 15:19:21 +0000 Received: from localhost ([127.0.0.1]:46707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnPjt-0000tD-7i for submit@debbugs.gnu.org; Sat, 26 Jan 2019 10:19:21 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:53784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnPjr-0000t4-Hg for 34195-done@debbugs.gnu.org; Sat, 26 Jan 2019 10:19:20 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E5C2A74B8; Sat, 26 Jan 2019 16:19:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VhEiY474gsgG; Sat, 26 Jan 2019 16:19:16 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 1FE4E74A9; Sat, 26 Jan 2019 16:19:16 +0100 (CET) From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190125113032.8372-1-dannym@scratchpost.org> <20190125114838.8680-1-dannym@scratchpost.org> <87bm44oedg.fsf@gnu.org> <20190125182537.0535b710@scratchpost.org> <87womrjyr0.fsf@gnu.org> <20190126160036.17dda684@scratchpost.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 7 =?UTF-8?Q?Pluvi=C3=B4se?= an 227 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 26 Jan 2019 16:19:15 +0100 In-Reply-To: <20190126160036.17dda684@scratchpost.org> (Danny Milosavljevic's message of "Sat, 26 Jan 2019 16:00:36 +0100") Message-ID: <87zhrnigzw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Danny Milosavljevic skribis: > On Sat, 26 Jan 2019 15:10:27 +0100 > Ludovic Court=C3=A8s wrote: > >> Danny Milosavljevic skribis: >>=20 >> > scheme> (module-soft-dependencies "/tmp/vfio.ko")=20=20 >> > $2 =3D (("post" . "vfio_iommu_spapr_tce") ("post" . "vfio_iommu_type1"= ))=20=20 >>=20 >> That=E2=80=99s probably not the best interface. :-) >>=20 >> Perhaps it should return two values: the list of modules to be loaded >> before (=E2=80=9Cpre=E2=80=9D), followed by the list of modules to be lo= aded after >> (=E2=80=9Cpost=E2=80=9D). > > I had thought about it - but for our use case it makes it slower and more > complicated. Once you have the result above, you can simply do: (partition (match-lambda (("pre" . _) #t) (("post" . _) #f)) $2) and then remove the cars. Or you can fold over the elements instead of constructing the alist in the first place. Anyway it should be a few more lines at most, I think. Ludo=E2=80=99. From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH] linux-modules: module-soft-dependencies: Partition the result and return it as two lists. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Jan 2019 16:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34195-done@debbugs.gnu.org, ludo@gnu.org Cc: Danny Milosavljevic Received: via spool by 34195-done@debbugs.gnu.org id=D34195.15485195809661 (code D ref 34195); Sat, 26 Jan 2019 16:20:01 +0000 Received: (at 34195-done) by debbugs.gnu.org; 26 Jan 2019 16:19:40 +0000 Received: from localhost ([127.0.0.1]:46737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnQgG-0002Vl-Ed for submit@debbugs.gnu.org; Sat, 26 Jan 2019 11:19:40 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:45532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnQgD-0002Vb-S5 for 34195-done@debbugs.gnu.org; Sat, 26 Jan 2019 11:19:39 -0500 Received: from dayas.3.home (178.113.131.130.wireless.dyn.drei.com [178.113.131.130]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 1790E336006C; Sat, 26 Jan 2019 17:19:36 +0100 (CET) From: Danny Milosavljevic Date: Sat, 26 Jan 2019 17:19:19 +0100 Message-Id: <20190126161919.31889-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <87zhrnigzw.fsf@gnu.org> References: <87zhrnigzw.fsf@gnu.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/build/linux-modules.scm (module-soft-dependencies): Partition the result and return it as two lists. --- gnu/build/linux-modules.scm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index d69bcbf5a..16c8fad28 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,19 @@ 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 cdr pres) (map cdr posts))))) (define (module-aliases file) "Return the list of aliases of module FILE." From unknown Mon Jun 23 04:15:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#34195] [PATCH v2] linux-modules: module-soft-dependencies: Partition the result and return it as two lists. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 26 Jan 2019 16:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34195 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 34195-done@debbugs.gnu.org, ludo@gnu.org Cc: Danny Milosavljevic Received: via spool by 34195-done@debbugs.gnu.org id=D34195.154851980710057 (code D ref 34195); Sat, 26 Jan 2019 16:24:01 +0000 Received: (at 34195-done) by debbugs.gnu.org; 26 Jan 2019 16:23:27 +0000 Received: from localhost ([127.0.0.1]:46741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnQjv-0002c8-0R for submit@debbugs.gnu.org; Sat, 26 Jan 2019 11:23:27 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:45822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnQjt-0002c0-1D for 34195-done@debbugs.gnu.org; Sat, 26 Jan 2019 11:23:25 -0500 Received: from dayas.3.home (178.113.131.130.wireless.dyn.drei.com [178.113.131.130]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 0E51B336006C; Sat, 26 Jan 2019 17:23:23 +0100 (CET) From: Danny Milosavljevic Date: Sat, 26 Jan 2019 17:23:13 +0100 Message-Id: <20190126162313.31998-1-dannym@scratchpost.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190126161919.31889-1-dannym@scratchpost.org> References: <20190126161919.31889-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * 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."