summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-11-26 17:16:18 +0100
committerLudovic Courtès <ludo@gnu.org>2018-11-28 10:39:58 +0100
commitfe5db4eb03ff55a7b5731bea57f813cb8a9e3d8b (patch)
treedb1ede2b2e75a5095931841543b94f9c01183146
parent94c0e61fe759924625c9e27d3da8c7c0c767ea2b (diff)
downloadguix-fe5db4eb03ff55a7b5731bea57f813cb8a9e3d8b.tar.gz
channels: Add 'checkout->channel-instance'.
* guix/channels.scm (checkout->channel-instance): New procedure.
-rw-r--r--guix/channels.scm12
1 files changed, 12 insertions, 0 deletions
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.