[PATCH] system: Automatically adjust linux-module packages to use the operating-system's kernel.

  • Done
  • quality assurance status badge
Details
2 participants
  • Brice Waegeneire
  • Danny Milosavljevic
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 5 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20200413114359.26652-1-dannym@scratchpost.org
* gnu/system.scm (package-for-kernel): New procedure.
(operating-system-directory-base-entries): Use it.
* gnu/tests/linux-module.scm: Test it.
---
gnu/system.scm | 18 +++++++++++++++++-
gnu/tests/linux-modules.scm | 11 ++++++++++-
2 files changed, 27 insertions(+), 2 deletions(-)

Toggle diff (72 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index fd456c6206..53c16233a1 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -32,6 +32,7 @@
#:use-module (guix derivations)
#:use-module (guix profiles)
#:use-module (guix ui)
+ #:use-module (guix utils)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages guile)
@@ -472,6 +473,16 @@ OS."
(file-append (operating-system-kernel os)
"/" (system-linux-image-file-name)))
+(define (package-for-kernel target-kernel module-package)
+ "Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if
+possible (that is if there's a LINUX keyword argument in the build system)."
+ (package
+ (inherit module-package)
+ (arguments
+ (substitute-keyword-arguments (package-arguments module-package)
+ ((#:linux kernel #f)
+ target-kernel)))))
+
(define* (operating-system-directory-base-entries os)
"Return the basic entries of the 'system' directory of OS for use as the
value of the SYSTEM-SERVICE-TYPE service."
@@ -486,7 +497,12 @@ value of the SYSTEM-SERVICE-TYPE service."
(kernel
(profile-derivation
(packages->manifest
- (cons kernel modules))
+ (cons kernel
+ (map (lambda (module)
+ (if (package? module)
+ (package-for-kernel kernel module)
+ module))
+ modules)))
#:hooks (if has-modules?
(list linux-module-database)
'())))
diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm
index 788bdc848a..953b132ef7 100644
--- a/gnu/tests/linux-modules.scm
+++ b/gnu/tests/linux-modules.scm
@@ -28,8 +28,10 @@
#:use-module (guix derivations)
#:use-module (guix gexp)
#:use-module (guix modules)
+ #:use-module (guix packages)
#:use-module (guix monads)
#:use-module (guix store)
+ #:use-module (guix utils)
#:export (%test-loadable-kernel-modules-0
%test-loadable-kernel-modules-1
%test-loadable-kernel-modules-2))
@@ -118,5 +120,12 @@ with one extra module.")
(description "Tests loadable kernel modules facility of <operating-system>
with two extra modules.")
(value (run-loadable-kernel-modules-test
- (list acpi-call-linux-module ddcci-driver-linux)
+ (list acpi-call-linux-module
+ (package
+ (inherit ddcci-driver-linux)
+ (arguments
+ `(#:linux #f
+ ,@(strip-keyword-arguments '(#:linux)
+ (package-arguments
+ ddcci-driver-linux))))))
'("acpi_call" "ddcci")))))
Brice Waegeneire wrote 5 years ago
Re: [PATCH] system: Automatically adjust linux-module packages to use the
(address . 40595@debbugs.gnu.org)
d8161d91f151446e3f6378379246442a@waegenei.re
Hello Danny,

Thanks for the patch, I needed such feature.
It works well and the test pass; LGTM!

- Brice
Brice Waegeneire wrote 5 years ago
#40595 Need a rebase
(address . 40595@debbugs.gnu.org)
519959959ea79cd1dcafb869320313a9@waegenei.re
Hello Danny,

Looks like this patch need to be rebased.

Cheers,
- Brice
Danny Milosavljevic wrote 5 years ago
Re: [bug#40595] [PATCH] system: Automatically adjust linux-module packages to use the
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 40595-done@debbugs.gnu.org)
20200422225957.652aad1d@scratchpost.org
Hi Brice,

yes, indeed.

Thanks.

I've rebased it and pushed it to guix master as commit f91ad0b13d8d3d5b1ae92e209b1be6e8473385ba.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl6gsE0ACgkQ5xo1VCww
uqWPGQgAoiKhBlNn4OXZWMDZ6UonsVJa+5C3DdwZyM07vvUPyWJKiP4MwOKBMD0R
fTy6wD5tHmj7R9c+rBN8Sp5E0L9LxsThh0CdPzNSYxR1pNfa/GicxSCpvTXMedP9
kGdytULoQS6LOkLjphig+jSX1TPArdd16rS7PDPAgmhhNwpnCR8QLnRwV1iF7/6t
IYiAArnGAZ1d3UJmeU59ShG4NxoUu/75r5yxYZDDXRyaQDVr6iRSHI85b08BkxJo
dKTj9yGlGYnzesM+ZpNBrdX7qoZa0OyHJoMT+ZKrVua4FU11fOZS15RV8Evv+RZl
dUD6nnX3s7nDgg7vqjzY6e4me0MJyA==
=NwzB
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 40595@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 40595
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help