~ chicken-core (chicken-5) d33b1f4634f9d316d729917d1077d3a3802f4fe7
commit d33b1f4634f9d316d729917d1077d3a3802f4fe7
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Mar 15 12:52:54 2018 +0100
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Sun Mar 18 17:29:16 2018 +0100
chicken-install: -cached installs from cache only
Signed-off-by: Peter Bex <peter@more-magic.net>
diff --git a/chicken-install.scm b/chicken-install.scm
index a4c9e810..f679d1f8 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -92,6 +92,7 @@
(define keepfiles #f)
(define print-repository #f)
(define no-deps #f)
+(define cached-only #f)
(define platform
(if (eq? 'mingw32 (build-platform))
@@ -399,23 +400,35 @@
(cond ((or (not (probe-dir cached))
(not (file-exists? eggfile)))
(d "~a not cached~%" name)
+ (when cached-only (error "extension not cached"))
(fetch #f))
((and (file-exists? status)
(not (equal? current-status
(with-input-from-file status read))))
(d "status changed for ~a~%" name)
- (fetch #f)))
+ (cond (cached-only
+ (if force-install
+ (warning "cached egg does not match CHICKEN version" name)
+ (error "cached egg does not match CHICKEN version - use `-force' to install anyway" name)))
+ (else (fetch #f)))))
(let* ((info (validate-egg-info (load-egg-info eggfile)))
(vfile (make-pathname cached +version-file+))
(lversion (or (get-egg-property info 'version)
(and (file-exists? vfile)
(with-input-from-file vfile read)))))
- (cond ((if (file-exists? timestamp)
- (and (> (- now (with-input-from-file timestamp read)) +one-hour+)
- (not (check-remote-version name version lversion
- cached)))
- (not (check-remote-version name version lversion
- cached)))
+ (cond ((and (not cached-only)
+ (if (file-exists? timestamp)
+ (and (> (- now (with-input-from-file
+ timestamp read))
+ +one-hour+)
+ (not (check-remote-version name
+ version
+ lversion
+ cached)))
+ (not (check-remote-version name
+ version
+ lversion
+ cached))))
(d "version of ~a out of date~%" name)
(fetch #t)
(let* ((info (validate-egg-info (load-egg-info eggfile))) ; new egg info (fetched)
@@ -965,6 +978,8 @@
(purge-mode (purge-cache eggs))
(print-repository (print (install-path)))
((null? eggs)
+ (when cached-only
+ (error "`-cached' needs explicit egg list"))
(if list-versions-only
(print "no eggs specified")
(let ((files (glob "*.egg" "chicken/*.egg")))
@@ -979,7 +994,6 @@
(else
(let ((eggs (apply-mappings eggs)))
(cond (list-versions-only (list-egg-versions eggs))
- ;;XXX other actions...
(else
(when run-tests
(set! tested-eggs (map (o car canonical) eggs)))
@@ -1012,6 +1026,7 @@ usage: chicken-install [OPTION ...] [NAME[:VERSION] ...]
-override FILENAME override versions for installed eggs with information from file
-from-list FILENAME install eggs from list obtained by `chicken-status -list'
-v -verbose be verbose
+ -cached only install from cache
chicken-install recognizes the SUDO, http_proxy and proxy_auth environment variables, if set.
@@ -1088,6 +1103,9 @@ EOF
((equal? arg "-purge")
(set! purge-mode #t)
(loop (cdr args)))
+ ((equal? arg "-cached")
+ (set! cached-only #t)
+ (loop (cdr args)))
((equal? arg "-from-list")
(unless (pair? (cdr args)) (usage 1))
(set! eggs
diff --git a/manual/Extensions b/manual/Extensions
index d70931b8..0b508b77 100644
--- a/manual/Extensions
+++ b/manual/Extensions
@@ -598,6 +598,7 @@ Available options:
; {{-override FILENAME}} : override versions for installed eggs with information given in {{FILENAME}}, which can be generated by {{-scan}} or by the {{-list}} option of the {{chicken-status}} program
: {{-from-list FILENAME}} : install eggs given in {{FILENAME}}, in the same format as produced by the {{-list}} option in {{chicken-status}}; this option may be given multiple times
; {{-v -verbose}} : be verbose
+; {{-cached}} : only install from cache, do not access local or remote repositories. Use {{-force}} in addition to this option if the cached egg(s) are from older CHICKEN installations.
{{chicken-install}} recognizes the {{SUDO}}, {{http_proxy}} and {{proxy_auth}} environment variables, if set.
Trap