guix-commits
[Top][All Lists]
Advanced

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

branch master updated: scripts: discover: Check for cache file existence


From: guix-commits
Subject: branch master updated: scripts: discover: Check for cache file existence.
Date: Sat, 05 Dec 2020 04:43:59 -0500

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new c952a93  scripts: discover: Check for cache file existence.
c952a93 is described below

commit c952a9312a94bb236495ec654bf184685cf9fe79
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Sat Dec 5 10:37:01 2020 +0100

    scripts: discover: Check for cache file existence.
    
    Fixes: https://issues.guix.gnu.org/45045.
    
    * guix/scripts/discover.scm (read-substitute-urls): Check for file 
existence.
---
 guix/scripts/discover.scm | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/guix/scripts/discover.scm b/guix/scripts/discover.scm
index b17dbdc..007db0d 100644
--- a/guix/scripts/discover.scm
+++ b/guix/scripts/discover.scm
@@ -110,14 +110,16 @@ lock on FILE to synchronize with any potential readers."
 (define* (read-substitute-urls #:key (file (%publish-file)))
   "Read substitute urls list from FILE and return it.  Use a read lock on FILE
 to synchronize with the writer."
-  (with-read-file-lock file
-                       (call-with-input-file file
-                         (lambda (port)
-                           (let loop ((url (read-line port))
-                                      (urls '()))
-                             (if (eof-object? url)
-                                 urls
-                                 (loop (read-line port) (cons url urls))))))))
+  (if (file-exists? file)
+      (with-read-file-lock file
+        (call-with-input-file file
+          (lambda (port)
+            (let loop ((url (read-line port))
+                       (urls '()))
+              (if (eof-object? url)
+                  urls
+                  (loop (read-line port) (cons url urls)))))))
+      '()))
 
 
 ;;;
@@ -156,3 +158,7 @@ to synchronize with the writer."
         (mkdir-p (dirname publish-file))
         (avahi-browse-service-thread service-proc
                                      #:types %services)))))
+
+;;; Local Variables:
+;;; eval: (put 'with-read-file-lock 'scheme-indent-function 1)
+;;; End:



reply via email to

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