Subject: [bug#73833] [PATCH v2 1/5] guix: import: utils: Add function git->origin.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 29 Nov 2024 14:05:52 +0100

Hi,

Nicolas Graves <[email-masked]> skribis:

> On 2024-11-06 16:16, Ludovic Courtès wrote:

[...]

>>> -  ;; Use a custom cache to avoid cluttering the default one under
>>> -  ;; ~/.cache/guix, but choose one under /tmp so that it's persistent across
>>> -  ;; subsequent "guix import" invocations.
>>> -  (mkdir-p cache)
>>> -  (chmod cache #o700)
>>> -  (let-values (((checkout commit _)
>>> -                (parameterize ((%repository-cache-directory cache))
>>> -                  (update-cached-checkout url
>>
>> Looks like this bit and its rationale in (guix import go) gets lost
>> here: ‘git->origin’ unconditionally uses ~/.cache, which means that
>> ‘guix import go -r …’ would fill that directory.
>>
>> Could we restore that behavior, probably as an option to
>> ‘git->origin’?
>
> Yes, we can.  However, IIRC my rationale was that the alternative used in
> every other import module was to use the store (and not ~/.cache IIRC,
> since it uses latest-repository-commit instead of
> update-cached-checkout) as a cache.  Since we often import/update to
> build after that, it seemed quite natural to let the store handle the
> cache instead of managing a custom cache for that.
>
> So yes, we loose a bit of functionality, but I think it's more
> maintainable this way, if the original author doesn't disagree too much
> on that.  WDYT?

‘latest-repository-commit’ calls ‘update-cached-checkout’ to first get a
copy of the repo under ~/.cache, and then import it into the store.

So I think the functionality remains relevant.

I’ve just used “guix import go -r code.forgejo.org/forgejo” and it ran
out of disk space after filling /tmp with repos (!).  The fact that it’s
in /tmp means I can easily remove it; otherwise I’d have to wipe all of
~/.cache/guix/checkouts, but that’d be inconvenient (my next
pull/time-machine would have to re-clone the Guix repo, for instance).

Ludo’.