GNU bug report logs - #33522
[PATCH 0/3] Add the '--with-branch' package transformation option

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Tue, 27 Nov 2018 15:33:02 UTC

Severity: normal

Tags: patch

Done: ludovic.courtes <at> inria.fr (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 33522 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludovic.courtes <at> inria.fr>
Subject: [bug#33522] [PATCH 2/3] git: Add <git-checkout> record type.
Date: Tue, 27 Nov 2018 16:34:01 +0100
From: Ludovic Courtès <ludovic.courtes <at> inria.fr>

* guix/git.scm (<git-checkout>): New record type.
(latest-repository-commit*): New procedure.
(git-checkout-compiler): New gexp compiler.
---
 guix/git.scm | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/guix/git.scm b/guix/git.scm
index 78645024c9..56cebb06ed 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -25,6 +25,8 @@
   #:use-module ((guix build utils) #:select (mkdir-p))
   #:use-module (guix store)
   #:use-module (guix utils)
+  #:use-module (guix records)
+  #:use-module (guix gexp)
   #:use-module (rnrs bytevectors)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -33,7 +35,12 @@
   #:use-module (srfi srfi-35)
   #:export (%repository-cache-directory
             update-cached-checkout
-            latest-repository-commit))
+            latest-repository-commit
+
+            git-checkout
+            git-checkout?
+            git-checkout-url
+            git-checkout-branch))
 
 (define %repository-cache-directory
   (make-parameter (string-append (cache-directory #:ensure? #f)
@@ -185,3 +192,28 @@ Log progress and checkout info to LOG-PORT."
     (values (add-to-store store name #t "sha256" checkout
                           #:select? (negate dot-git?))
             commit)))
+
+
+;;;
+;;; Checkouts.
+;;;
+
+;; Representation of the "latest" checkout of a branch.
+(define-record-type* <git-checkout>
+  git-checkout make-git-checkout
+  git-checkout?
+  (url     git-checkout-url)
+  (branch  git-checkout-branch (default "master")))
+
+(define latest-repository-commit*
+  (store-lift latest-repository-commit))
+
+(define-gexp-compiler (git-checkout-compiler (checkout <git-checkout>)
+                                             system target)
+  ;; "Compile" CHECKOUT by updating the local checkout and adding it to the
+  ;; store.
+  (match checkout
+    (($ <git-checkout> url branch)
+     (latest-repository-commit* url
+                                #:ref `(branch . ,branch)
+                                #:log-port (current-error-port)))))
-- 
2.19.2





This bug report was last modified 6 years and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.