summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--henrietta-cache.scm29
1 files changed, 17 insertions, 12 deletions
diff --git a/henrietta-cache.scm b/henrietta-cache.scm
index e8beb01..1e04b92 100644
--- a/henrietta-cache.scm
+++ b/henrietta-cache.scm
@@ -49,18 +49,22 @@ EOF
(uri-template (cadr uri-info)))
(for-each
(lambda (egg-release)
- (let* ((patterns `((egg-name . ,egg-name)
- (egg-release . ,egg-release)
- (chicken-release . ,*chicken-release*)))
- (uri (replace-uri-patterns uri-template patterns)))
- (printf "Downloading egg ~A, release ~A from ~A...\n"
- egg-name egg-release uri)
- ;; Here we should dispatch on type to determine what to do!
- (call-with-input-request
- uri #f (lambda (i)
- (call-with-output-file
- (make-pathname egg-cache-dir egg-release)
- (lambda (o) (copy-port i o)))))))
+ (let ((cached-file (make-pathname egg-cache-dir
+ egg-release
+ (->string type))))
+ (unless (file-exists? cached-file)
+ (let* ((patterns `((egg-name . ,egg-name)
+ (egg-release . ,egg-release)
+ (chicken-release . ,*chicken-release*)))
+ (uri (replace-uri-patterns uri-template patterns)))
+ (printf "\tDownloading release ~A from ~A\n"
+ egg-release uri)
+ ;; Here we should dispatch on type to determine what to do!
+ (call-with-input-request
+ uri #f (lambda (i)
+ (call-with-output-file
+ cached-file
+ (lambda (o) (copy-port i o)))))))))
(cdr uri/releases))))
uris/releases)))
@@ -75,6 +79,7 @@ EOF
(patterns `((egg-name . ,egg-name)
(chicken-release . ,*chicken-release*)))
(uri (replace-uri-patterns egg-uri-template patterns)))
+ (printf "Caching egg '~A'\n" egg-name)
(let collect-releases ((info (with-input-from-request uri #f read-file))
(uris/releases '())
(uris '()))