guix-patches
[Top][All Lists]
Advanced

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

[bug#61930] [PATCH] import: factorising git->origin in guix/import/utils


From: Simon Tournier
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@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@ens-lyon.fr>
>  ;;; Copyright © 2022 Kyle Meyer <kyle@kyleam.com>
>  ;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
> +;;; Copyright © 2023 Nicolas Graves <ngraves@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





reply via email to

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