summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-08-05 17:09:10 +0200
committerLudovic Courtès <ludo@gnu.org>2022-08-09 15:16:06 +0200
commit5bce4c82422de6beb3ce6120ba1592be898c2b72 (patch)
tree0323ba2fa56cf2388aeb4cd121793c074c9f681b /gnu
parent0d9eef0a06ffcb6a0f66d272ea036597b521ffb6 (diff)
downloadguix-5bce4c82422de6beb3ce6120ba1592be898c2b72.tar.gz
build-system: Add 'channel-build-system'.
* gnu/ci.scm (channel-build-system, channel-source->package): Remove.
* gnu/packages/package-management.scm (channel-source->package): New
procedure, moved from (gnu ci).
* guix/build-system/channel.scm: New file, with code moved from (gnu ci).
* doc/guix.texi (Build Systems): Document it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/ci.scm42
-rw-r--r--gnu/packages/package-management.scm16
2 files changed, 18 insertions, 40 deletions
diff --git a/gnu/ci.scm b/gnu/ci.scm
index 9389b43824..9cc3a1a81f 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -21,9 +21,9 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu ci)
-  #:use-module (guix channels)
+  #:use-module (guix build-system channel)
   #:use-module (guix config)
-  #:use-module (guix describe)
+  #:autoload   (guix describe) (package-channels)
   #:use-module (guix store)
   #:use-module (guix grafts)
   #:use-module (guix profiles)
@@ -32,7 +32,6 @@
   #:use-module (guix channels)
   #:use-module (guix config)
   #:use-module (guix derivations)
-  #:use-module (guix build-system)
   #:use-module (guix monads)
   #:use-module (guix gexp)
   #:use-module (guix ui)
@@ -71,7 +70,6 @@
             image->job
 
             %core-packages
-            channel-source->package
 
             arguments->systems
             cuirass-jobs))
@@ -288,42 +286,6 @@ otherwise use the IMAGE name."
               '()))
       '()))
 
-(define channel-build-system
-  ;; Build system used to "convert" a channel instance to a package.
-  (let* ((build (lambda* (name inputs
-                               #:key source commit system
-                               #:allow-other-keys)
-                  (mlet* %store-monad ((source (if (string? source)
-                                                   (return source)
-                                                   (lower-object source)))
-                                       (instance
-                                        -> (checkout->channel-instance
-                                            source #:commit commit)))
-                    (channel-instances->derivation (list instance)))))
-         (lower (lambda* (name #:key system source commit
-                               #:allow-other-keys)
-                  (bag
-                    (name name)
-                    (system system)
-                    (build build)
-                    (arguments `(#:source ,source
-                                 #:commit ,commit))))))
-    (build-system (name 'channel)
-                  (description "Turn a channel instance into a package.")
-                  (lower lower))))
-
-(define* (channel-source->package source #:key commit)
-  "Return a package for the given channel SOURCE, a lowerable object."
-  (package
-    (inherit guix)
-    (version (string-append (package-version guix) "+"))
-    (build-system channel-build-system)
-    (arguments `(#:source ,source
-                 #:commit ,commit))
-    (inputs '())
-    (native-inputs '())
-    (propagated-inputs '())))
-
 (define* (system-test-jobs store system
                            #:key source commit)
   "Return a list of jobs for the system tests."
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index c22c9f7a43..b9cd74eb27 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -110,6 +110,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages version-control)
+  #:autoload   (guix build-system channel) (channel-build-system)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system guile)
@@ -489,6 +490,21 @@ the Nix package manager.")
       (license license:gpl3+)
       (properties '((ftp-server . "alpha.gnu.org"))))))
 
+(define* (channel-source->package source #:key commit)
+  "Return a package for the given channel SOURCE, a lowerable object."
+  (package
+    (inherit guix)
+    (version (string-append (package-version guix) "."
+                            (if commit (string-take commit 7) "")))
+    (build-system channel-build-system)
+    (arguments `(#:source ,source
+                 #:commit ,commit))
+    (inputs '())
+    (native-inputs '())
+    (propagated-inputs '())))
+
+(export channel-source->package)
+
 (define-public guix-for-cuirass
   ;; Known-good revision before commit
   ;; bd86bbd300474204878e927f6cd3f0defa1662a5, which introduced