diff mbox series

[bug#54539,6/6] gnu: linux: Avoid importing (gnu packages check) to break cycles.

Message ID 20220323184855.25241-6-maximedevos@telenet.be
State New
Headers show
Series Start breaking up import cycles | expand

Commit Message

M March 23, 2022, 6:48 p.m. UTC
This (partially?) breaks a cycle between (gnu packages linux)
and (gnu packages check).  There's more work to be done though,
see future patches -- stay tuned!

* gnu/packages/linux.scm
  (python-pamela,earlyoom,multipath-tools,mtd-utils,procenv):
  Don't import (gnu packages check), instead access that module
  via 'module-ref' + 'resolve-interface'.
---
 gnu/packages/linux.scm | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index c47204dc76..8176533d68 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -92,7 +92,9 @@ 
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages calendar)
-  #:use-module (gnu packages check)
+  ;; Don't import these modules here, otherwise a cycle would result.
+  ;; If needed, use 'module-ref' + 'resolve-interface'.
+  ;; #:use-module (gnu packages check)
   #:use-module (gnu packages cpio)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages cryptsetup)
@@ -1681,7 +1683,10 @@  at login.  Local and dynamic reconfiguration are its key features.")
     (inputs
      (list linux-pam))
     (native-inputs
-     (list python-pytest))
+     ;; Avoid adding Pythonland and GNOMEland to the module closure when
+     ;; all we need is util-linux.
+     (list (module-ref (resolve-interface '(gnu packages check))
+                       'python-pytest)))
     (home-page "https://github.com/minrk/pamela")
     (synopsis "PAM interface using ctypes")
     (description "This package provides a PAM interface using @code{ctypes}.")
@@ -3779,7 +3784,10 @@  from the module-init-tools project.")
           '())
         (list
           ;; For the test suite.
-          cppcheck
+          ;; Avoid adding Pythonland and GNOMEland to the module closure when
+          ;; all we need is util-linux.
+          (module-ref (resolve-interface '(gnu packages check))
+                      'cppcheck)
           ;; Avoid adding 'golang' and its dependencies Rubyland and
           ;; Nodeland to the module closure when all we need is util-linux.
           (module-ref (resolve-interface '(gnu packages golang)) 'go))))
@@ -5183,7 +5191,10 @@  arrays when needed.")
     (native-inputs
      (list perl pkg-config valgrind
            ;; For tests.
-           cmocka))
+           ;; Avoid adding Pythonland and GNOMEland to the module closure when
+           ;; all we need is util-linux.
+           (module-ref (resolve-interface '(gnu packages check))
+                       'cmocka)))
     (inputs
      `(("json-c" ,json-c)
        ("libaio" ,libaio)
@@ -6594,7 +6605,11 @@  exceeded.")
              #~(list)
              #~(list "--enable-unit-tests"))))
     (native-inputs
-     (list cmocka pkg-config))
+     (list ;; Avoid adding Pythonland and GNOMEland to the module closure when
+           ;; all we need is util-linux.
+           (module-ref (resolve-interface '(gnu packages check))
+                       'cmocka)
+           pkg-config))
     (inputs
      `(("acl" ,acl)                     ; extended attributes (xattr)
        ("libuuid" ,util-linux "lib")
@@ -7243,7 +7258,11 @@  the MTP device as a file system.")
    (native-inputs
     (list pkg-config
           ;; For tests.
-          check groff))
+          ;; Avoid adding Pythonland and GNOMEland to the module closure when
+          ;; all we need is util-linux.
+          (module-ref (resolve-interface '(gnu packages check))
+                      'check)
+          groff))
    (inputs
     (list expat libcap libselinux))
    (synopsis "Utility to show process environment")