[PATCH 0/6] Start breaking up import cycles

OpenSubmitted by Maxime Devos.
Details
5 participants
  • Leo Famulari
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxime Devos
  • zimoun
Owner
unassigned
Severity
normal
M
M
Maxime Devos wrote on 23 Mar 19:46 +0100
(address . guix-patches@gnu.org)
5a87d6f772ff7424cb6fccea7c45276bef7797aa.camel@telenet.be
Import cycles make some packaging things harder and prevent some
proposed optimisations to "guix pull", let's start eliminating them.
TBC ...
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYjtrIRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7li0AP98/ho0PuUq8YYRyiOtjRyDpCUD
BAWS1GEvkOUMkl6MiQEAobYmoMUCMyqmlkXPQ/iZ6XaONdrD0CUi0s4f41mGeQg=
=SK03
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 23 Mar 19:48 +0100
[PATCH 2/6] gnu: xsensors: Move to (gnu packages xorg) to break cycles.
(address . 54539@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220323184855.25241-2-maximedevos@telenet.be
This partially breaks a cycle between (gnu packages linux) and
(gnu packages gtk). It is not sufficient though, see next patch.

* gnu/packages/linux.scm (xensors): Move to ...
* gnu/packages/xorg.scm: ... this module.
---
gnu/packages/linux.scm | 38 --------------------------------------
gnu/packages/xorg.scm | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 38 deletions(-)

Toggle diff (110 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 8d9dc01839..dc4f91d48f 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -4502,44 +4502,6 @@ SMBus access.")
         #~(list (string-append "prefix=" #$output)
                 (string-append "CC=" #$(cc-for-target))))))))
 
-(define-public xsensors
-  (package
-    (name "xsensors")
-    (version "0.70")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "http://www.linuxhardware.org/xsensors/xsensors-"
-                    version ".tar.gz"))
-              (sha256
-               (base32
-                "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
-    (build-system gnu-build-system)
-    (inputs `(("lm-sensors" ,lm-sensors "lib")
-              ("gtk" ,gtk+-2)))
-    (native-inputs (list pkg-config))
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'enable-deprecated
-           (lambda _
-             (substitute* "src/Makefile.in"
-               (("-DGDK_DISABLE_DEPRECATED") "")
-               (("-DGTK_DISABLE_DEPRECATED") ""))
-             #t))
-         (add-before 'configure 'remove-Werror
-           (lambda _
-             (substitute* '("configure" "src/Makefile.in")
-               (("-Werror") ""))
-             #t)))))
-    (home-page "http://www.linuxhardware.org/xsensors/")
-    (synopsis "Hardware health information viewer")
-    (description
-     "Xsensors reads data from the libsensors library regarding hardware
-health such as temperature, voltage and fan speed and displays the information
-in a digital read-out.")
-    (license license:gpl2+)))
-
 (define-public perf
   (package
     (name "perf")
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 14cd3bc789..7e905842be 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2016 Nikita <nikita@n0.is>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
+;;; Copyright © 2017 Dave Love <fx@gnu.org>
 ;;; Copyright © 2016, 2017 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
@@ -6131,6 +6132,46 @@ on a button to dismiss it or can select one of several buttons
 to answer a question.  Xmessage can also exit after a specified time.")
     (license license:x11)))
 
+;; Don't put this in (gnu packages linux) because that would create a
+;; cycle between (gnu packages linux) and (gnu packages gtk).
+(define-public xsensors
+  (package
+    (name "xsensors")
+    (version "0.70")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://www.linuxhardware.org/xsensors/xsensors-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
+    (build-system gnu-build-system)
+    (inputs `(("lm-sensors" ,lm-sensors "lib")
+              ("gtk" ,gtk+-2)))
+    (native-inputs (list pkg-config))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'enable-deprecated
+           (lambda _
+             (substitute* "src/Makefile.in"
+               (("-DGDK_DISABLE_DEPRECATED") "")
+               (("-DGTK_DISABLE_DEPRECATED") ""))
+             #t))
+         (add-before 'configure 'remove-Werror
+           (lambda _
+             (substitute* '("configure" "src/Makefile.in")
+               (("-Werror") ""))
+             #t)))))
+    (home-page "http://www.linuxhardware.org/xsensors/")
+    (synopsis "Hardware health information viewer")
+    (description
+     "Xsensors reads data from the libsensors library regarding hardware
+health such as temperature, voltage and fan speed and displays the information
+in a digital read-out.")
+    (license license:gpl2+)))
+
 (define-public xterm
   (package
     (name "xterm")
-- 
2.30.2
M
M
Maxime Devos wrote on 23 Mar 19:48 +0100
[PATCH 1/6] gnu: audacity: Move into new module to break cycles.
(address . 54539@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220323184855.25241-1-maximedevos@telenet.be
Currently, there's a cycle between ncurses, linux, audio and music.
By moving audacity to its own module, 'audio' does not have to import
'music' and 'linux' anymore. Looking at the output of
"guix graph --type=module", there still appears to be cycles, so
this commit will not sufficient by itself.

* gnu/packages/audio.scm (audacity): Move to ...
* gnu/packages/audacity.scm: This new module. Remove unneeded imports
from the old module. Add a few comments to the old module to discourage
re-importing the 'linux' and 'music' module in the future.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register new module.
---
gnu/local.mk | 1 +
gnu/packages/audio.scm | 140 ++---------------------------------------
2 files changed, 5 insertions(+), 136 deletions(-)

Toggle diff (188 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index ad39e648f7..aab22d32d4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -112,6 +112,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/assembly.scm			\
   %D%/packages/astronomy.scm			\
   %D%/packages/attr.scm				\
+  %D%/packages/audacity.scm			\
   %D%/packages/audio.scm			\
   %D%/packages/augeas.scm			\
   %D%/packages/authentication.scm		\
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 13e0f02837..d74f8de1ab 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -90,14 +90,16 @@
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages libusb)
-  #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
+  ;; Don't import that module here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages linux)
   #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3) ;taglib
   #:use-module (gnu packages multiprecision)
-  #:use-module (gnu packages music)
+  ;; Don't import that module here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages onc-rpc)
@@ -122,7 +124,6 @@
   #:use-module (gnu packages vim) ;xxd
   #:use-module (gnu packages web)
   #:use-module (gnu packages webkit)
-  #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
@@ -761,139 +762,6 @@ record, edit, mix and master audio and MIDI projects.  It is targeted at audio
 engineers, musicians, soundtrack editors and composers.")
     (license license:gpl2+)))
 
-(define-public audacity
-  (package
-    (name "audacity")
-    (version "3.1.3")
-    (source
-     (origin
-       ;; If built from the release tag, Audacity will describe itself
-       ;; as an "Alpha test version" and suggest to users that they use
-       ;; the "latest stable released version".
-       (method url-fetch)
-       (uri (string-append "https://github.com/audacity/audacity/releases/download/"
-                           "Audacity-" version "/audacity-" version
-                           "-source.tar.gz"))
-       (sha256
-        (base32
-         "189agx11361k9j958s6q5bngnnfx0rwaf0dwbjxy6fwvsb1wv3px"))
-       (patches (search-patches "audacity-ffmpeg-fallback.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        ;; Remove bundled libraries.
-        '(begin
-           (for-each
-            (lambda (dir)
-              (delete-file-recursively (string-append "lib-src/" dir)))
-            '("libsoxr" "libvamp" "lv2" "soundtouch" "sqlite" "twolame"
-              ;; FIXME: these libraries have not been packaged yet:
-              ;; "libnyquist"
-              ;; "libscorealign"
-              ;; "portburn"
-              ;; "portsmf"
-              ;; "portmixer"
-
-              ;; FIXME: we have this library, but it differs in that the Slide
-              ;; class does not have a member "getInverseStretchedTime".
-              ;; "sbsms"
-              ))
-           #t))))
-    (build-system cmake-build-system)
-    (inputs
-     (list wxwidgets-3.1
-           gtk+
-           alsa-lib
-           jack-1
-           expat
-           lame
-           linux-libre-headers
-           flac
-           ffmpeg
-           libid3tag
-           libjpeg-turbo
-           libmad
-           ;;("libsbsms" ,libsbsms)         ;bundled version is modified
-           libsndfile
-           soundtouch
-           soxr ;replaces libsamplerate
-           sqlite
-           twolame
-           vamp
-           libvorbis
-           lv2
-           lilv ;for lv2
-           suil ;for lv2
-           portaudio
-           portmidi))
-    (native-inputs
-     `(("autoconf" ,autoconf)
-       ("automake" ,automake)
-       ("gettext" ,gettext-minimal)     ;for msgfmt
-       ("libtool" ,libtool)
-       ("pkg-config" ,pkg-config)
-       ("python" ,python)
-       ("which" ,which)))
-    (arguments
-     `(#:configure-flags
-       (list
-        "-Daudacity_conan_enabled=off"
-        "-Daudacity_lib_preference=system"
-        ;; TODO: enable this flag once we've packaged all dependencies
-        ;; "-Daudacity_obey_system_dependencies=on"
-        ;; disable crash reports, updates, ..., anything that phones home
-        "-Daudacity_has_networking=off")
-       #:imported-modules ((guix build glib-or-gtk-build-system)
-                           ,@%cmake-build-system-modules)
-       #:modules
-       ((guix build utils)
-        (guix build cmake-build-system)
-        ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-cmake-rpath
-           (lambda* (#:key outputs #:allow-other-keys)
-             (substitute* "CMakeLists.txt"
-               (("\\$ORIGIN/\\.\\./\\$\\{_PKGLIB\\}")
-                (string-append (assoc-ref outputs "out") "/lib/audacity"))
-               (("CMAKE_BUILD_WITH_INSTALL_RPATH [A-Z]*")
-                "CMAKE_BUILD_WITH_INSTALL_RPATH TRUE")
-               (("CMAKE_INSTALL_RPATH_USE_LINK_PATH [A-Z]*")
-                "CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE"))
-             (substitute* "src/CMakeLists.txt"
-               (("-Wl,--disable-new-dtags") "-Wl,--enable-new-dtags"))))
-         (add-after 'unpack 'comment-out-revision-ident
-           (lambda _
-             (substitute* "src/CMakeLists.txt"
-               (("file\\( TOUCH \".*RevisionIdent\\.h\" \\)" directive)
-                (string-append "# " directive)))
-             (substitute* "src/AboutDialog.cpp"
-               (("(.*RevisionIdent\\.h.*)" include-line)
-                (string-append "// " include-line)))))
-         (add-after 'unpack 'use-upstream-headers
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* '("libraries/lib-files/FileNames.cpp")
-               (("\"/usr/include/linux/magic.h\"") "<linux/magic.h>"))))
-         (add-after 'wrap-program 'glib-or-gtk-wrap
-           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))
-       ;; The test suite is not "well exercised" according to the developers,
-       ;; and fails with various errors.  See
-       ;; <http://sourceforge.net/p/audacity/mailman/message/33524292/>.
-       #:tests? #f))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "AUDACITY_MODULES_PATH")
-            (files '("lib/audacity/modules")))
-           (search-path-specification
-            (variable "AUDACITY_PATH")
-            (files '("share/audacity")))))
-    (home-page "https://www.audacityteam.org/")
-    (synopsis "Software for recording and editing sounds")
-    (description
-     "Audacity is a multi-track audio editor designed for recording, playing
-and editing digital audio.  It features digital effects and spectrum analysis
-tools.")
-    (license license:gpl2+)))
-
 (define-public audiofile
   (package
     (name "audiofile")

base-commit: 9a31942cabb5c73174aee96ecd873fcf89955a9d
prerequisite-patch-id: f64e340873270246660f566eabe4af5e20ede85f
-- 
2.30.2
M
M
Maxime Devos wrote on 23 Mar 19:48 +0100
[PATCH 4/6] gnu: go-netlink: Move to (gnu packages networking) to break cycles.
(address . 54539@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220323184855.25241-4-maximedevos@telenet.be
This (partially?) breaks a cycle between (gnu packages linux) and
(gnu packages networking).

* gnu/packages/linux.scm (go-netlink): Move to ...
* gnu/packages/networking.scm: ... this module.
---
gnu/packages/linux.scm | 30 ++----------------------------
gnu/packages/networking.scm | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 28 deletions(-)

Toggle diff (96 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 6ce640ddf2..5a0c5650e4 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -125,7 +125,8 @@
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages netpbm)
-  #:use-module (gnu packages networking)
+  ;; Don't import that module here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
   #:use-module (gnu packages nss)
   #:use-module (gnu packages perl)
@@ -159,7 +160,6 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system go)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
@@ -7620,32 +7620,6 @@ nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or
 management tools in userspace.")
     (license license:gpl2)))
 
-(define-public go-netlink
-  (package
-    (name "go-netlink")
-    (version "1.0.0")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/vishvananda/netlink")
-                    (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0hpzghf1a4cwawzhkiwdzin80h6hd09fskl77d5ppgc084yvj8x0"))))
-    (build-system go-build-system)
-    (arguments
-     `(#:import-path "github.com/vishvananda/netlink"))
-    (native-inputs
-     (list go-golang-org-x-sys go-netns))
-    (home-page "https://github.com/vishvananda/netlink")
-    (synopsis "Simple netlink library for Go")
-    (description "The netlink package provides a simple netlink library for
-Go.  Netlink is the interface a user-space program in Linux uses to
-communicate with the kernel.  It can be used to add and remove interfaces, set
-IP addresses and routes, and configure IPsec.")
-    (license license:asl2.0)))
-
 (define-public libinih
   (package
     (name "libinih")
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index b45f2f79f2..e8720e0faf 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -1663,6 +1663,34 @@ manage, and delete Internet resources from Gandi.net such as domain names,
 virtual machines, and certificates.")
     (license license:gpl3+)))
 
+;; Don't put this in (gnu packages linux) even though it is Linux-specific,
+;; because that would create cycles.
+(define-public go-netlink
+  (package
+    (name "go-netlink")
+    (version "1.0.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/vishvananda/netlink")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0hpzghf1a4cwawzhkiwdzin80h6hd09fskl77d5ppgc084yvj8x0"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/vishvananda/netlink"))
+    (native-inputs
+     (list go-golang-org-x-sys go-netns))
+    (home-page "https://github.com/vishvananda/netlink")
+    (synopsis "Simple netlink library for Go")
+    (description "The netlink package provides a simple netlink library for
+Go.  Netlink is the interface a user-space program in Linux uses to
+communicate with the kernel.  It can be used to add and remove interfaces, set
+IP addresses and routes, and configure IPsec.")
+    (license license:asl2.0)))
+
 (define-public go-netns
   (let ((commit "13995c7128ccc8e51e9a6bd2b551020a27180abd")
         (revision "1"))
-- 
2.30.2
M
M
Maxime Devos wrote on 23 Mar 19:48 +0100
[PATCH 5/6] gnu: earlyoom: Avoid importing Goland and Haskelland to break cycles.
(address . 54539@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220323184855.25241-5-maximedevos@telenet.be
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(-)

Toggle diff (52 lines)
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 <pukkamustard@posteo.net>
 ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
-;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021,2022 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
@@ -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
M
M
Maxime Devos wrote on 23 Mar 19:48 +0100
[PATCH 6/6] gnu: linux: Avoid importing (gnu packages check) to break cycles.
(address . 54539@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220323184855.25241-6-maximedevos@telenet.be
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(-)

Toggle diff (79 lines)
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")
-- 
2.30.2
M
M
Maxime Devos wrote on 23 Mar 19:48 +0100
[PATCH 3/6] gnu: tlp: Move tlp and friends to new module to break cycles.
(address . 54539@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220323184855.25241-3-maximedevos@telenet.be
This partially breaks a cycle between (gnu packages linux) and
(gnu packages gtk). It is not sufficient though, see next patch.

* gnu/packages/linux.scm (tlp,tlpui): Move to ...
* gnu/packages/tlp.scm: ... this new module.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register new module.
---
gnu/local.mk | 1 +
gnu/packages/linux.scm | 192 +---------------------------------
gnu/packages/tlp.scm | 228 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 231 insertions(+), 190 deletions(-)
create mode 100644 gnu/packages/tlp.scm

Toggle diff (458 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index aab22d32d4..ad24234ae5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -582,6 +582,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/textutils.scm			\
   %D%/packages/text-editors.scm			\
   %D%/packages/time.scm				\
+  %D%/packages/tlp.scm				\
   %D%/packages/tls.scm				\
   %D%/packages/tmux.scm				\
   %D%/packages/toolkits.scm			\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index dc4f91d48f..6ce640ddf2 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -113,8 +113,8 @@
   #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages gstreamer)
-  #:use-module (gnu packages gtk)
-  #:use-module (gnu packages haskell-apps)
+  ;; Don't import that module here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages libusb)
@@ -6897,194 +6897,6 @@ The appropriate permissions must be set on the backlight or LED control
 interface in sysfs, which can be accomplished with the included udev rules.")
     (license license:expat)))
 
-(define-public tlp
-  (package
-    (name "tlp")
-    (version "1.5.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/linrunner/TLP")
-             (commit version)))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "0cssclk2brhwvn9dm7h5snm2svwy0c8cfr4z2cgkdkac2pfaaxw4"))))
-    (native-inputs
-     (list shellcheck))
-    (inputs
-     `(("bash" ,bash)
-       ("dbus" ,dbus)
-       ("ethtool" ,ethtool)
-       ("eudev" ,eudev)
-       ("grep" ,grep)
-       ("hdparm" ,hdparm)
-       ("inetutils" ,inetutils)
-       ("iw" ,iw)
-       ("kmod" ,kmod)
-       ("pciutils" ,pciutils)
-       ("perl" ,perl)
-       ("rfkill" ,rfkill)
-       ("sed" ,sed)
-       ("usbutils" ,usbutils)
-       ("util-linux" ,util-linux)
-       ("wireless-tools" ,wireless-tools)
-       ,@(if (let ((system (or (%current-target-system)
-                               (%current-system))))
-               (or (string-prefix? "i686-" system)
-                   (string-prefix? "x86_64-" system)))
-             `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
-             '())))
-    (build-system gnu-build-system)
-    (arguments
-     ;; XXX: The full test suite is run with "checkall" but it requires
-     ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
-     `(#:test-target "shellcheck"
-       #:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (srfi srfi-1))
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)            ; no configure script
-         (add-before 'build 'setenv
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (setenv "TLP_WITH_SYSTEMD" "0")
-               (setenv "TLP_NO_INIT" "1")
-               (setenv "TLP_NO_PMUTILS" "1")
-               (setenv "TLP_SBIN" (string-append out "/bin"))
-               (setenv "TLP_BATD" (string-append out "/share/tlp/bat.d"))
-               (setenv "TLP_BIN" (string-append out "/bin"))
-               (setenv "TLP_TLIB" (string-append out "/share/tlp"))
-               (setenv "TLP_FLIB" (string-append out "/share/tlp/func.d"))
-               (setenv "TLP_ULIB" (string-append out "/lib/udev"))
-               (setenv "TLP_CONFDEF"
-                       (string-append out "/share/tlp/defaults.conf"))
-               (setenv "TLP_CONFDIR" (string-append out "/etc/tlp.d"))
-               (setenv "TLP_CONFREN"
-                       (string-append out "/share/tlp/rename.conf"))
-               (setenv "TLP_ELOD"
-                       (string-append out "/lib/elogind/system-sleep"))
-               (setenv "TLP_SHCPL"
-                       (string-append out "/share/bash-completion/completions"))
-               (setenv "TLP_MAN" (string-append out "/share/man"))
-               (setenv "TLP_META" (string-append out "/share/metainfo")))))
-         (add-before 'install 'fix-installation
-           (lambda _
-             ;; Stop the Makefile from trying to create system directories.
-             (substitute* "Makefile"
-               (("\\[ -f \\$\\(_CONFUSR\\) \\]") "#")
-               (("install -d -m 755 \\$\\(_VAR\\)") "#"))))
-         (replace 'install
-           (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
-         (add-after 'install 'wrap
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
-                    (bin-files (find-files bin ".*")))
-               (define (bin-directory input-name)
-                 (let ((p (assoc-ref inputs input-name)))
-                   (and p (string-append p "/bin"))))
-               (define (sbin-directory input-name)
-                 (string-append (assoc-ref inputs input-name) "/sbin"))
-               (for-each (lambda (program)
-                           (wrap-program program
-                             `("PATH" ":" prefix
-                               ,(append
-                                 (filter-map bin-directory
-                                             '("bash"
-                                               "coreutils"
-                                               "dbus"
-                                               "eudev"
-                                               "grep"
-                                               "inetutils"
-                                               "kmod"
-                                               "perl"
-                                               "sed"
-                                               "usbutils"
-                                               "util-linux"
-                                               "x86-energy-perf-policy"))
-                                 (filter-map sbin-directory
-                                             '("ethtool"
-                                               "hdparm"
-                                               "iw"
-                                               "pciutils"
-                                               "rfkill"
-                                               "wireless-tools"))))))
-                         bin-files)))))))
-    (home-page "https://linrunner.de/en/tlp/tlp.html")
-    (synopsis "Power management tool for Linux")
-    (description "TLP is a power management tool for Linux.  It comes with
-a default configuration already optimized for battery life.  Nevertheless,
-TLP is customizable to fulfil system requirements.  TLP settings are applied
-every time the power supply source is changed.")
-    ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
-    ;; rest is GPLv2+.
-    (license (list license:gpl2+ license:gpl3+))))
-
-(define-public tlpui
-  (package
-    (name "tlpui")
-    (version "1.5.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/d4nj1/TLPUI")
-             (commit (string-append "tlpui-" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "0ca18hazxksx516nkh28f6rd0l1039nkn7mszqfy68c461061q1h"))))
-    (build-system python-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-setup.py
-           ;; Install data_files to $out/share instead of /usr/share.
-           (lambda _
-             (substitute* "setup.py"
-               (("/usr/") ""))))
-         (add-after 'unpack 'use-tlp-input
-           ;; Hard-code tlp-stat filename to avoid propagating "tlp".
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((tlp-stat (search-input-file inputs "/bin/tlp-stat")))
-               (with-directory-excursion "tlpui"
-                 (substitute* '("file.py" "settingshelper.py" "statui.py")
-                   (("which\\(\"tlp-stat\"\\)")
-                    (string-append "'" tlp-stat "'"))
-                   (("\"tlp-stat\"")
-                    (string-append "'" tlp-stat "'")))))))
-         (add-before 'check 'fix-home-directory
-           (lambda _
-             ;; Tests fail with "Permission denied:
-             ;; '/homeless-shelter'".
-             (setenv "HOME" "/tmp")))
-         ;; `sanity-check' phase errors out with the following
-         ;; messages: "Unable to init server: Could not connect:
-         ;; Connection refused" and "Error: cannot read user
-         ;; configuration from /etc/tlp.conf or /etc/default/tlp".
-         (delete 'sanity-check)
-         (replace 'check
-           (lambda _
-             (invoke "python" "-m" "discover")))
-         (add-after 'install 'wrap-gi-python
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
-               (wrap-program (string-append out "/bin/tlpui")
-                 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
-    (native-inputs
-     (list `(,glib "bin") gobject-introspection python-discover))
-    (inputs
-     (list gtk+ python-pygobject tlp))
-    (home-page "https://github.com/d4nj1/TLPUI")
-    (synopsis "User interface for TLP written in Python")
-    (description
-     "The Python scripts in this project generate a GTK-UI to change
-TLP configuration files easily.  It aims to protect users from setting
-bad configuration and to deliver a basic overview of all the valid
-configuration values.")
-    (license license:gpl2+)))
-
 (define-public lshw
   (package
     (name "lshw")
diff --git a/gnu/packages/tlp.scm b/gnu/packages/tlp.scm
new file mode 100644
index 0000000000..dfe7d3616b
--- /dev/null
+++ b/gnu/packages/tlp.scm
@@ -0,0 +1,228 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2018-2022 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
+;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages tlp)
+  #:use-module (guix packages)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
+  #:use-module (guix git-download)
+  #:use-module (gnu packages admin) ;inetutils
+  #:use-module (gnu packages base) ;grep
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages check) ;python-discover
+  #:use-module (gnu packages glib) ;dbus
+  #:use-module (gnu packages haskell-apps) ;shellcheck
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages linux) ;eudev
+  #:use-module (gnu packages networking) ;ethtool
+  #:use-module (gnu packages pciutils)
+  #:use-module (gnu packages perl) ;ethtool
+  #:use-module ((guix licenses) #:prefix license:))
+
+(define-public tlp
+  (package
+    (name "tlp")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/linrunner/TLP")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0cssclk2brhwvn9dm7h5snm2svwy0c8cfr4z2cgkdkac2pfaaxw4"))))
+    (native-inputs
+     (list shellcheck))
+    (inputs
+     `(("bash" ,bash)
+       ("dbus" ,dbus)
+       ("ethtool" ,ethtool)
+       ("eudev" ,eudev)
+       ("grep" ,grep)
+       ("hdparm" ,hdparm)
+       ("inetutils" ,inetutils)
+       ("iw" ,iw)
+       ("kmod" ,kmod)
+       ("pciutils" ,pciutils)
+       ("perl" ,perl)
+       ("rfkill" ,rfkill)
+       ("sed" ,sed)
+       ("usbutils" ,usbutils)
+       ("util-linux" ,util-linux)
+       ("wireless-tools" ,wireless-tools)
+       ,@(if (let ((system (or (%current-target-system)
+                               (%current-system))))
+               (or (string-prefix? "i686-" system)
+                   (string-prefix? "x86_64-" system)))
+             `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
+             '())))
+    (build-system gnu-build-system)
+    (arguments
+     ;; XXX: The full test suite is run with "checkall" but it requires
+     ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
+     `(#:test-target "shellcheck"
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)            ; no configure script
+         (add-before 'build 'setenv
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "TLP_WITH_SYSTEMD" "0")
+               (setenv "TLP_NO_INIT" "1")
+               (setenv "TLP_NO_PMUTILS" "1")
+               (setenv "TLP_SBIN" (string-append out "/bin"))
+               (setenv "TLP_BATD" (string-append out "/share/tlp/bat.d"))
+               (setenv "TLP_BIN" (string-append out "/bin"))
+               (setenv "TLP_TLIB" (string-append out "/share/tlp"))
+               (setenv "TLP_FLIB" (string-append out "/share/tlp/func.d"))
+               (setenv "TLP_ULIB" (string-append out "/lib/udev"))
+               (setenv "TLP_CONFDEF"
+                       (string-append out "/share/tlp/defaults.conf"))
+               (setenv "TLP_CONFDIR" (string-append out "/etc/tlp.d"))
+               (setenv "TLP_CONFREN"
+                       (string-append out "/share/tlp/rename.conf"))
+               (setenv "TLP_ELOD"
+                       (string-append out "/lib/elogind/system-sleep"))
+               (setenv "TLP_SHCPL"
+                       (string-append out "/share/bash-completion/completions"))
+               (setenv "TLP_MAN" (string-append out "/share/man"))
+               (setenv "TLP_META" (string-append out "/share/metainfo")))))
+         (add-before 'install 'fix-installation
+           (lambda _
+             ;; Stop the Makefile from trying to create system directories.
+             (substitute* "Makefile"
+               (("\\[ -f \\$\\(_CONFUSR\\) \\]") "#")
+               (("install -d -m 755 \\$\\(_VAR\\)") "#"))))
+         (replace 'install
+           (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
+         (add-after 'install 'wrap
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
+                    (bin-files (find-files bin ".*")))
+               (define (bin-directory input-name)
+                 (let ((p (assoc-ref inputs input-name)))
+                   (and p (string-append p "/bin"))))
+               (define (sbin-directory input-name)
+                 (string-append (assoc-ref inputs input-name) "/sbin"))
+               (for-each (lambda (program)
+                           (wrap-program program
+                             `("PATH" ":" prefix
+                               ,(append
+                                 (filter-map bin-directory
+                                             '("bash"
+                                               "coreutils"
+                                               "dbus"
+                                               "eudev"
+                                               "grep"
+                                               "inetutils"
+                                               "kmod"
+                                               "perl"
+                                               "sed"
+                                               "usbutils"
+                                               "util-linux"
+                                               "x86-energy-perf-policy"))
+                                 (filter-map sbin-directory
+                                             '("ethtool"
+                                               "hdparm"
+                                               "iw"
+                                               "pciutils"
+                                               "rfkill"
+                                               "wireless-tools"))))))
+                         bin-files)))))))
+    (home-page "https://linrunner.de/en/tlp/tlp.html")
+    (synopsis "Power management tool for Linux")
+    (description "TLP is a power management tool for Linux.  It comes with
+a default configuration already optimized for battery life.  Nevertheless,
+TLP is customizable to fulfil system requirements.  TLP settings are applied
+every time the power supply source is changed.")
+    ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
+    ;; rest is GPLv2+.
+    (license (list license:gpl2+ license:gpl3+))))
+
+(define-public tlpui
+  (package
+    (name "tlpui")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/d4nj1/TLPUI")
+             (commit (string-append "tlpui-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ca18hazxksx516nkh28f6rd0l1039nkn7mszqfy68c461061q1h"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-setup.py
+           ;; Install data_files to $out/share instead of /usr/share.
+           (lambda _
+             (substitute* "setup.py"
+               (("/usr/") ""))))
+         (add-after 'unpack 'use-tlp-input
+           ;; Hard-code tlp-stat filename to avoid propagating "tlp".
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((tlp-stat (search-input-file inputs "/bin/tlp-stat")))
+               (with-directory-excursion "tlpui"
+                 (substitute* '("file.py" "settingshelper.py" "statui.py")
+                   (("which\\(\"tlp-stat\"\\)")
+                    (string-append "'" tlp-stat "'"))
+                   (("\"tlp-stat\"")
+                    (string-append "'" tlp-stat "'")))))))
+         (add-before 'check 'fix-home-directory
+           (lambda _
+             ;; Tests fail with "Permission denied:
+             ;; '/homeless-shelter'".
+             (setenv "HOME" "/tmp")))
+         ;; `sanity-check' phase errors out with the following
+         ;; messages: "Unable to init server: Could not connect:
+         ;; Connection refused" and "Error: cannot read user
+         ;; configuration from /etc/tlp.conf or /etc/default/tlp".
+         (delete 'sanity-check)
+         (replace 'check
+           (lambda _
+             (invoke "python" "-m" "discover")))
+         (add-after 'install 'wrap-gi-python
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (gi-typelib-path (getenv "GI_TYPELIB_PATH")))
+               (wrap-program (string-append out "/bin/tlpui")
+                 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
+    (native-inputs
+     (list `(,glib "bin") gobject-introspection python-discover))
+    (inputs
+     (list gtk+ python-pygobject tlp))
+    (home-page "https://github.com/d4nj1/TLPUI")
+    (synopsis "User interface for TLP written in Python")
+    (description
+     "The Python scripts in this project generate a GTK-UI to change
+TLP configuration files easily.  It aims to protect users from setting
+bad configuration and to deliver a basic overview of all the valid
+configuration values.")
+    (license license:gpl2+)))
-- 
2.30.2
M
M
Maxime Devos wrote on 23 Mar 19:49 +0100
Re: [bug#54539] [PATCH 0/6] Start breaking up import cycles
(address . 54539@debbugs.gnu.org)
a85be88402b840a95e3c57705a8554eacbd5789a.camel@telenet.be
Maxime Devos schreef op wo 23-03-2022 om 19:46 [+0100]:
Toggle quote (4 lines)
> Import cycles make some packaging things harder and prevent some
> proposed optimisations to "guix pull", let's start eliminating them.
> TBC ...

The copyright lines are based on a mix of "git blame" and "git log --
grep the-package"; I might have missed some people ...
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYjtryBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ijJAQDEhgTDbPiupDFrHNRdfwDv38Do
zUrbbQdBf9fpsPSFHwEA53+d59PRmNQAb/eddh3vdXTKp+MJ38Rbq3sOMpgbGA8=
=tc+7
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 24 Mar 08:22 +0100
5ab234b577c15dd50c36aaf427cce593404b52dc.camel@ist.tugraz.at
Hi Maxime,

Am Mittwoch, dem 23.03.2022 um 19:49 +0100 schrieb Maxime Devos:
Toggle quote (8 lines)
> Maxime Devos schreef op wo 23-03-2022 om 19:46 [+0100]:
> > Import cycles make some packaging things harder and prevent some
> > proposed optimisations to "guix pull", let's start eliminating
> > them.
> > TBC ...
>
> The copyright lines are based on a mix of "git blame" and "git log --
> grep the-package"; I might have missed some people ...
I agree that breaking up cycles is a good thing, but I disagree with
some of the decisions you've made here. For instance, I oppose the use
of single-package modules, because those more often than not simply
clutter the file system.

I'm not sure if Guile's #:autoload could do anything to fix these
issues (I suppose not), but long term I think guile modules should
support a style that is basically (resolve-interface) + (module-ref) in
the manner Guix needs, but declaratively. While we do not have that in
place yet, I suggest something like the following:

(define (check-package-ref pkg)
(module-ref (resolve-interface '(gnu packages check)) pkg))
...

or

(define check-package-ref
(let ((iface (resolve-interface '(gnu packages check))))
(lambda (pkg) (resolve-interface iface pkg))))

I'm not sure if the second will have the intended effect. It appears
to me as though the key to breaking these cycles is moving them into a
context that is not evaluated on the top of the file, e.g. a thunked
field or in the case of my first suggestion a procedure.

In either case, declaring all these lazy dependencies near the module
definition would have the added benefit, that people could see them
being lazily imported and thus no longer need the #:use-modules
comment.

WDYT?
M
M
Maxime Devos wrote on 24 Mar 16:05 +0100
70b6c5f42bccf41a63acb38922e8d20d4eda3d8a.camel@telenet.be
Liliana Marie Prikler schreef op do 24-03-2022 om 08:22 [+0100]:
Toggle quote (5 lines)
> I agree that breaking up cycles is a good thing, but I disagree with
> some of the decisions you've made here.  For instance, I oppose the use
> of single-package modules, because those more often than not simply
> clutter the file system.

There are some other sound applications in (gnu packages audio)
and (gnu packages music), so maybe I can make a (gnu packages audio-
apps) module where 'audacity' and other applications like 'calf' can
reside?

For reducing the contribution of (gnu packages compression) on the
cycle issue, I've (in not yet submitted patched) separated many things
into (gnu packages compression-xyz), perhaps I can merge
(gnu packages patools) into (gnu packages compression-xyz)?

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYjyIvRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7rOTAP0YuDljFH70+2uWg1ghSjlV2CQa
cHtSUkp37fUrUPJ9WAD7B7OLNzXZQsprCTFB3CcxG+V/6Z92MK6HeSz75Y0yygo=
=nThe
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 24 Mar 16:38 +0100
232472b55b6237597e2e304741fd823d205d7972.camel@ist.tugraz.at
Am Donnerstag, dem 24.03.2022 um 16:05 +0100 schrieb Maxime Devos:
Toggle quote (10 lines)
> Liliana Marie Prikler schreef op do 24-03-2022 om 08:22 [+0100]:
> > I agree that breaking up cycles is a good thing, but I disagree
> > with some of the decisions you've made here.  For instance, I
> > oppose the use of single-package modules, because those more often
> > than not simply clutter the file system.
>
> There are some other sound applications in (gnu packages audio)
> and (gnu packages music), so maybe I can make a (gnu packages audio-
> apps) module where 'audacity' and other applications like 'calf' can
> reside?
I'm not sure. IIUC, audio should be for audio systems, codecs, etc.
whereas music sounds like a particular niche containing music players
etc. Perhaps the cycle could more appropriately been broken by moving
stuff from music to audio? Alternatively, declaring music as lazy
import as shown in my previous mail might help making these
interdependencies both "cycle-free" and visible. (I'm pretty sure we
also have "sound" lying around somewhere to put more oil into the
fire.)

Toggle quote (4 lines)
> For reducing the contribution of (gnu packages compression) on the
> cycle issue, I've (in not yet submitted patched) separated many
> things into (gnu packages compression-xyz), perhaps I can merge
> (gnu packages patools) into (gnu packages compression-xyz)?
Here too, I think a classification into compression algorithms in
compression and backup/archival tools in another file (we do have
backup IIRC) would make the most sense. Though obviously, we'd have to
do compression algorithms implemented in Rust in a special rust-
compression file to avoid circles or use the cycle killer lambda trick.
I'm not sure if "compression-xyz" would be a helpful label, and it
might just become the next root of circular dependencies if abused.

Cheers
M
M
Maxime Devos wrote on 24 Mar 16:46 +0100
6c9031840667a11465eeefed0a4f0769c3466578.camel@telenet.be
Liliana Marie Prikler schreef op do 24-03-2022 om 16:38 [+0100]:
Toggle quote (14 lines)
> > For reducing the contribution of (gnu packages compression) on the
> > cycle issue, I've (in not yet submitted patched) separated many
> > things into (gnu packages compression-xyz), perhaps I can merge
> > (gnu packages patools) into (gnu packages compression-xyz)?
> Here too, I think a classification into compression algorithms in
> compression and backup/archival tools in another file (we do have
> backup IIRC) would make the most sense.  Though obviously, we'd have
> to
> do compression algorithms implemented in Rust in a special rust-
> compression file to avoid circles or use the cycle killer lambda
> trick.
> I'm not sure if "compression-xyz" would be a helpful label, and it
> might just become the next root of circular dependencies if abused.

Except for zpaq, there don't appear to be any backup tools in (gnu
packages compression). There are no rust compression things in
(gnu packages compression) (yet!). But yes, there's some opportunity
for abuse here. There _are_ archival tools in (gnu packages
compression), e.g. tar and unzip. Moving them to (gnu packages
backup) wouldn't bring any benefit though, since they are used by
practically everything.

Anyway, I'll continue trying to break cycles ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYjySXRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gPKAP923TsyKaWfv4R8Yqee7GAwOvjX
V65fuS5avwZk4RnpggD+LwgqR+fpaSDA787Wzjpk5ExVbhoVHCb664ExPEjMTgE=
=1yxR
-----END PGP SIGNATURE-----


Z
Z
zimoun wrote on 24 Mar 17:58 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
CAJ3okZ0q9h=GnHfJ9ucb2Je0PhYuZ4U+V-nq8i8m_yinzO_RaA@mail.gmail.com
Hi,

On Thu, 24 Mar 2022 at 08:23, Liliana Marie Prikler
<liliana.prikler@ist.tugraz.at> wrote:

Toggle quote (5 lines)
> I agree that breaking up cycles is a good thing, but I disagree with
> some of the decisions you've made here. For instance, I oppose the use
> of single-package modules, because those more often than not simply
> clutter the file system.

Well, instead of opinions in the vacuum of matter, we need to profile
and decide on performance report. The number of files and the number
of package per file should consider the performance of:

- compilation by developer
- guix pull
- guix search (or any other)
- guix search --load-path
- etc.

Toggle quote (5 lines)
> In either case, declaring all these lazy dependencies near the module
> definition would have the added benefit, that people could see them
> being lazily imported and thus no longer need the #:use-modules
> comment.

I agree that lazyness is a good thing and a good direction. However,
let be pragmatic with what we have now. :-) What are the performance
comparison between breaking many cycles as Maxime is proposing vs
using many 'module-ref' + 'resolve-interface' instead of break?


Cheers,
simon
L
L
Leo Famulari wrote on 24 Mar 18:05 +0100
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
Yjykw0ikvRY/V9N0@jasmine.lan
On Thu, Mar 24, 2022 at 08:22:09AM +0100, Liliana Marie Prikler wrote:
Toggle quote (5 lines)
> I agree that breaking up cycles is a good thing, but I disagree with
> some of the decisions you've made here. For instance, I oppose the use
> of single-package modules, because those more often than not simply
> clutter the file system.

The file system can hold many files. The Guix codebase is nowhere near
the limit...
M
M
Maxime Devos wrote on 24 Mar 19:07 +0100
(address . 54539@debbugs.gnu.org)
2b5a3af9bd4ea9ec79ad9f9636ed344a51ba7a81.camel@telenet.be
zimoun schreef op do 24-03-2022 om 17:58 [+0100]:
Toggle quote (5 lines)
> I agree that lazyness is a good thing and a good direction.  However,
> let be pragmatic with what we have now. :-)  What are the performance
> comparison between breaking many cycles as Maxime is proposing vs
> using many 'module-ref' + 'resolve-interface' instead of break?

Currently this patch series does not improve anything much, according
to "guix graph --type=module hello | wc --lines". I'm now introducing
some module-ref+resolve-interface --- it's very convenient, but I'm not
yet at a significant result.

Anyway, restructuring modules and lazy loading can be complementary,
whatever's convenient.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYjyzWxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qyvAQCMzjcLrTbp33oplqHjSbGykB3r
sxV5rKxCbdc6xq1+uwEAwsxLUPd1y8I7e73212q44Ly5wfpgFMlWFf/m0L6aWAs=
=lXjQ
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 24 Mar 22:49 +0100
(address . 54539@debbugs.gnu.org)
8a4250c11e8bc178dc5da8fe43497af4e0ee1293.camel@telenet.be
Maxime Devos schreef op wo 23-03-2022 om 19:46 [+0100]:
Toggle quote (4 lines)
> Import cycles make some packaging things harder and prevent some
> proposed optimisations to "guix pull", let's start eliminating them.
> TBC ...

Status update: previously the output of
"guix graph -t module hello --max-depth=9 |wc --lines" reports ~1040
lines. With WIP patches, it now reports 280 lines. I'm gradually
increasing the max-depth and each time investigating how to leave xorg,
gtk, ... out of the output.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYjznhBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kQPAPwPlqj951BHz5xnsZvVlTbZ26MV
sdLCWR/HRu0UKlQsLgD/VadoZ3QysZwliEVcibei/XhkUPaaJuLUPaQ/AK8fOAk=
=UXBT
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 25 Mar 09:44 +0100
(address . 54539@debbugs.gnu.org)
84da9090d9dee87855ee4f5b2f5442ad919ea032.camel@ist.tugraz.at
Am Donnerstag, dem 24.03.2022 um 19:07 +0100 schrieb Maxime Devos:
Toggle quote (11 lines)
> zimoun schreef op do 24-03-2022 om 17:58 [+0100]:
> > I agree that lazyness is a good thing and a good direction. 
> > However, let be pragmatic with what we have now. :-)  What are the
> > performance comparison between breaking many cycles as Maxime is
> > proposing vs using many 'module-ref' + 'resolve-interface' instead
> > of break?
>
> Currently this patch series does not improve anything much, according
> to "guix graph --type=module hello | wc --lines".  I'm now
> introducing some module-ref+resolve-interface --- it's very
> convenient, but I'm not yet at a significant result.
For the record, my suggestion to declare lazily loaded modules near the
top is based on the fact that Maxime's current patch set uses them to
break up cycles in a manner that also requires a comment in the define-
module clause for the sake of clarity. As a nice side effect, it makes
it so that two-liners in the inputs field become one-liners.

The question is (on a per-module basis) whether we consider this cheat
fine or whether we want to move things into different files (and
which). I so far haven't heard a good argument for the case of
audacity I raised. "It breaks cycles" is not good enough when we
consider the potential existence of other cuts (e.g. "audio-apps",
although perhaps a more specific "audio-editors" similar to how we have
"image-viewers" might make more sense), as well as the cheat of lazy
imports.

simon, you raise some important performance metrics, but there is such
a thing as optimizing for the wrong metric. There are other variables
to consider, like time to grep, "does it make sense that X belongs to Y
and Z doesn't", etc., when it comes to ease of contributing. Declaring
some modules banned for a given other module has an adverse effect
here, in my opinion, and thus I claim that we need easily accessible
ways of using those supposedly banned modules.

Btw. regarding style, I think declaring a function @PACKAGE_MODULE,
i.e. a literal '@ followed by the last symbol in the module's name,
would be the easiest, as one could read (@PACKAGE_MODULE arg) as a
shorthand for (@ (gnu packages PACKAGE_MODULE) arg). Somewhat off-
topic, what's the rationale behind not using @ syntax? Does @ have
different semantics from resolve-interface + module-ref?

Cheers
L
L
Liliana Marie Prikler wrote on 25 Mar 09:51 +0100
(name . Leo Famulari)(address . leo@famulari.name)
b678a54be5faee9b1ff739b73bd87036077b53e8.camel@ist.tugraz.at
Am Donnerstag, dem 24.03.2022 um 13:05 -0400 schrieb Leo Famulari:
Toggle quote (9 lines)
> On Thu, Mar 24, 2022 at 08:22:09AM +0100, Liliana Marie Prikler
> wrote:
> > I agree that breaking up cycles is a good thing, but I disagree
> > with some of the decisions you've made here.  For instance, I
> > oppose the use of single-package modules, because those more often
> > than not simply clutter the file system.
>
> The file system can hold many files. The Guix codebase is nowhere
> near the limit...
That's not a good argument, though. Theoretically, you could have one
file per package, or even one folder per package as the Gentoo folks
do. Clearly, this is not an appeal to file system limits, but to
limitations of humans and their tools. Have you tried exploring
/gnu/store? Merely loading it takes a considerable amount of time.

Cheers
M
M
Maxime Devos wrote on 25 Mar 11:26 +0100
9dc81d586944ac9cdd7505ed8e0cafdb95bceb7b.camel@telenet.be
Liliana Marie Prikler schreef op do 24-03-2022 om 16:38 [+0100]:
Toggle quote (16 lines)
> Am Donnerstag, dem 24.03.2022 um 16:05 +0100 schrieb Maxime Devos:
> > Liliana Marie Prikler schreef op do 24-03-2022 om 08:22 [+0100]:
> > > I agree that breaking up cycles is a good thing, but I disagree
> > > with some of the decisions you've made here.  For instance, I
> > > oppose the use of single-package modules, because those more often
> > > than not simply clutter the file system.
> >
> > There are some other sound applications in (gnu packages audio)
> > and (gnu packages music), so maybe I can make a (gnu packages audio-
> > apps) module where 'audacity' and other applications like 'calf' can
> > reside?
> I'm not sure. IIUC, audio should be for audio systems, codecs, etc.
> whereas music sounds like a particular niche containing music players
> etc.
> [...]

I'm not sure where the ‘I'm not sure’ comes from --- audacity is not an
audio system like pulseaudio or alsa, not a codec implementation like
libvorbis, and it is a sound player (and editor), so IIUC, audacity
does not fit into (gnu packages audio).

While it can be used for modifying and playing music, it is more
general than that, hence the suggestion of (gnu packages audio-apps)
(where some other packages can be moved to as well, maybe 'gnaural'?).

Though granted, it's difficult to make a strict distinction between
audio and music.

Toggle quote (3 lines)
> Perhaps the cycle could more appropriately been broken by moving
> stuff from music to audio?

(gnu packages music) is full of applications using gtk+ or gles or the
like. Moving them to (gnu packages audio) would make (gnu packages
audio) depend on (gnu packages gtk) and friends, which seems counter-
productive to me.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYj2Y7hccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7r9TAQDm2MtmjvUEkBqTQr1kj7QWr4Kd
Vsh3X1O2j42AfQ2/hgEAqaXwv3//EubdEfSmX+BGbeuRItDtJ3h6fI46WA3fBQM=
=T7AB
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 25 Mar 12:47 +0100
3e47544944b522f78002dd628a772216958e0ad9.camel@ist.tugraz.at
Am Freitag, dem 25.03.2022 um 11:26 +0100 schrieb Maxime Devos:
Toggle quote (22 lines)
> Liliana Marie Prikler schreef op do 24-03-2022 om 16:38 [+0100]:
> > Am Donnerstag, dem 24.03.2022 um 16:05 +0100 schrieb Maxime Devos:
> >
> > > Liliana Marie Prikler schreef op do 24-03-2022 om 08:22 [+0100]:
> > > > I agree that breaking up cycles is a good thing, but I disagree
> > > > with some of the decisions you've made here.  For instance, I
> > > > oppose the use of single-package modules, because those more
> > > > often than not simply clutter the file system.
> > >
> > > There are some other sound applications in (gnu packages audio)
> > > and (gnu packages music), so maybe I can make a (gnu packages
> > > audio-apps) module where 'audacity' and other applications like
> > > 'calf' can reside?
> > I'm not sure.  IIUC, audio should be for audio systems, codecs,
> > etc. whereas music sounds like a particular niche containing music
> > players etc.
> > [...]
>
> I'm not sure where the ‘I'm not sure’ comes from --- audacity is not
> an audio system like pulseaudio or alsa, not a codec implementation
> like libvorbis, and it is a sound player (and editor), so IIUC,
> audacity does not fit into (gnu packages audio).
It's not particularly specific to audacity in this case, it's that I
think that "-app" does not make for a useful distinction. Consider
fluidsynth. Is it an app, a library, something else? If fluidsynth
was causing circular imports and moving it to audio-synthesizers fixed
things, that'd be fine by me. gnaural could also fit into
synthesizers. However, putting both in the same file might still be an
issue from a cycle perspective, because the latter needs gtk, whereas
the former is content with having just glib (although that one appears
benign on surface, as at the very least gtk does not audio directly).

Toggle quote (15 lines)
> While it can be used for modifying and playing music, it is more
> general than that, hence the suggestion of (gnu packages audio-apps)
> (where some other packages can be moved to as well, maybe
> 'gnaural'?).
>
> Though granted, it's difficult to make a strict distinction between
> audio and music.
>
> >   Perhaps the cycle could more appropriately been broken by moving
> > stuff from music to audio?
>
> (gnu packages music) is full of applications using gtk+ or gles or
> the like.  Moving them to (gnu packages audio) would make (gnu
> packages audio) depend on (gnu packages gtk) and friends, which seems
> counter-productive to me.
That's the status quo (through gnaural and audacity for example). To
make a more educated guess, which cycle do we aim to address here? Is
there a meaningful cut that can be made (e.g. the offending packages
are all "audio editors", "audio synthesizers", etc.) or do we have to
separate good and bad based on their inputs?

Cheers
M
M
Maxime Devos wrote on 25 Mar 15:12 +0100
ff888453c3b11f0fe77e00d0d27d9854bddd22d9.camel@telenet.be
Liliana Marie Prikler schreef op vr 25-03-2022 om 12:47 [+0100]:
Toggle quote (6 lines)
> That's the status quo (through gnaural and audacity for example).  To
> make a more educated guess, which cycle do we aim to address here?  Is
> there a meaningful cut that can be made (e.g. the offending packages
> are all "audio editors", "audio synthesizers", etc.) or do we have to
> separate good and bad based on their inputs?

Some cycles:

(gnu packages pulseaudio) -> (gnu packages audio) -> (gnu packages gtk)
/(gnu packages qt)-> (gnu packages pulseaudio) + the world

(gnu packages pulseaudio) -> (gnu packages audio) -> (gnu packages
webkit) -> (gnu packages gstreamer) + the world -> (gnu packages
pulseaudio) + the world

Suggested cut: audio libraries like flac, libogg, libvorbis, opus,
wildmidi, vo-aacenc, tinyalsa ... can go in (gnu packages audio), other
things go somewhere else, especially if they need expensive imports.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYj3N6BccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7v6UAQCWtpEWEGHceh+JtnqhPF3r9XwX
4BmPQoQM871NI3vBxAD/ZJ+yNKPCI+Msfj+02dH3ROcdadLZkdaZktXRml+bcgc=
=zZCv
-----END PGP SIGNATURE-----


L
L
Liliana Marie Prikler wrote on 25 Mar 15:27 +0100
56df912130f0b984fd7193f1255a3674a043f028.camel@ist.tugraz.at
Am Freitag, dem 25.03.2022 um 15:12 +0100 schrieb Maxime Devos:
Toggle quote (22 lines)
> Liliana Marie Prikler schreef op vr 25-03-2022 om 12:47 [+0100]:
> > That's the status quo (through gnaural and audacity for example). 
> > To make a more educated guess, which cycle do we aim to address
> > here? 
> > Is there a meaningful cut that can be made (e.g. the offending
> > packages are all "audio editors", "audio synthesizers", etc.) or do
> > we have to separate good and bad based on their inputs?
>
> Some cycles:
>
> (gnu packages pulseaudio) -> (gnu packages audio) -> (gnu packages
> gtk)
> /(gnu packages qt)-> (gnu packages pulseaudio) + the world
>
> (gnu packages pulseaudio) -> (gnu packages audio) -> (gnu packages
> webkit) -> (gnu packages gstreamer) + the world -> (gnu packages
> pulseaudio) + the world
>
> Suggested cut: audio libraries like flac, libogg, libvorbis, opus,
> wildmidi, vo-aacenc, tinyalsa ... can go in (gnu packages audio),
> other things go somewhere else, especially if they need expensive
> imports.
Hmm, is it all codecs? In that case, I'd suggest making a smaller (gnu
packages audio-codecs), that can be used by (gnu packages audio-
systems) [including (tiny)alsa, pulseaudio, jack, ...] that can be used
by the rest of the world. Having that, we could move "the rest" into
audio-xyz (or let it simply remain "audio"). Would that be actionable?

(Note: There might still be debate w.r.t. the above split when
considering synthesizers, as they are technically not codecs, but we
still need to distinguish between low-level synths like fluidsynth and
wildmidi vs. full-on sound stations.)

(Note2: Of course, this assumes that neither audio-codecs nor audio-
systems will ever need to import any of the rust stuff. *sigh*)


Cheers
M
M
Maxime Devos wrote on 25 Mar 15:36 +0100
(address . 54539@debbugs.gnu.org)
13a80b63e826a8f77c87a6f2375751806cdb7cf2.camel@telenet.be
Maxime Devos schreef op wo 23-03-2022 om 19:46 [+0100]:
Toggle quote (4 lines)
> Import cycles make some packaging things harder and prevent some
> proposed optimisations to "guix pull", let's start eliminating them.
> TBC ...

I (locally) reverted the six patches I sent previously and I tried out
the 'module-ref'+'resolve-interface' strategy on (gnu packages linux)
(see attached patch). WDYT of repeating this with a few other
‘strategic’ modules, e.g. (gnu packages compression), (gnu packages
perl), (gnu packages version-control)?

Greetings,
Maxime.
From e64caee6518305e9a46588c569beff35ab54187c Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Fri, 25 Mar 2022 14:27:20 +0000
Subject: [PATCH] gnu: linux: Avoid importing often optional modules.

(gnu packages linux) is imported from many places, and in
turn it imported quite a few modules that import many things
on their own (e.g. gtk, haskell-apps, python-xyz). Avoid
doing that, in case all we need is 'util-linux'.

To actually have a significant effect, this needs to be
done for more package modules, see later patches.

* gnu/packages/linux.scm: Avoid importing the 'audio', 'avahi',
'backup', 'boost', 'calendar', 'check', 'crypto', 'cryptsetup',
'datastructures, 'docbook', 'documentation', 'freedesktop',
'gnupg', 'golang', 'gstreamer', 'gtk', 'haskell-apps',
'haskell-xyz', 'lua', 'maths', 'netpbm', 'networking',
'pulseaudio', 'python-xyz', 'rrdtool', 'samba', 'sdl',
'serialization', 'tls,' 'valgrind', 'video', 'vulkan', 'web',
'xiph', 'xdisorg' and 'xorg'. Add a TODO about moving 'bc'
to a more practical place.
---
gnu/packages/linux.scm | 237 +++++++++++++++++++++++------------------
1 file changed, 133 insertions(+), 104 deletions(-)

Toggle diff (606 lines)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 8d9dc01839..ef0c0f861e 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -52,7 +52,7 @@
 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
 ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
-;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
@@ -82,77 +82,42 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
+  ;; TODO: move 'bc' to 'base' to avoid this import
   #:use-module (gnu packages algebra)
-  #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
-  #:use-module (gnu packages avahi)
-  #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
-  #:use-module (gnu packages boost)
-  #:use-module (gnu packages calendar)
-  #:use-module (gnu packages check)
   #:use-module (gnu packages cpio)
-  #:use-module (gnu packages crypto)
-  #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages dbm)
-  #:use-module (gnu packages datastructures)
-  #:use-module (gnu packages docbook)
-  #:use-module (gnu packages documentation)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages file)
-  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gawk)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
-  #:use-module (gnu packages gnupg)
-  #:use-module (gnu packages golang)
   #:use-module (gnu packages gperf)
-  #:use-module (gnu packages gstreamer)
-  #:use-module (gnu packages gtk)
-  #:use-module (gnu packages haskell-apps)
-  #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages llvm)
-  #:use-module (gnu packages lua)
   #:use-module (gnu packages man)
-  #:use-module (gnu packages maths)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
-  #:use-module (gnu packages netpbm)
-  #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
   #:use-module (gnu packages nss)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages popt)
-  #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
-  #:use-module (gnu packages rrdtool)
-  #:use-module (gnu packages samba)
-  #:use-module (gnu packages sdl)
-  #:use-module (gnu packages serialization)
   #:use-module (gnu packages slang)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages textutils)
-  #:use-module (gnu packages tls)
-  #:use-module (gnu packages valgrind)
-  #:use-module (gnu packages video)
-  #:use-module (gnu packages vulkan)
-  #:use-module (gnu packages web)
-  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages xdisorg)
-  #:use-module (gnu packages xorg)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages selinux)
   #:use-module (gnu packages swig)
@@ -179,6 +144,60 @@
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex))
 
+;; Avoid importing (gnu packages audio) to avoid increasing
+;; the module closure when all we need is 'linux-libre-headers'.
+(define (module-variable-resolver module)
+  (lambda (variable)
+    (module-ref (resolve-interface module) variable)))
+
+(define audio-package (module-variable-resolver '(gnu packages audio)))
+(define avahi-package (module-variable-resolver '(gnu packages avahi)))
+(define backup-package (module-variable-resolver '(gnu packages backup)))
+(define boost-package (module-variable-resolver '(gnu packages boost)))
+(define calendar-package (module-variable-resolver '(gnu packages calendar)))
+(define check-package (module-variable-resolver '(gnu packages check)))
+(define crypto-package (module-variable-resolver '(gnu packages crypto)))
+(define cryptsetup-package
+  (module-variable-resolver '(gnu packages cryptsetup)))
+(define datastructures-package
+  (module-variable-resolver '(gnu packages datastructures)))
+(define docbook-package
+  (module-variable-resolver '(gnu packages docbook)))
+(define documentation-package
+  (module-variable-resolver '(gnu packages documentation)))
+(define freedesktop-package
+  (module-variable-resolver '(gnu packages freedesktop)))
+(define gnupg-package (module-variable-resolver '(gnu packages gnupg)))
+(define golang-package (module-variable-resolver '(gnu packages golang)))
+(define gstreamer-package (module-variable-resolver '(gnu packages gstreamer)))
+(define gtk-package (module-variable-resolver '(gnu packages gtk)))
+(define haskell-apps-package
+  (module-variable-resolver '(gnu packages haskell-apps)))
+(define haskell-xyz-package
+  (module-variable-resolver '(gnu packages haskell-xyz)))
+(define lua-package (module-variable-resolver '(gnu packages lua)))
+(define maths-package (module-variable-resolver '(gnu packages maths)))
+(define netpbm-package
+  (module-variable-resolver '(gnu packages netpbm)))
+(define networking-package
+  (module-variable-resolver '(gnu packages networking)))
+(define pulseaudio-package
+  (module-variable-resolver '(gnu packages pulseaudio)))
+(define python-xyz-package
+  (module-variable-resolver '(gnu packages python-xyz)))
+(define samba-package (module-variable-resolver '(gnu packages samba)))
+(define rrdtool-package (module-variable-resolver '(gnu packages rrdtool)))
+(define sdl-package (module-variable-resolver '(gnu packages sdl)))
+(define serialization-package
+  (module-variable-resolver '(gnu packages serialization)))
+(define tls-package (module-variable-resolver '(gnu packages tls)))
+(define valgrind-package (module-variable-resolver '(gnu packages valgrind)))
+(define video-package (module-variable-resolver '(gnu packages video)))
+(define xdisorg-package (module-variable-resolver '(gnu packages xdisorg)))
+(define xorg-package (module-variable-resolver '(gnu packages xorg)))
+(define vulkan-package (module-variable-resolver '(gnu packages vulkan)))
+(define web-package (module-variable-resolver '(gnu packages web)))
+
 (define-public (system->linux-architecture arch)
   "Return the Linux architecture name for ARCH, a Guix system name such as
 \"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
@@ -791,7 +810,7 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration."
     (native-inputs
      `(("perl" ,perl)
        ("bc" ,bc)
-       ("openssl" ,openssl)
+       ("openssl" ,(tls-package 'openssl))
        ("elfutils" ,elfutils)  ; Needed to enable CONFIG_STACK_VALIDATION
        ("flex" ,flex)
        ("bison" ,bison)
@@ -1680,7 +1699,7 @@ at login.  Local and dynamic reconfiguration are its key features.")
     (inputs
      (list linux-pam))
     (native-inputs
-     (list python-pytest))
+     (list (check-package 'python-pytest)))
     (home-page "https://github.com/minrk/pamela")
     (synopsis "PAM interface using ctypes")
     (description "This package provides a PAM interface using @code{ctypes}.")
@@ -1701,7 +1720,7 @@ at login.  Local and dynamic reconfiguration are its key features.")
                 "1bf91gi6zmfzzmczxm7pajxdlgnikasvg5xsd3j0a368rcr7lf9l"))))
     (build-system gnu-build-system)
     (inputs
-     (list gnupg linux-pam))
+     (list (gnupg-package 'gnupg) linux-pam))
     (native-inputs
      (list autoconf automake libtool))
     (arguments
@@ -2562,7 +2581,7 @@ MIDI functionality to the Linux-based operating system.")
     (native-inputs
      `(("gettext" ,gettext-minimal)))
     (inputs
-     (list libsamplerate ncurses alsa-lib xmlto))
+     (list (pulseaudio-package 'libsamplerate) ncurses alsa-lib xmlto))
     (home-page "http://www.alsa-project.org/")
     (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
     (description
@@ -2625,11 +2644,11 @@ MIDI functionality to the Linux-based operating system.")
                #t))))))
     (inputs
      (list alsa-lib
-           jack-1
-           speex ; libspeexdsp resampling plugin
-           libsamplerate ; libsamplerate resampling plugin
-           ffmpeg ; libavcodec resampling plugin, a52 plugin
-           pulseaudio)) ; PulseAudio plugin
+           (audio-package 'jack-1)
+           (pulseaudio-package 'speex) ; libspeexdsp resampling plugin
+           (pulseaudio-package 'libsamplerate) ; libsamplerate resampling plugin
+           (video-package 'ffmpeg) ; libavcodec resampling plugin, a52 plugin
+           (pulseaudio-package 'pulseaudio))) ; PulseAudio plugin
     (native-inputs
      (list pkg-config))
     (home-page "http://www.alsa-project.org/")
@@ -3469,7 +3488,7 @@ file system is as easy as logging into the server with an SSH client.")
        (sha256
         (base32 "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5"))))
     (build-system gnu-build-system)
-    (inputs (list fuse libarchive))
+    (inputs (list fuse (backup-package 'libarchive)))
     (native-inputs (list pkg-config))
     (home-page "https://www.cybernoia.de/software/archivemount.html")
     (synopsis "Tool for mounting archive files with FUSE")
@@ -3771,12 +3790,12 @@ from the module-init-tools project.")
       (append
         ;; To generate the manpage.
         (if (or (target-x86-64?) (target-x86-32?))
-          (list pandoc)
+          (list (haskell-xyz-package 'pandoc))
           '())
         (list
           ;; For the test suite.
-          cppcheck
-          go)))
+          (check-package 'cppcheck)
+          (golang-package '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
@@ -3846,8 +3865,8 @@ to the in-kernel OOM killer.")
        ("perl" ,perl)
        ("python" ,python-wrapper)
        ;; For documentation.
-       ("docbook-xml" ,docbook-xml-4.2)
-       ("docbook-xsl" ,docbook-xsl)
+       ("docbook-xml" ,(docbook-package 'docbook-xml-4.2))
+       ("docbook-xsl" ,(docbook-package 'docbook-xsl))
        ("libxml2" ,libxml2)             ;for $XML_CATALOG_FILES
        ("xsltproc" ,libxslt)))
     (inputs
@@ -3917,7 +3936,8 @@ devices that can inject events directly into the input subsystem.")
     (native-inputs
      (list pkg-config))
     (inputs
-     (list boost libevdev eudev yaml-cpp))
+     (list (boost-package 'boost) (xorg-package 'libevdev) eudev
+           (serialization-package 'yaml-cpp)))
     (arguments
      `(#:tests? #f))                    ; no test suite
     (synopsis "Utilities for operating on input events of evdev devices")
@@ -3951,7 +3971,7 @@ devices that can inject events directly into the input subsystem.")
                 "0s49vbg3j4rwh78i8rx8qr7myql09p7b3lhrjl0p7dd98xp6ann6"))))
     (build-system gnu-build-system)
     (inputs
-     (list libevdev yaml-cpp))
+     (list (xorg-package 'libevdev) (serialization-package 'yaml-cpp)))
     (arguments
      `(#:make-flags (list ,(string-append "CC=" (cc-for-target))
                           ,(string-append "CXX=" (cxx-for-target))
@@ -4121,7 +4141,7 @@ mapper.  Kernel components are part of Linux-libre.")
      `(("automake" ,automake)
        ("autoreconf" ,autoconf)))
     (inputs
-     (list boost expat libaio))
+     (list (boost-package 'boost) expat libaio))
     (synopsis "Tools for manipulating the metadata of device-mapper targets")
     (description "A suite of tools for manipulating the metadata of the
 dm-thin, dm-cache and dm-era device-mapper targets.")
@@ -4372,7 +4392,8 @@ country-specific regulations for the wireless spectrum.")
         (base32 "1ipf6wjx037sqyhy0r5jh4983h216anq9l68ckn2x5c3qc4wfmzn"))
        (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
     (build-system gnu-build-system)
-    (inputs (list rrdtool perl kmod gnuplot))
+    (inputs (list (rrdtool-package 'rrdtool) perl kmod
+                  (maths-package 'gnuplot)))
     (native-inputs (list pkg-config flex bison which))
     (outputs '("lib"                    ; avoid perl in closure
                "out"))
@@ -4516,7 +4537,7 @@ SMBus access.")
                 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
     (build-system gnu-build-system)
     (inputs `(("lm-sensors" ,lm-sensors "lib")
-              ("gtk" ,gtk+-2)))
+              ("gtk" ,(gtk-package 'gtk+-2))))
     (native-inputs (list pkg-config))
     (arguments
      `(#:phases
@@ -4589,9 +4610,9 @@ in a digital read-out.")
            numactl                   ;for 'perf bench numa mem'
            ;; Documentation.
            libxml2                                ;for $XML_CATALOG_FILES
-           docbook-xsl
+           (docbook-package 'docbook-xsl)
            xmlto
-           asciidoc))
+           (documentation-package 'asciidoc)))
     (home-page "https://perf.wiki.kernel.org/")
     (synopsis "Linux profiling with performance counters")
     (description
@@ -4699,7 +4720,7 @@ thanks to the use of namespaces.")
                                  out "/bin/singularity")))
                #t))))))
     (inputs
-     `(("libarchive" ,libarchive)
+     `(("libarchive" ,(backup-package 'libarchive))
        ("python" ,python-wrapper)
        ("zlib" ,zlib)
        ("squashfs-tools" ,squashfs-tools)))
@@ -5213,13 +5234,13 @@ arrays when needed.")
              #t))
          (delete 'configure))))         ; no configure script
     (native-inputs
-     (list perl pkg-config valgrind
+     (list perl pkg-config (valgrind-package 'valgrind)
            ;; For tests.
-           cmocka))
+           (check-package 'cmocka)))
     (inputs
-     `(("json-c" ,json-c)
+     `(("json-c" ,(web-package 'json-c))
        ("libaio" ,libaio)
-       ("liburcu" ,liburcu)
+       ("liburcu" ,(datastructures-package 'liburcu))
        ("lvm2" ,lvm2)
        ("readline" ,readline)
        ("udev" ,eudev)))
@@ -5323,7 +5344,7 @@ applications.")
                  #t))))))
       (inputs
        `(("libaio" ,libaio)
-         ("gnuplot" ,gnuplot)
+         ("gnuplot" ,(maths-package 'gnuplot))
          ("python" ,python-wrapper)))             ;for 'bno_plot.py'
       (synopsis "Block layer IO tracing mechanism")
       (description "Blktrace is a block layer IO tracing mechanism which provides
@@ -5345,7 +5366,7 @@ event traces from the kernel (via the relaying through the debug file system).")
                 "1liig5856crb331dps18mp0s13zbkv7yh007zqhq97m94fcddfhc"))))
     (build-system gnu-build-system)
     (inputs
-     (list libsndfile))
+     (list (pulseaudio-package 'libsndfile)))
     (native-inputs
      (list pkg-config))
     (home-page "https://www.kernel.org/pub/linux/bluetooth/")
@@ -5411,10 +5432,10 @@ Bluetooth audio output devices like headphones or loudspeakers.")
                #t))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
-       ("rst2man" ,python-docutils)
+       ("rst2man" ,(python-xyz-package 'python-docutils))
        ("gettext" ,gettext-minimal)))
     (inputs
-     (list glib dbus eudev libical readline))
+     (list glib dbus eudev (calendar-package 'libical) readline))
     (home-page "http://www.bluez.org/")
     (synopsis "Linux Bluetooth protocol stack")
     (description
@@ -5575,12 +5596,12 @@ and copy/paste text in the console and in xterm.")
               ("zstd" ,zstd "lib")
               ("zstd:static" ,zstd "static")))
     (native-inputs `(("pkg-config" ,pkg-config)
-                     ("asciidoc" ,asciidoc)
+                     ("asciidoc" ,(documentation-package 'asciidoc))
                      ("python" ,python)
                      ("xmlto" ,xmlto)
                      ;; For building documentation.
                      ("libxml2" ,libxml2)
-                     ("docbook-xsl" ,docbook-xsl)
+                     ("docbook-xsl" ,(docbook-package 'docbook-xsl))
                      ;; For tests.
                      ("acl" ,acl)
                      ("which" ,which)
@@ -5912,7 +5933,8 @@ feature, and a laptop with an accelerometer.  It has no effect on SSDs.")
     (native-inputs
      (list pkg-config))
     (inputs
-     (list libatasmart yaml-cpp))
+     (list (freedesktop-package 'libatasmart)
+           (serialization-package 'yaml-cpp)))
     (home-page "https://github.com/vmatare/thinkfan")
     (synopsis "Simple fan control program")
     (description
@@ -6204,7 +6226,8 @@ from the ntfs-3g package.  It is meant to be used in initrds.")
      `(("ninja" ,ninja)
        ("pkg-config" ,pkg-config)
        ("python" ,python-wrapper)
-       ("python-docutils" ,python-docutils)))     ;for 'rst2man'
+       ;; For 'rst2man'
+       ("python-docutils" ,(python-xyz-package 'python-docutils))))
     (inputs
      `(("libnl" ,libnl)
        ("udev" ,eudev)))
@@ -6304,7 +6327,7 @@ The collection contains a set of bandwidth and latency benchmark such as:
      (list autoconf automake pkg-config))
     (inputs
      `(("libsysfs" ,sysfsutils)
-       ("openssl" ,openssl)))
+       ("openssl" ,(tls-package 'openssl))))
     (synopsis "Random number generator daemon")
     (description
      "Monitor a hardware random number generator, and supply entropy
@@ -6345,7 +6368,7 @@ from that to the system kernel's @file{/dev/random} machinery.")
                             "PACKAGE_BUGREPORT=bug-guix@gnu.org"))
        #:tests? #f)) ;no tests
     (native-inputs `(("gettext" ,gettext-minimal)))
-    (inputs (list pciutils))
+    (inputs (list (xorg-package 'pciutils)))
     (home-page (package-home-page linux-libre))
     (synopsis "CPU frequency and voltage scaling tools for Linux")
     (description
@@ -6484,10 +6507,10 @@ not as a replacement for it.")
      (list intltool perl ; for pod2man
            pkg-config))
     (inputs
-     `(("keyutils" ,keyutils)
+     `(("keyutils" ,(crypto-package 'keyutils))
        ("linux-pam" ,linux-pam)
        ("utils-linux" ,util-linux)
-       ("cryptsetup" ,cryptsetup)
+       ("cryptsetup" ,(cryptsetup-package 'cryptsetup))
        ("lvm2" ,lvm2)
        ("nss" ,nss)))
     (home-page "https://ecryptfs.org/")
@@ -6626,12 +6649,13 @@ exceeded.")
              #~(list)
              #~(list "--enable-unit-tests"))))
     (native-inputs
-     (list cmocka pkg-config))
+     (list (check-package 'cmocka)
+           pkg-config))
     (inputs
      `(("acl" ,acl)                     ; extended attributes (xattr)
        ("libuuid" ,util-linux "lib")
        ("lzo" ,lzo)
-       ("openssl" ,openssl)             ; optional crypto support
+       ("openssl" ,(tls-package 'openssl)) ; optional crypto support
        ("zlib" ,zlib)
        ("zstd" ,zstd "lib")))
     (build-system gnu-build-system)
@@ -6708,7 +6732,9 @@ developers.")
      `(("gettext" ,gettext-minimal)
        ("pkg-config" ,pkg-config)))
     (inputs
-     (list libdrm libpciaccess libxcb ncurses))
+     (list (xdisorg-package 'libdrm)
+           (xorg-package 'libpciaccess)
+           (xorg-package 'libxcb) ncurses))
     (home-page "https://github.com/clbr/radeontop/")
     (synopsis "Usage monitor for AMD Radeon graphics")
     (description "RadeonTop monitors resource consumption on supported AMD
@@ -6924,7 +6950,7 @@ set the screen to be pitch black at a value of 0 (or higher).
     (native-inputs
      (list pkg-config))
     (inputs
-     (list elogind))
+     (list (freedesktop-package 'elogind)))
     (synopsis "Backlight and LED brightness control")
     (description
      "This program allows you read and control device brightness.  Devices
@@ -6949,11 +6975,11 @@ interface in sysfs, which can be accomplished with the included udev rules.")
        (sha256
         (base32 "0cssclk2brhwvn9dm7h5snm2svwy0c8cfr4z2cgkdkac2pfaaxw4"))))
     (native-inputs
-     (list shellcheck))
+     (list (haskell-apps-package 'shellcheck)))
     (inputs
      `(("bash" ,bash)
        ("dbus" ,dbus)
-       ("ethtool" ,ethtool)
+       ("ethtool" ,(networking-package 'ethtool))
        ("eudev" ,eudev)
        ("grep" ,grep)
        ("hdparm" ,hdparm)
@@ -7111,9 +7137,10 @@ every time the power supply source is changed.")
                (wrap-program (string-append out "/bin/tlpui")
                  `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
     (native-inputs
-     (list `(,glib "bin") gobject-introspection python-discover))
+     (list `(,glib "bin") gobject-introspection
+           (check-package 'python-discover)))
     (inputs
-     (list gtk+ python-pygobject tlp))
+     (list (gtk-package 'gtk+) python-pygobject tlp))
     (home-page "https://github.com/d4nj1/TLPUI")
     (synopsis "User interface for TLP written in Python")
     (description
@@ -7349,8 +7376,8 @@ userspace queueing component and the logging subsystem.")
                          coreutils
                          pkg-config
                          ;; For rst2man, used to generate the manual page.
-                         python-docutils))
-    (inputs (list libarchive talloc))
+                         (python-xyz-package 'python-docutils)))
+    (inputs (list (backup-package 'libarchive) (samba-package 'talloc)))
     (home-page "https://github.com/proot-me/PRoot")
     (synopsis "Unprivileged chroot, bind mount, and binfmt_misc")
     (description
@@ -7371,7 +7398,7 @@ available in the kernel Linux.")
     (name "proot-static")
     (synopsis
      "Unprivileged chroot, bind mount, and binfmt_misc (statically linked)")
-    (inputs `(("talloc" ,talloc/static)))
+    (inputs `(("talloc" ,(samba-package 'talloc/static))))
     (arguments
      (substitute-keyword-arguments (package-arguments proot)
        ((#:make-flags flags)
@@ -7463,7 +7490,7 @@ the MTP device as a file system.")
    (native-inputs
     (list pkg-config
           ;; For tests.
-          check groff))
+          (check-package 'check) groff))
    (inputs
     (list expat libcap libselinux))
    (synopsis "Utility to show process environment")
@@ -7623,7 +7650,7 @@ relevant @file{/dev/vcs*} file(s).")
      ;; The ‘fbgrab’ wrapper can use one of several PPM-to-PNG converters.  We
      ;; choose netpbm simply because it's the smallest.  It still adds ~94 MiB
      ;; to an otherwise tiny package, so we put ‘fbgrab’ in its own output.
-     `(("pnmtopng" ,netpbm)))
+     `(("pnmtopng" ,(netpbm-package 'netpbm))))
     (outputs (list "out" "fbgrab"))
     (arguments
      `(#:make-flags
@@ -7863,7 +7890,8 @@ management tools in userspace.")
     (arguments
      `(#:import-path "github.com/vishvananda/netlink"))
     (native-inputs
-     (list go-golang-org-x-sys go-netns))
+     (list (golang-package 'go-golang-org-x-sys)
+           (networking-package 'go-netns)))
     (home-page "https://github.com/vishvananda/netlink")
     (synopsis "Simple netlink library for Go")
     (description "The netlink package provides a simple netlink library for
@@ -7952,7 +7980,7 @@ compatible with Python's ConfigParser style of .INI files, including RFC
      `(("gettext" ,gettext-minimal)))
     (inputs
      `(("libinih" ,libinih)
-       ("liburcu" ,liburcu)
+       ("liburcu" ,(datastructures-package 'liburcu))
        ("libuuid" ,util-linux "lib")
        ("python" ,python-wrapper)))
     (home-page "https://xfs.wiki.kernel.org/")
@@ -8257,12 +8285,12 @@ types and interfaces and translates so that the X server can use them.")
      (list alsa-lib
            dbus
            eudev
-           ffmpeg
-           gstreamer
-           gst-plugins-base
-           libva
+           (video-package 'ffmpeg)
+           (gstreamer-package 'gstreamer)
+           (gstreamer-package 'gst-plugins-base)
+           (video-package 'libva)
            sbc
-           sdl2))
+           (sdl-package 'sdl2)))
     (home-page "https://pipewire.org/")
     (synopsis "Server and user space API to deal with multimedia pipelines")
     (description
@@ -8301,13 +8329,13 @@ of Linux application development.")
          ;; Skip shrink-runpath, otherwise validate-runpath fails.
          (delete 'shrink-runpath))))
     (inputs (modify-inputs (package-inputs pipewire)
-              (prepend avahi
+              (prepend (avahi-package 'avahi)
                        bluez
-                       jack-2
-                       ldacbt
-                       pulseaudio
-                       vulkan-loader
-                       vulkan-headers)))))
+                       (audio-package 'jack-1)
+                       (audio-package 'ldacbt)
+                       (pulseaudio-package 'pulseaudio)
+                       (vulkan-package 'vulkan-loader)
+                       (vulkan-package 'vulkan-headers))))))
 
 (define-public wireplumber
   (package
@@ -8330,7 +8358,8 @@ of Linux application development.")
     (native-inputs
      (list `(,glib "bin")
            pkg-config))
-    (inputs (list dbus elogind glib lua pipewire-0.3))
+    (inputs (list dbus (freedesktop-package 'elogind) glib
+                  (lua-package 'lua) pipewire-0.3))
     (home-page "https://gitlab.freedesktop.org/pipewire/wireplumber")
     (synopsis "Session / policy manager implementation for PipeWire")
     (description "WirePlumber is a modular session / policy manager for
@@ -8499,7 +8528,7 @@ headers.")
        ;; archives, only object files.
        ;; https://github.com/iovisor/bcc/issues/504
        ("elfutils" ,elfutils)
-       ("luajit" ,luajit)
+       ("luajit" ,(lua-package 'luajit))
        ("python-wrapper" ,python-wrapper)))
     (arguments
      `(;; Tests all require root permissions and a "standard" file hierarchy.

base-commit: 9a31942cabb5c73174aee96ecd873fcf89955a9d
-- 
2.30.2
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYj3TaxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7iPUAP9uEaaVRA36BAxSjDptQCaai9yd
b5eTKOGk8e4enlMwrAD7BTa6VSlBUDcSxfXts5fHe7OfcCJwF7sWOTacCzfRKgM=
=VOYg
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 25 Mar 15:42 +0100
Re: [PATCH 1/6] gnu: audacity: Move into new module to break cycles.
(address . 54539@debbugs.gnu.org)
123ca2707f2c3ddacf080aae3d337553279d4dc9.camel@telenet.be
One of the things I've tried out, is moving 'bc' from (gnu packages
algebra) to (gnu packages base). It allowed removing (gnu packages
algebra) from the imports of many packages. Does this seem reasonable?
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYj3U6xccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7qOqAP410MfbwfGwJ6AlbEvhmuju0zEB
rhmnuuNk8vW0Lb6mhgEAksXmMExp2Lf5euSQ0Ghm6QVvYgH6eTNqrfsZs272vws=
=B61Z
-----END PGP SIGNATURE-----


Z
Z
zimoun wrote on 25 Mar 18:05 +0100
Re: [bug#54539] [PATCH 0/6] Start breaking up import cycles
(name . Liliana Marie Prikler)(address . liliana.prikler@ist.tugraz.at)
CAJ3okZ3VLMiv+Wji5iXOVe2xvFcRXNAifSzO=1n+6QfUgHqu6Q@mail.gmail.com
Hi Liliana and Maxime,

On Fri, 25 Mar 2022 at 09:44, Liliana Marie Prikler
<liliana.prikler@ist.tugraz.at> wrote:

Toggle quote (17 lines)
> The question is (on a per-module basis) whether we consider this cheat
> fine or whether we want to move things into different files (and
> which). I so far haven't heard a good argument for the case of
> audacity I raised. "It breaks cycles" is not good enough when we
> consider the potential existence of other cuts (e.g. "audio-apps",
> although perhaps a more specific "audio-editors" similar to how we have
> "image-viewers" might make more sense), as well as the cheat of lazy
> imports.
>
> simon, you raise some important performance metrics, but there is such
> a thing as optimizing for the wrong metric. There are other variables
> to consider, like time to grep, "does it make sense that X belongs to Y
> and Z doesn't", etc., when it comes to ease of contributing. Declaring
> some modules banned for a given other module has an adverse effect
> here, in my opinion, and thus I claim that we need easily accessible
> ways of using those supposedly banned modules.

To be honest, I am not sure to understand the aim of reorganizing the
modules... I mean, to me, the only important metrics is the
performance of the end-user. If there is no performance improvement
when cutting cycle, then it appears to me pointless to cut cycles. :-)

Moreover, set an arbitrary boundary between packages is... arbitrary.
You can spend close to eternity for discussing "does it make sense
that X belongs to Y and Z doesn't". To me, such activity is like
"tagging" (assign a specific word belonging to a finite set of words),
it is usually a lot of effort and energy for, at the end, few, if not
none, pragmatic outcomes.

Last, for classification (assign a package to one module depending on
the affinity with the other packages of that module), well, it could
almost arbitrary (manual depending of human choice) as it is now or it
could be self-organized depending on the data themself. From my point
of view, it could be interesting to apply some kind of self-organized
map (SOM) and other related things. It could be help for many other
issues as "search". Pointers for what they are worth:



Cheers,
simon
M
M
Maxime Devos wrote on 25 Mar 18:46 +0100
(address . 54539@debbugs.gnu.org)
ca9bff4c2fd315de6f840eb11ce3c9e0b7951fb8.camel@telenet.be
zimoun schreef op vr 25-03-2022 om 18:05 [+0100]:
Toggle quote (5 lines)
> To be honest, I am not sure to understand the aim of reorganizing the
> modules... I mean, to me, the only important metrics is the
> performance of the end-user.  If there is no performance improvement
> when cutting cycle, then it appears to me pointless to cut cycles. :-)

FWIW, there are three goals here:

* Allowing writing stuff like

(use-modules (gnu packages ncurses))
(package
(name "some-terminal-app")
[...]
;; Work-around the ‘search path of dependencies not propagated’ bug.
(native-search-paths (package-native-search-paths ncurses)))

without getting 'unbound variable' errors.
Alternatively, the search-path-specification could be defined in,
say, (guix search-paths) next to $PATH but that proposal seems
to have been rejected.

* Making "compute-guix-derivation" faster by reducing the number of
(uncompiled!) package module files it needs to load.
* Eventually making the ‘incremental compilation’ by fine-grained derivations
proposal from the ‘Faster "guix pull" by incremental compilation and
non-circular modules?’ thread [0] feasible.

As a side benefit, it makes the output of "guix graph --type=module foo"
less cluttered and presumably reduces the module closure (a likely
side-effect of breaking cycles), making "guix show foo" (*) a bit faster.

(*) FWIW, on my machine, "guix show guix" takes 1.6s.


Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYj4ADhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7g65APoDxmOgfnnTrf8Qmjv8ATV+eR8c
OfKnGhbNznvPtKMeVQD/RYvSnEXRm8qz/td+Va+OS5NsOYPj5uRmBNVvE6S39Ak=
=hu6y
-----END PGP SIGNATURE-----


Z
Z
zimoun wrote on 25 Mar 20:33 +0100
(name . Maxime Devos)(address . maximedevos@telenet.be)
CAJ3okZ2t3TsOZJNxst+AJ+YxkhBfi9apFnpAFAmU2UE41sObVA@mail.gmail.com
Hi Maxime,

On Fri, 25 Mar 2022 at 18:46, Maxime Devos <maximedevos@telenet.be> wrote:
Toggle quote (30 lines)
> zimoun schreef op vr 25-03-2022 om 18:05 [+0100]:

> > To be honest, I am not sure to understand the aim of reorganizing the
> > modules... I mean, to me, the only important metrics is the
> > performance of the end-user. If there is no performance improvement
> > when cutting cycle, then it appears to me pointless to cut cycles. :-)
>
> FWIW, there are three goals here:
>
> * Allowing writing stuff like
>
> (use-modules (gnu packages ncurses))
> (package
> (name "some-terminal-app")
> [...]
> ;; Work-around the ‘search path of dependencies not propagated’ bug.
> (native-search-paths (package-native-search-paths ncurses)))
>
> without getting 'unbound variable' errors.
> Alternatively, the search-path-specification could be defined in,
> say, (guix search-paths) next to $PATH but that proposal seems
> to have been rejected.
>
> * Making "compute-guix-derivation" faster by reducing the number of
> (uncompiled!) package module files it needs to load.
>
> * Eventually making the ‘incremental compilation’ by fine-grained derivations
> proposal from the ‘Faster "guix pull" by incremental compilation and
> non-circular modules?’ thread [0] feasible.

Thanks for the detailed and clear explanations. It was my initial
understanding that cutting cycles can improve the performances, and
IMHO, timings are required for comparing apple to apple; as I tried to
explain [1]. Then the thread have let me the impression that the
performance improvement was not the aim -- thanks for clarifying.


Toggle quote (2 lines)
> (*) FWIW, on my machine, "guix show guix" takes 1.6s.

To be precise, "guix show guix" could be drastically improved by
adapting the already existing package.cache, i.e., resume the lengthy

However, such cache would be useless for "guix show -L path/to/others
foo" where performance can be really poor; especially on spinning hard
disk. Well, thanks for working on that by trying to tackle the cycle
of modules.


Cheers,
simon
L
L
Ludovic Courtès wrote on 19 Apr 11:17 +0200
Re: bug#54539: [PATCH 0/6] Start breaking up import cycles
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 54539@debbugs.gnu.org)
875yn5totd.fsf@gnu.org
Hi Maxime,

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (4 lines)
> Import cycles make some packaging things harder and prevent some
> proposed optimisations to "guix pull", let's start eliminating them.
> TBC ...

Sorry for the late reply.

Some of the changes you propose may make sense (and should be applied),
but we shouldn’t overplay the role of such changes.

If you follow the logic, breaking up import cycles would mean, in the
end, having one file per package.

But would that be enough? Probably not, because low-level packages are
bound to depend on high-level packages—e.g., glibc depends on Python,
some other low-level tool might depend on Pandoc (GHC), librsvg depends
on Rust, and so on.

IOW, since the graph of build dependency really is a graph, and not a
tree, there’ll always be import cycles.

(guix self), the module that ‘guix pull’ uses, already automatically
splits package modules into two groups. It’s not as modular as we’d
like, but it’s a start. What would be useful is to come up with metrics
and tools to reduce the closure of the “guix-packages-base” group.

WDYT?

Thanks,
Ludo’.
M
M
Maxime Devos wrote on 19 Apr 11:40 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54539@debbugs.gnu.org)
d88bcfc75a8e70ea9c85715bf4ccf14101a252ae.camel@telenet.be
Ludovic Courtès schreef op di 19-04-2022 om 11:17 [+0200]:
Toggle quote (3 lines)
> If you follow the logic, breaking up import cycles would mean, in the
> end, having one file per package.

Not necessarily, (gnu packages minetest) has multiple packages
(minetest and some of its mods) but it doesn't cause any cycles (no
other module, except sort-of (guix build-system minetest), imports it.)

That one appears to be, at least currently, a bit of a special case
though.

Toggle quote (8 lines)
> But would that be enough? Probably not, because low-level packages
> are bound to depend on high-level packages—e.g., glibc depends on
> Python, some other low-level tool might depend on Pandoc (GHC),
> librsvg depends on Rust, and so on.
>
> IOW, since the graph of build dependency really is a graph, and not a
> tree, there’ll always be import cycles.

The graph of build dependencies (in terms of derivations) is a tree,
the build daemon doesn't allow cyclic derivations. So I think that by
letting the module graph be a coarser version of the derivation graph
but still a tree (except for the bootstrap packages gcc, sed, ... whose
modules may import each other).

Toggle quote (7 lines)
> (guix self), the module that ‘guix pull’ uses, already automatically
> splits package modules into two groups.  It’s not as modular as we’d
> like, but it’s a start.  What would be useful is to come up with metrics
> and tools to reduce the closure of the “guix-packages-base” group.
>
> WDYT?

Maybe:

a tool that determines a minimal set of (importing module ->
imported module tuples) that needs to be lazified to reduce the
closure size (in number of modules) in guix-packages-base by N

and:

extend "guix style" to perform these changes

Maybe the ‘number of imports lazified -> number of modules in guix-
packages-base’ function has some sweet spot somewhere.

I think it would be easier though to work our way up before going to
"guix pull" -- first "hello", then "util-linux, then "guile-avahi",
then "guile-ssh", then "sqlite" ... and only eventually guix itself.

Also, even if the closure of "guix-packages-base" cannot be reduced,
making it (mostly) a tree would allow splitting the group into multiple
parts (see ‘Faster "guix pull" by incremental compilation and non-
circular modules?’).

Alternative:

* make _all_ package module imports lazy -- #:autoload everything!

guix-packages-base might then need to be set manually though ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYl6DlxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uCKAP9AakyPVN5WEsiyo9aUZWB/g0fn
nYlZDEMAaoD83b5HnQEAu5Ubu6GcAK8hwD0KSRj/AECHY8juz25R8UCqKHJGWwo=
=xTeP
-----END PGP SIGNATURE-----


M
M
Maxime Devos wrote on 19 Apr 17:31 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 54539@debbugs.gnu.org)
8b494778be379c23209a0864c3a15be413f0143e.camel@telenet.be
Ludovic Courtès schreef op di 19-04-2022 om 11:17 [+0200]:
Toggle quote (7 lines)
> (guix self), the module that ‘guix pull’ uses, already automatically
> splits package modules into two groups.  It’s not as modular as we’d
> like, but it’s a start.  What would be useful is to come up with metrics
> and tools to reduce the closure of the “guix-packages-base” group.
>
> WDYT?

Maybe as a first step, "guix style" could be taught to trim unused
imports? When writing the patches it turned out that some imports were
unnecessary and could therefore be removed ...

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYl7VthccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7o31AQCZaSFOnmNueUvB6YmXLTx2bafZ
0n47qrHPV+dIc53gRwD/ec5htdWDKlv1BsA9CDDDSadR8FVjPYS4AYWojeB69gc=
=ACx9
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 27 Apr 22:59 +0200
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 54539@debbugs.gnu.org)
87r15ii6ou.fsf@gnu.org
Hi!

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (11 lines)
> Ludovic Courtès schreef op di 19-04-2022 om 11:17 [+0200]:
>> (guix self), the module that ‘guix pull’ uses, already automatically
>> splits package modules into two groups.  It’s not as modular as we’d
>> like, but it’s a start.  What would be useful is to come up with metrics
>> and tools to reduce the closure of the “guix-packages-base” group.
>>
>> WDYT?
>
> Maybe as a first step, "guix style" could be taught to trim unused
> imports?

Yes, that would be nice.

Ludo’.
L
L
Ludovic Courtès wrote on 27 Apr 23:04 +0200
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 54539@debbugs.gnu.org)
87h76ei6fk.fsf@gnu.org
Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (11 lines)
> Ludovic Courtès schreef op di 19-04-2022 om 11:17 [+0200]:
>> If you follow the logic, breaking up import cycles would mean, in the
>> end, having one file per package.
>
> Not necessarily, (gnu packages minetest) has multiple packages
> (minetest and some of its mods) but it doesn't cause any cycles (no
> other module, except sort-of (guix build-system minetest), imports it.)
>
> That one appears to be, at least currently, a bit of a special case
> though.

I think so. All the historical package modules started that way.

Toggle quote (10 lines)
>> But would that be enough? Probably not, because low-level packages
>> are bound to depend on high-level packages—e.g., glibc depends on
>> Python, some other low-level tool might depend on Pandoc (GHC),
>> librsvg depends on Rust, and so on.
>>
>> IOW, since the graph of build dependency really is a graph, and not a
>> tree, there’ll always be import cycles.
>
> The graph of build dependencies (in terms of derivations) is a tree,

It’s a directed acyclic graph (DAG), not a tree.

Toggle quote (5 lines)
> the build daemon doesn't allow cyclic derivations. So I think that by
> letting the module graph be a coarser version of the derivation graph
> but still a tree (except for the bootstrap packages gcc, sed, ... whose
> modules may import each other).

I thought so, but came to the conclusion that it’s hardly feasible in
practice.

Toggle quote (13 lines)
>> (guix self), the module that ‘guix pull’ uses, already automatically
>> splits package modules into two groups.  It’s not as modular as we’d
>> like, but it’s a start.  What would be useful is to come up with metrics
>> and tools to reduce the closure of the “guix-packages-base” group.
>>
>> WDYT?
>
> Maybe:
>
> a tool that determines a minimal set of (importing module ->
> imported module tuples) that needs to be lazified to reduce the
> closure size (in number of modules) in guix-packages-base by N

Currently ‘source-module-closure’ considers #:autoloaded modules as part
of the closure; we could change that though and indeed, that might prove
helpful in this case.

Toggle quote (7 lines)
> and:
>
> extend "guix style" to perform these changes
>
> Maybe the ‘number of imports lazified -> number of modules in guix-
> packages-base’ function has some sweet spot somewhere.

Could be.

Toggle quote (15 lines)
> I think it would be easier though to work our way up before going to
> "guix pull" -- first "hello", then "util-linux, then "guile-avahi",
> then "guile-ssh", then "sqlite" ... and only eventually guix itself.
>
> Also, even if the closure of "guix-packages-base" cannot be reduced,
> making it (mostly) a tree would allow splitting the group into multiple
> parts (see ‘Faster "guix pull" by incremental compilation and non-
> circular modules?’).
>
> Alternative:
>
> * make _all_ package module imports lazy -- #:autoload everything!
>
> guix-packages-base might then need to be set manually though ...

I don’t know, having spent some time on this, I feel like there’s no
easy solution. But it could be that using autoloads at least in the
right places would help shrink ‘guix-packages-base’. Worth a try!

Ludo’.
?