bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53210: [WIP PATCH 1/4] gnu: ci: Move generic channel building code.


From: Josselin Poiret
Subject: bug#53210: [WIP PATCH 1/4] gnu: ci: Move generic channel building code.
Date: Mon, 14 Feb 2022 10:29:05 +0100

* gnu/ci.scm (channel-build-system): Move to guix/channels.scm.
(channel-source->package): Move to
gnu/packages/package-management.scm.
* guix/channels.scm (channel-build-system): Moved from gnu/ci.scm.
* gnu/packages/package-management.scm (channel-source->package): Moved
from gnu/ci.scm.
* etc/system-tests.scm: Use module (gnu packages package-management)
instead of (gnu ci).
---
 etc/system-tests.scm                |  1 -
 gnu/ci.scm                          | 38 -----------------------------
 gnu/packages/package-management.scm | 16 ++++++++++++
 guix/channels.scm                   | 27 ++++++++++++++++++++
 4 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/etc/system-tests.scm b/etc/system-tests.scm
index 1085deed24..ba0c106553 100644
--- a/etc/system-tests.scm
+++ b/etc/system-tests.scm
@@ -18,7 +18,6 @@
 
 (use-modules (gnu tests)
              (gnu packages package-management)
-             ((gnu ci) #:select (channel-source->package))
              ((guix git-download) #:select (git-predicate))
              ((guix utils) #:select (current-source-directory))
              (git)
diff --git a/gnu/ci.scm b/gnu/ci.scm
index 35fd583f75..be19bda413 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -32,7 +32,6 @@ (define-module (gnu ci)
   #: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)
@@ -72,7 +71,6 @@ (define-module (gnu ci)
 
             %core-packages
             %cross-targets
-            channel-source->package
 
             arguments->systems
             cuirass-jobs))
@@ -300,42 +298,6 @@ (define MiB
               '()))
       '()))
 
-(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 03cc9a6612..edef91ff7e 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -114,6 +114,9 @@ (define-module (gnu packages package-management)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
+  ;; This will be loaded by build-self.scm, but guile-git is unavailable, so
+  ;; lazily load instead.
+  #:autoload (guix channels) (channel-build-system guix-channel?)
   #:use-module (guix download)
   #:use-module (guix gexp)
   #:use-module (guix git-download)
@@ -572,6 +575,19 @@ (define (wrong-extension? file)
     (_
      #t)))
 
+(define-public channel-source->package
+  (lambda* (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-public current-guix-package
   ;; This parameter allows callers to override the package that 'current-guix'
   ;; returns.  This is useful when 'current-guix' cannot compute it by itself,
diff --git a/guix/channels.scm b/guix/channels.scm
index 5f47834c10..d637d5863a 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -27,6 +27,7 @@ (define-module (guix channels)
                 #:select (openpgp-public-key-fingerprint
                           openpgp-format-fingerprint))
   #:use-module (guix base16)
+  #:use-module (guix build-system)
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (guix modules)
@@ -93,6 +94,8 @@ (define-module (guix channels)
             channel-instances->derivation
             ensure-forward-channel-update
 
+            channel-build-system
+
             profile-channels
             manifest-entry-channel
             sexp->channel
@@ -952,6 +955,30 @@ (define* (latest-channel-derivation #:optional (channels 
%default-channels)
                                                   validate-pull)))
     (channel-instances->derivation instances)))
 
+(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* (sexp->channel sexp #:optional (name 'channel))
   "Read SEXP, a provenance sexp as created by 'channel-instance->sexp'; use
 NAME as the channel name if SEXP does not specify it.  Return #f if the sexp
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]