[bug#33515,4/5] channels: Add 'checkout->channel-instance'.

Message ID 20181126164524.17680-4-ludo@gnu.org
State Accepted
Commit fe5db4eb03ff55a7b5731bea57f813cb8a9e3d8b
Headers show
Series Cuirass/Hydra: evaluate jobs in an inferior | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied
cbaines/applying patch success Successfully applied

Commit Message

Ludovic Courtès Nov. 26, 2018, 4:45 p.m. UTC
* guix/channels.scm (checkout->channel-instance): New procedure.
---
 guix/channels.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch

diff --git a/guix/channels.scm b/guix/channels.scm
index 82389eb583..e57da68149 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -47,6 +47,7 @@ 
             channel-instance-checkout
 
             latest-channel-instances
+            checkout->channel-instance
             latest-channel-derivation
             channel-instances->manifest
             channel-instances->derivation))
@@ -114,6 +115,17 @@  CHANNELS."
            (channel-instance channel commit checkout)))
        channels))
 
+(define* (checkout->channel-instance checkout
+                                     #:key commit
+                                     (url checkout) (name 'guix))
+  "Return a channel instance for CHECKOUT, which is assumed to be a checkout
+of COMMIT at URL.  Use NAME as the channel name."
+  (let* ((commit  (or commit (make-string 40 #\0)))
+         (channel (channel (name name)
+                           (commit commit)
+                           (url url))))
+    (channel-instance channel commit checkout)))
+
 (define %self-build-file
   ;; The file containing code to build Guix.  This serves the same purpose as
   ;; a makefile, and, similarly, is intended to always keep this name.