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.
This commit is contained in:
parent
4cf3734c56
commit
c952a9312a
1 changed files with 14 additions and 8 deletions
|
|
@ -110,6 +110,7 @@ lock on FILE to synchronize with any potential readers."
|
||||||
(define* (read-substitute-urls #:key (file (%publish-file)))
|
(define* (read-substitute-urls #:key (file (%publish-file)))
|
||||||
"Read substitute urls list from FILE and return it. Use a read lock on FILE
|
"Read substitute urls list from FILE and return it. Use a read lock on FILE
|
||||||
to synchronize with the writer."
|
to synchronize with the writer."
|
||||||
|
(if (file-exists? file)
|
||||||
(with-read-file-lock file
|
(with-read-file-lock file
|
||||||
(call-with-input-file file
|
(call-with-input-file file
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
|
|
@ -117,7 +118,8 @@ to synchronize with the writer."
|
||||||
(urls '()))
|
(urls '()))
|
||||||
(if (eof-object? url)
|
(if (eof-object? url)
|
||||||
urls
|
urls
|
||||||
(loop (read-line port) (cons url urls))))))))
|
(loop (read-line port) (cons url urls)))))))
|
||||||
|
'()))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
@ -156,3 +158,7 @@ to synchronize with the writer."
|
||||||
(mkdir-p (dirname publish-file))
|
(mkdir-p (dirname publish-file))
|
||||||
(avahi-browse-service-thread service-proc
|
(avahi-browse-service-thread service-proc
|
||||||
#:types %services)))))
|
#:types %services)))))
|
||||||
|
|
||||||
|
;;; Local Variables:
|
||||||
|
;;; eval: (put 'with-read-file-lock 'scheme-indent-function 1)
|
||||||
|
;;; End:
|
||||||
|
|
|
||||||
Reference in a new issue