From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRfOC-0003WS-Li for guix-patches@gnu.org; Tue, 27 Nov 2018 10:35:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRfOB-0000QD-4n for guix-patches@gnu.org; Tue, 27 Nov 2018 10:35:04 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:48167) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRfOB-0000Q4-22 for guix-patches@gnu.org; Tue, 27 Nov 2018 10:35:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gRfOA-0006Gw-VE for guix-patches@gnu.org; Tue, 27 Nov 2018 10:35:02 -0500 Subject: [bug#33522] [PATCH 2/3] git: Add record type. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 27 Nov 2018 16:34:01 +0100 Message-Id: <20181127153402.21357-2-ludo@gnu.org> In-Reply-To: <20181127153402.21357-1-ludo@gnu.org> References: <20181127153402.21357-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 33522@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= From: Ludovic Courtès * guix/git.scm (): 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 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 ) + system target) + ;; "Compile" CHECKOUT by updating the local checkout and adding it to the + ;; store. + (match checkout + (($ url branch) + (latest-repository-commit* url + #:ref `(branch . ,branch) + #:log-port (current-error-port))))) -- 2.19.2