From: "Ludovic Courtès" <ludo@gnu.org>
To: Stephen Paul Weber <singpolyma@singpolyma.net>
Cc: guix-devel@gnu.org, 0@psycoti.ca
Subject: Re: git-fetch without a hash
Date: Tue, 03 Jan 2023 22:34:37 +0100 [thread overview]
Message-ID: <87o7rf715e.fsf@gnu.org> (raw)
In-Reply-To: <Y7SCiE9URY5K//zX@singpolyma-beefy.lan> (Stephen Paul Weber's message of "Tue, 3 Jan 2023 14:31:20 -0500")
Hi!
Stephen Paul Weber <singpolyma@singpolyma.net> skribis:
>>> However, there's no real reason that git-fetch *needs* to be
>>> fixed-output in terms of having a hash pre-defined, at least for local
>>> development and other purposes. So is there a way around this?
>>
>> • write (package (source (git-checkout …)) …)
>
> This works well. Now I'm curious how to know what can go in the
> (source) field? Obviously not just (origin)...
Any “file-like object” can go there: a package (though that makes little
sense), a “computed-file”, etc.
>>> If having a way around it is not desirable should url-fetch consider
>>> this an error as well?
>>
>>I’m not sure; do you have an example where it’s not behaving as
>>expected?
>
> Yes. When using (sha256 #f) url-fetch still has network access and
> works to download things, which is inconsistent vs other fetchers.
Hmm indeed:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(guix)
scheme@(guile-user)> ,verbosity 3
scheme@(guile-user)> ,build (origin
(method url-fetch)
(uri "mirror://gnu/hello/hello-2.12.1.tar.gz")
(sha256 #f))
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://guix.bordeaux.inria.fr'... 100.0%
building /gnu/store/lz34lhyxhq5wxj87fnd465hmwbhv17bn-hello-2.12.1.tar.gz.drv...
Starting download of /gnu/store/xfc7gsn10j09bi89ldbpfbppfkcldfy9-hello-2.12.1.tar.gz
From https://ftpmirror.gnu.org/gnu/hello/hello-2.12.1.tar.gz...
following redirection to `https://mirror.cyberbits.eu/gnu/hello/hello-2.12.1.tar.gz'...
downloading from https://ftpmirror.gnu.org/gnu/hello/hello-2.12.1.tar.gz ...
hello-2.12.1.tar.gz 1009KiB 18.4MiB/s 00:00 [##################] 100.0%
successfully built /gnu/store/lz34lhyxhq5wxj87fnd465hmwbhv17bn-hello-2.12.1.tar.gz.drv
$5 = "/gnu/store/xfc7gsn10j09bi89ldbpfbppfkcldfy9-hello-2.12.1.tar.gz"
--8<---------------cut here---------------end--------------->8---
In this case, the derivation uses the “download” built-in builder:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,lower (origin
(method url-fetch)
(uri "mirror://gnu/hello/hello-2.12.1.tar.gz")
(sha256 #f))
$6 = #<derivation /gnu/store/lz34lhyxhq5wxj87fnd465hmwbhv17bn-hello-2.12.1.tar.gz.drv => /gnu/store/xfc7gsn10j09bi89ldbpfbppfkcldfy9-hello-2.12.1.tar.gz 7f3ff487c000>
scheme@(guile-user)> (derivation-outputs $6)
$7 = (("out" . #<<derivation-output> path: "/gnu/store/xfc7gsn10j09bi89ldbpfbppfkcldfy9-hello-2.12.1.tar.gz" hash-algo: sha256 hash: #f recursive?: #f>))
scheme@(guile-user)> (fixed-output-derivation? $6)
$8 = #f
--8<---------------cut here---------------end--------------->8---
As it turns out, guix-daemon turns off the chroot for all built-in
builders, fixed-output or not; quoth ‘build.cc’:
/* Note: built-in builders are *not* running in a chroot environment so
that we can easily implement them in Guile without having it as a
derivation input (they are running under a separate build user,
though). */
useChroot = settings.useChroot && !isBuiltin(drv);
I was actually surprised to see this, this wasn’t really intended. The
good news is that this is safe AFAICS: there’s only one built-in builder
to date, and that’s “download”.
Now I wonder whether we should keep this “feature” or not. Probably not.
Thoughts?
Besides, we can think about adding more builtins, such as a
“git-download” builtin, which would let us break potential cycles.
Ludo’.
next prev parent reply other threads:[~2023-01-03 21:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 3:04 git-fetch without a hash Stephen Paul Weber
2022-12-21 22:49 ` Ludovic Courtès
2023-01-03 19:31 ` Stephen Paul Weber
2023-01-03 21:34 ` Ludovic Courtès [this message]
2023-01-05 10:06 ` Simon Tournier
2023-01-09 11:16 ` Ludovic Courtès
2023-01-11 15:34 ` Simon Tournier
2023-02-05 17:44 ` bokr
2023-02-06 17:01 ` Simon Tournier
2023-01-09 17:13 ` Ludovic Courtès
2023-01-09 17:35 ` Stephen Paul Weber
2023-01-17 16:01 ` Ludovic Courtès
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=87o7rf715e.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=0@psycoti.ca \
--cc=guix-devel@gnu.org \
--cc=singpolyma@singpolyma.net \
/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.