Subject: [bug#54539] [PATCH 4/6] gnu: go-netlink: Move to (gnu packages networking) to break cycles.

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

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(-)

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