From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSVRS-0006hq-Kq for guix-patches@gnu.org; Tue, 04 Jul 2017 17:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSVRO-0004ps-Nk for guix-patches@gnu.org; Tue, 04 Jul 2017 17:33:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:49891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSVRO-0004po-Ku for guix-patches@gnu.org; Tue, 04 Jul 2017 17:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dSVRO-0005wW-FB for guix-patches@gnu.org; Tue, 04 Jul 2017 17:33:02 -0400 Subject: [bug#27550] [PATCH 0/2] cuirass: Prepare (guix git) integration. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170701150043.14654-1-m.othacehe@gmail.com> <87inj9pvvf.fsf@gnu.org> <868tk5ogwe.fsf@gmail.com> <867ezpocf4.fsf@gmail.com> Date: Tue, 04 Jul 2017 23:32:37 +0200 In-Reply-To: <867ezpocf4.fsf@gmail.com> (Mathieu Othacehe's message of "Mon, 03 Jul 2017 15:52:31 +0200") Message-ID: <87o9szsxai.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Mathieu Othacehe Cc: 27550@debbugs.gnu.org Hi Mathieu, Mathieu Othacehe skribis: > From 37d7b68c1e89a2873673613f4781efb6acda529b Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe > Date: Sat, 1 Jul 2017 12:29:59 +0200 > Subject: [PATCH] base: Use (guix git) module. > > * src/cuirass/base.scm (copy-repository-cache) : New procedure. > (fetch-repository): Use latest-repository-commit to fetch git > repository instead of raw git system commands. > (process-specs): Use fetch-repository to get a store directory > containing the repository described in SPEC, add copy it to cache with > "copy-repository-cache". Looks nice! > +(define (fetch-repository store spec) > + "Get the latest version of repository specified in SPEC. Return two > +values: the content of the git repository at URL copied into a store > +directory and the sha1 of the top level commit in this directory." > + > + (define (add-origin branch) > + "Prefix branch name with origin if no remote is specified." > + (if (string-index branch #\/) > + branch > + (string-append "origin/" branch))) > + > + (let ((name (assq-ref spec #:name)) > + (url (assq-ref spec #:url)) > + (branch (and=3D> (assq-ref spec #:branch) > + (lambda (b) > + `(branch . ,(add-origin b))))) > + (commit (and=3D> (assq-ref spec #:commit) > + (lambda (c) > + `(commit . ,c)))) > + (tag (and=3D> (assq-ref spec #:tag) > + (lambda (t) > + `(tag . ,t))))) > + (latest-repository-commit store url > + #:cache-directory (%package-cachedir) > + #:ref (pk (or branch commit tag))))) Leftover =E2=80=98pk=E2=80=99. :-) > + (with-store store > + (let ((stamp (db-get-stamp db spec))) > + (receive (store-dir commit) > + (fetch-repository store spec) Maybe s/store-dir/checkout/ for clarity. Please add a check for (guix git) in configure.ac. Now there are =E2=80=98git-error=E2=80=99 exception that can be thrown from= there. Should the =E2=80=98cuirass=E2=80=99 program catch them, report them on std= err, and keep going? Maybe we can ignore that for now (throwing is better than silently ignoring Git problems anyway.) Thanks, Ludo=E2=80=99.