Subject: [bug#48971] [PATCH 0/2] Add SWH support for Hg repositories

From: Xinglu Chen <[email-masked]>
Date: Tue, 15 Jun 2021 07:37:27 +0200

On Mon, Jun 14 2021, Ludovic Courtès wrote:

> Hello,
>
> Xinglu Chen <[email-masked]> skribis:
>
>> Xinglu Chen (2):
>>   swh: Support lookup of Hg tags.
>>   hg-download: Support falling back to SWH.
>
> Pushed as 69d7333217ce85d9d1643a8349757b6b170d3b1f!
>
> Note that currently this only works for (1) repositories that are
> archived, and (2) origins that refer to hg tags, not commit IDs.
>
> I found an example that meets these criteria: python-openpyxl.  :-)
> I commented out the other fallbacks in (guix hg-download) and ran:
>
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix build python-openpyxl -S --no-substitutes 
> The following derivation will be built:
>    /gnu/store/71xjlgdqw50a76ycqrmjrqh7b4mdi5s7-python-openpyxl-3.0.5-checkout.drv
> building /gnu/store/71xjlgdqw50a76ycqrmjrqh7b4mdi5s7-python-openpyxl-3.0.5-checkout.drv...
> guile: warning: failed to install locale
> environment variable `PATH' set to `/gnu/store/378zjf2kgajcfd7mfr98jn5xyc5wa3qv-gzip-1.10/bin:/gnu/store/sf3rbvb6iqcphgm1afbplcs72hsywg25-tar-1.32/bin'
> Trying to download from Software Heritage...
> SWH: found revision 4d4e19e58314de481b98f4c239c3b3e9fd080613 with directory at 'https://archive.softwareheritage.org/api/1/directory/fb5bbba156e6b8e2bb94ea1dd5807ef2c8931864/'
> SWH vault: requested bundle cooking, waiting for completion...
> SWH vault: requested bundle cooking, waiting for completion...
> SWH vault: requested bundle cooking, waiting for completion...
> SWH vault: requested bundle cooking, waiting for completion...
> SWH vault: requested bundle cooking, waiting for completion...
> SWH vault: requested bundle cooking, waiting for completion...
> SWH vault: requested bundle cooking, waiting for completion...
> --8<---------------cut here---------------end--------------->8---
>
> It’s still waiting for the bundle…

Hmm, I tried it on a package in local config and it seemed to work fine
with commit IDs, I guess this was because I ran ‘guix hash -r’ on the
extracted tarball I downloaded from SWH, so the source was already in
the store when I tried to build it...

> Regarding #2, there are some good news:
> <https://forge.softwareheritage.org/T2849> is about implementing a
> mapping from “VCS IDs” (hg commit IDs in this case) to SWHIDs.  Thus,
> eventually, ‘lookup-origin-revision’ should be able to take an hg commit
> ID and to map it to an SWHID.  That JSON API isn’t exposed yet.

Oh, that’s great!