Subject: [PATCH 5/6] gnu: earlyoom: Avoid importing Goland and Haskelland to break cycles.

From: Maxime Devos <[email-masked]>
Date: Wed, 23 Mar 2022 18:48:54 +0000

This (partially?) breaks a cycle between (gnu packages linux),
(gnu packages haskell-xyz) and (gnu packages golang).

It seems a bit cheaty to me but it works.

* gnu/packages/linux.scm (earlyoom): Use 'module-ref' and friends to access
  'go' and 'pandoc'.  Remove now unneeded imports.
---
 gnu/packages/linux.scm | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 5a0c5650e4..c47204dc76 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -52,7 +52,7 @@
 ;;; Copyright © 2020 pukkamustard <[email-masked]>
 ;;; Copyright © 2021 B. Wilson <[email-masked]>
 ;;; Copyright © 2021 Ivan Gankevich <[email-masked]>
-;;; Copyright © 2021 Maxime Devos <[email-masked]>
+;;; Copyright © 2021,2022 Maxime Devos <[email-masked]>
 ;;; Copyright © 2021 Guillaume Le Vaillant <[email-masked]>
 ;;; Copyright © 2021 Sarah Morgensen <[email-masked]>
 ;;; Copyright © 2021 Felix Gruber <[email-masked]>
@@ -110,12 +110,13 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
-  #:use-module (gnu packages golang)
+  ;; Don't import these modules here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages gstreamer)
-  ;; Don't import that module here, otherwise a cycle would result.
+  ;; Don't import these modules here, otherwise a cycle would result.
   ;; #:use-module (gnu packages gtk)
-  #:use-module (gnu packages haskell-xyz)
+  ;; #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages llvm)
@@ -3771,12 +3772,17 @@ from the module-init-tools project.")
       (append
         ;; To generate the manpage.
         (if (or (target-x86-64?) (target-x86-32?))
-          (list pandoc)
+          ;; Avoid adding Haskelland to the module closure
+          ;; when all we need is util-linux.
+          (list (module-ref (resolve-interface '(gnu packages haskell-xyz))
+                            'pandoc))
           '())
         (list
           ;; For the test suite.
           cppcheck
-          go)))
+          ;; 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))))
     (home-page "https://github.com/rfjakob/earlyoom")
     (synopsis "Simple out of memory (OOM) daemon for the Linux kernel")
     (description "Early OOM is a minimalist out of memory (OOM) daemon that
-- 
2.30.2