guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#27550] [PATCH 0/2] cuirass: Prepare (guix git) integration.


From: Ludovic Courtès
Subject: [bug#27550] [PATCH 0/2] cuirass: Prepare (guix git) integration.
Date: Tue, 04 Jul 2017 23:32:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi Mathieu,

Mathieu Othacehe <address@hidden> skribis:

> From 37d7b68c1e89a2873673613f4781efb6acda529b Mon Sep 17 00:00:00 2001
> From: Mathieu Othacehe <address@hidden>
> 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=> (assq-ref spec #:branch)
> +                       (lambda (b)
> +                         `(branch . ,(add-origin b)))))
> +        (commit (and=> (assq-ref spec #:commit)
> +                       (lambda (c)
> +                         `(commit . ,c))))
> +        (tag    (and=> (assq-ref spec #:tag)
> +                       (lambda (t)
> +                         `(tag . ,t)))))
> +    (latest-repository-commit store url
> +                              #:cache-directory (%package-cachedir)
> +                              #:ref (pk (or branch commit tag)))))

Leftover ‘pk’.  :-)

> +    (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 ‘git-error’ exception that can be thrown from there.
Should the ‘cuirass’ program catch them, report them on stderr, and keep
going?  Maybe we can ignore that for now (throwing is better than
silently ignoring Git problems anyway.)

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]