Subject: [bug#51307] Content hashes and file tree serialization methods

From: zimoun <[email-masked]>
Date: Thu, 18 Nov 2021 01:29:27 +0100

Hi Ludo,

On Sun, 31 Oct 2021 at 15:48, Ludovic Courtès <[email-masked]> wrote:

> Thinking more about it, I think confusion stems from the term
> “recursive” (inherited from Nix) because, as you write, it doesn’t
> necessarily have to do with recursion and directory traversal.
>
> Instead, it has to do with the serialization method.
>
> Thus, probably, ‘--recursive’ could be replaced by a ‘-S’ flag:
>
>   guix hash -S nar something
>
> or:
>
>   guix hash -S none something
>   guix hash -S git something
>   guix hash -S swh something
>
> ‘-S none’ would be like not passing ‘-r’; ‘-S git’ would serialize the
> file/directory as a Git tree; ‘-S swh’ would serialize it the SWH way,
> which is like Git except it preserves empty directories (Disarchive
> implements the Git/SWH methods already.)

Well, v2 is an attempt for this UI.  It does not solve my initial
problem but it is a first step in that direction. ;-)

Note that SWH serializer is not added.  Because I have probably missed
to reach the implementation. :-)

Well, next step could be to add an option “--list-serializers“.  Let
as an exercise for the reader. ;-)

> As mentioned towards the end of
> <https://guix.gnu.org/en/blog/2019/connecting-reproducible-deployment-to-a-long-term-source-code-archive/>,
> being able to deal with different tree serialization methods would be
> useful going forward; for instance, if we had the option to store
> SWH-style content hashes for origins, that’d help a lot.  Allowing ‘guix
> hash’ to deal with that is a first step in that direction.

Well, this series does not add SWH-style but it is a tiny step in that
direction.  Somehow, after v2-patch#2, it is easy to add as many
serializers as we want. :-)

> (Apologies for slipping a bit off-topic…)

Thanks for slipping off-topic. :-)

Cheers,
simon

*serializer: it is not an English word but I lacked imagination.