Subject: bug#72174: guix download does not support Mercurial

From: Simon Tournier <[email-masked]>
Date: Mon, 22 Jul 2024 17:51:12 +0200

Hi,

On Mon, 22 Jul 2024 at 09:11, Ludovic Courtès <[email-masked]> wrote:

>> I studied `guix download -h` which shows that `guix download` only
>> supports Git repositories. Since there is `hg-download`, it would
>> make sense that the command `guix download` support Mercurial. 
>
> Indeed, only Git is supported at this point.  Supporting Mercurial and
> other VCSes would be nice though there’s no plan to do so at this point
> (Git support was a low-hanging fruit since Git is already tightly
> integrated).

Somehow, “guix download” does not rely on the module ’(guix
git-download)’ that provides ’git-fetch’ but it relies on the module
’(guix git)’.  Therefore, “hg-download” is not helpful here and somehow
a brick seems lacking. :-)

Maybe I misread, my understanding in short is that “git-download” or
“hg-download” works with fixed-output derivations, hence the hash must
be known beforehand; source code is fetched via a derivation that the
guix-daemon processes.

Instead, “guix download” fetches using code from user side and not from
guix-daemon side and the source is fetched inside some user’s cache that
is then copied to the store.  This way there is no hash check.

The code behind “guix download” supporting Git is implemented with
guile-libgit2 – tightly integrated ;-); see latest-repository-commit
calling update-cached-checkout from (guix git).  It would be possible to
implement the equivalent for Mercurial or redesign “guix download”; in
both cases, todo. :-)

HTH

Cheers,
simon