all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 50597@debbugs.gnu.org
Subject: bug#50597: different fixed-output when using ’--with-source’ transformation
Date: Wed, 13 Oct 2021 11:31:37 +0200	[thread overview]
Message-ID: <86wnmhi83q.fsf@gmail.com> (raw)
In-Reply-To: <87bl4kj4af.fsf@gnu.org>

Hi,

On Wed, 22 Sep 2021 at 12:25, Ludovic Courtès <ludo@gnu.org> wrote:

> However it’s not enough to get the same derivation: we’d also need
> <downloaded-file> to return a fixed-output derivation rather than a
> plain store file name.  (See also
> <https://issues.guix.gnu.org/49696>.)

Thanks for the explanations and the pointer.  Indeed, to be continued…


> diff --git a/guix/transformations.scm b/guix/transformations.scm
> index 5ae1977cb2..e0f5579c28 100644
> --- a/guix/transformations.scm
> +++ b/guix/transformations.scm
> @@ -46,6 +46,7 @@
>    #:use-module (srfi srfi-37)
>    #:use-module (ice-9 match)
>    #:use-module (ice-9 vlist)
> +  #:autoload   (web uri) (string->uri uri-scheme uri-path)
>    #:export (options->transformation
>              manifest-entry-with-transformations
>  
> @@ -106,15 +107,25 @@ extensions."
>  (define* (package-with-source p uri #:optional version)
>    "Return a package based on P but with its source taken from URI.  Extract
>  the new package's version number from URI."
> -  (let ((base (tarball-base-name (basename uri))))
> +  (let ((base (tarball-base-name (basename uri)))
> +        (file (match (string->uri uri)
> +                (#f uri)
> +                (uri (and (eq? 'file (uri-scheme uri))
> +                          (uri-path uri))))))
>      (let-values (((_ version*)
>                    (hyphen-package-name->name+version base)))
>        (package (inherit p)
>                 (version (or version version*
>                              (package-version p)))
>  
> -               ;; Use #:recursive? #t to allow for directories.
> -               (source (downloaded-file uri #t))))))
> +               ;; Default to #:recursive? #f to match what 'url-fetch' does,
> +               ;; but use #t when URI denotes a directory.
> +               (source (let ((recursive?
> +                              (and file
> +                                   (match (stat file #f)
> +                                     (#f #t)
> +                                     (st (eq? 'directory (stat:type st)))))))
> +                         (downloaded-file uri recursive?)))))))

LGTM!

Cheers,
simon




      reply	other threads:[~2021-10-13  9:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  5:44 bug#50597: different fixed-output when using ’--with-source’ transformation zimoun
2021-09-18 16:06 ` Ludovic Courtès
2021-09-18 17:35   ` Maxime Devos
2021-09-21  7:40   ` zimoun
2021-09-22 10:25     ` Ludovic Courtès
2021-10-13  9:31       ` zimoun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86wnmhi83q.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=50597@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.