guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#50960] [PATCH 10/10] shell: Maintain a profile cache.


From: Ludovic Courtès
Subject: [bug#50960] [PATCH 10/10] shell: Maintain a profile cache.
Date: Sat, 02 Oct 2021 16:14:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Maxime Devos <maximedevos@telenet.be> skribis:

> Ludovic Courtès schreef op za 02-10-2021 om 12:22 [+0200]:
>> +(define (profile-cache-key file)
>> +  "Return the cache key for the profile corresponding to FILE, a 'guix.scm' 
>> or
>> +'manifest.scm' file, or #f if we lack channel information."
>> +  (match (current-channels)
>> +    (() #f)
>> +    (((= channel-commit commits) ...)
>> +     (let ((stat (stat file)))
>> +       (bytevector->base32-string
>> +        (sha256 (string->utf8
>> +                 (string-append (string-join commits) ":"
>> +                                (basename file) ":"
>> +                                (number->string (stat:dev stat)) ":"
>> +                                (number->string (stat:ino stat))))))))))
>
> Why only use the 'basename' of a file name instead of the full name?
> (Consider the case where a user has multiple "guix.scm" or "manifest.scm".)
> This turns out to be unproblematic, because stat:dev and stat:ino is included
> as well, though including (a part of) the file name is superfluous because
> stat:dev and stat:ino are included.
>
> Could you document the rationale for including the file name, and why only
> the basename is included instead of the full file name?

Actually it’s probably not useful to include the file (base)name.  I
think initially I thought about distinguishing between guix.scm and
manifest.scm, since they return different kinds of objects, but dev/ino
is probably enough.  WDYT?

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]