GNU bug report logs - #46776
[PATCH] inferior: Extend cached-channel-instance scope.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <othacehe <at> gnu.org>

Date: Thu, 25 Feb 2021 17:22:01 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46776 in the body.
You can then email your comments to 46776 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#46776; Package guix-patches. (Thu, 25 Feb 2021 17:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <othacehe <at> gnu.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 25 Feb 2021 17:22:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH] inferior: Extend cached-channel-instance scope.
Date: Thu, 25 Feb 2021 18:20:48 +0100
* guix/inferior.scm (cached-channel-instance): Turn channels argument into
channels-or-instances.  Adapt the rest of the procedure.
---
 guix/inferior.scm | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/guix/inferior.scm b/guix/inferior.scm
index 0990696e6c..06a187b879 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -709,20 +709,30 @@ prefix, resolve it; and if 'commit' is unset, fetch CHANNEL's branch tip."
           commit))))
 
 (define* (cached-channel-instance store
-                                  channels
+                                  channels-or-instances
                                   #:key
                                   (authenticate? #t)
                                   (cache-directory (%inferior-cache-directory))
                                   (ttl (* 3600 24 30)))
-  "Return a directory containing a guix filetree defined by CHANNELS, a list of channels.
-The directory is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds.
-This procedure opens a new connection to the build daemon.  AUTHENTICATE?
-determines whether CHANNELS are authenticated."
+  "Return a directory containing a guix filetree defined by
+CHANNELS-OR-INSTANCES, a list of channels or channel instances.  The directory
+is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL
+seconds.  This procedure opens a new connection to the build daemon.
+AUTHENTICATE?  determines whether CHANNELS are authenticated."
+  ;; Determine if we are dealing with channels or channel instances.
+  (define channels?
+    (match (pk channels-or-instances)
+      (((? channel? c) rest ...)
+       #t)
+      (else #f)))
+
   (define commits
     ;; Since computing the instances of CHANNELS is I/O-intensive, use a
     ;; cheaper way to get the commit list of CHANNELS.  This limits overhead
     ;; to the minimum in case of a cache hit.
-    (map channel-full-commit channels))
+    (if channels?
+      (map channel-full-commit channels-or-instances)
+      (map channel-instance-commit channels-or-instances)))
 
   (define key
     (bytevector->base32-string
@@ -756,9 +766,12 @@ determines whether CHANNELS are authenticated."
       cached
       (run-with-store store
         (mlet* %store-monad ((instances
-                              -> (latest-channel-instances store channels
-                                                           #:authenticate?
-                                                           authenticate?))
+                              -> (if channels?
+                                     (latest-channel-instances
+                                      store channels-or-instances
+                                      #:authenticate?
+                                      authenticate?)
+                                     channels-or-instances))
                              (profile
                               (channel-instances->derivation instances)))
           (mbegin %store-monad
-- 
2.30.1





Information forwarded to guix-patches <at> gnu.org:
bug#46776; Package guix-patches. (Mon, 01 Mar 2021 14:48:02 GMT) Full text and rfc822 format available.

Message #8 received at 46776 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 46776 <at> debbugs.gnu.org
Subject: Re: bug#46776: [PATCH] inferior: Extend cached-channel-instance scope.
Date: Mon, 01 Mar 2021 15:47:19 +0100
Hi,

Mathieu Othacehe <othacehe <at> gnu.org> skribis:

> * guix/inferior.scm (cached-channel-instance): Turn channels argument into
> channels-or-instances.  Adapt the rest of the procedure.

[...]

>  (define* (cached-channel-instance store
> -                                  channels
> +                                  channels-or-instances
>                                    #:key
>                                    (authenticate? #t)
>                                    (cache-directory (%inferior-cache-directory))
>                                    (ttl (* 3600 24 30)))
> -  "Return a directory containing a guix filetree defined by CHANNELS, a list of channels.
> -The directory is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds.
> -This procedure opens a new connection to the build daemon.  AUTHENTICATE?
> -determines whether CHANNELS are authenticated."
> +  "Return a directory containing a guix filetree defined by
> +CHANNELS-OR-INSTANCES, a list of channels or channel instances.  The directory
> +is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL
> +seconds.  This procedure opens a new connection to the build daemon.
> +AUTHENTICATE?  determines whether CHANNELS are authenticated."
> +  ;; Determine if we are dealing with channels or channel instances.
> +  (define channels?
> +    (match (pk channels-or-instances)
> +      (((? channel? c) rest ...)
> +       #t)
> +      (else #f)))
> +
>    (define commits
>      ;; Since computing the instances of CHANNELS is I/O-intensive, use a
>      ;; cheaper way to get the commit list of CHANNELS.  This limits overhead
>      ;; to the minimum in case of a cache hit.
> -    (map channel-full-commit channels))
> +    (if channels?
> +      (map channel-full-commit channels-or-instances)
> +      (map channel-instance-commit channels-or-instances)))

This would only accept homogeneous lists, which is kinda weird.

Could we instead have a separate procedure taking channel instances, and
arrange to factorize common code in a third procedure?

Thanks,
Ludo’.




Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Fri, 26 Mar 2021 09:55:02 GMT) Full text and rfc822 format available.

Notification sent to Mathieu Othacehe <othacehe <at> gnu.org>:
bug acknowledged by developer. (Fri, 26 Mar 2021 09:55:02 GMT) Full text and rfc822 format available.

Message #13 received at 46776-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 46776-done <at> debbugs.gnu.org
Subject: Re: bug#46776: [PATCH] inferior: Extend cached-channel-instance scope.
Date: Fri, 26 Mar 2021 10:54:35 +0100
Hello,

> This would only accept homogeneous lists, which is kinda weird.
>
> Could we instead have a separate procedure taking channel instances, and
> arrange to factorize common code in a third procedure?

I managed to rewrite Cuirass evaluation without modifying the inferior
API. Closing this one.

Thanks for having a look,

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Apr 2021 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.