GNU bug report logs - #61930
[PATCH 0/1] Factorising git->origin function for imports.

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Fri, 3 Mar 2023 10:37:01 UTC

Severity: normal

Tags: patch

Done: Nicolas Graves <ngraves <at> ngraves.fr>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: 61930 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [bug#61930] [PATCH] import: factorising git->origin in guix/import/utils.scm.
Date: Fri, 07 Apr 2023 17:26:40 +0200
Hi Nicolas,

Sorry for the late reply.

On ven., 03 mars 2023 at 12:06, Nicolas Graves via Guix-patches via <guix-patches <at> gnu.org> wrote:
> ---
>  guix/import/elpa.scm     | 44 +++++++++++--------------------------
>  guix/import/go.scm       | 47 +++++++++-------------------------------
>  guix/import/minetest.scm | 28 ++----------------------
>  guix/import/utils.scm    | 36 ++++++++++++++++++++++++++++++
>  tests/minetest.scm       | 11 ++--------
>  5 files changed, 63 insertions(+), 103 deletions(-)

This patch does not apply anymore.  Could you rebase it on the top of
master?

Well, when using “git format-patch” the option ’--base’ is helpful for
this kind of cases because it stores the base commit against which it
applies.  Then, anyone is able to easily rebase.


> +(define (ref recipe)
> +  "Create REF from MELPA RECIPE."

Maybe instead, I would move this as a local definition under
’melpa-recipe->origin’.

> diff --git a/guix/import/utils.scm b/guix/import/utils.scm
> index 72795d2c61..3b31338e00 100644
> --- a/guix/import/utils.scm
> +++ b/guix/import/utils.scm
> @@ -13,6 +13,7 @@
>  ;;; Copyright © 2022 Alice Brenon <alice.brenon <at> ens-lyon.fr>
>  ;;; Copyright © 2022 Kyle Meyer <kyle <at> kyleam.com>
>  ;;; Copyright © 2022 Philip McGrath <philip <at> philipmcgrath.com>
> +;;; Copyright © 2023 Nicolas Graves <ngraves <at> ngraves.fr>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -40,6 +41,8 @@ (define-module (guix import utils)
>    #:use-module (guix discovery)
>    #:use-module (guix build-system)
>    #:use-module (guix gexp)
> +  #:use-module (guix git)
> +  #:use-module (guix hash)
>    #:use-module ((guix i18n) #:select (G_))
>    #:use-module (guix store)
>    #:use-module (guix download)
> @@ -63,6 +66,7 @@ (define-module (guix import utils)
>  
>              url-fetch
>              guix-hash-url
> +            git->origin
>  
>              package-names->package-inputs
>              maybe-inputs
> @@ -153,6 +157,38 @@ (define (guix-hash-url filename)
>    "Return the hash of FILENAME in nix-base32 format."
>    (bytevector->nix-base32-string (file-sha256 filename)))
>  
> +(define* (git->origin repo-url ref #:optional ref->commit)
> +  "Generate the `origin' block of a package depending on the git source
> +control system. REPO-URL or REF can be null."
> +  (let-values (((directory commit)
> +                (with-store store
> +                  (latest-repository-commit store repo-url #:ref ref))))
> +    (let* ((version (if (pair? ref)
> +                        (cdr ref)
> +                        #f))
> +           (vcommit (match ref->commit
             --^
         why vcommit?

Why not ’identifier’?


Cheers,
simon




This bug report was last modified 1 year and 106 days ago.

Previous Next


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