This is the complement of "chicken-status -list", as suggested by wasamasa for "-override". But since "-override" really does something else (provide versions, not a list of eggs to install), a separate option seems to be more appropriate. The list format now also allows versionless eggs (if not installed via henrietta, for example). In an override list, such an entry simply accepts any version.
felix
From 83d057d891ec4ff3c42ca05c58aa9118e468767b Mon Sep 17 00:00:00 2001 From: felix <[email protected]> Date: Wed, 18 Oct 2017 10:26:18 +0200 Subject: [PATCH] add "-from-list" option to chicken-install and allow entries with no version --- chicken-install.scm | 34 ++++++++++++++++++++++++++-------- chicken-status.scm | 3 ++- manual/Extensions | 3 ++- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/chicken-install.scm b/chicken-install.scm index c515fc3..aeea352 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -372,13 +372,17 @@ (let ((name (string->symbol (if (pair? egg) (car egg) egg)))) (cond ((assq name override) => (lambda (a) - (cond ((and (pair? egg) (not (equal? (cadr a) (cdr egg)))) - (warning - (sprintf - "version `~a' of extension `~a' overrides explicitly given version `~a'" - (cadr a) name (cdr egg)))) - (else (d "overriding: ~a~%" a))) - (cadr a))) + (if (and (pair? egg) + (pair? (cdr a)) + (not (equal? (cadr a) (cdr egg)))) + (warning + (sprintf + "version `~a' of extension `~a' overrides explicitly given version `~a'" + (cadr a) name (cdr egg))) + (d "overriding: ~a~%" a)) + (if (null? (cdr a)) + (and (pair? egg) (cdr egg)) + (cadr a)))) ((pair? egg) (cdr egg)) (else #f)))) @@ -727,7 +731,8 @@ (lambda (e) (cond ((assq (string->symbol (car e)) override) => (lambda (a) - (unless (equal? (cadr a) (cdr e)) + (when (and (pair? (cdr a)) + (not (equal? (cadr a) (cdr e)))) (warning (sprintf "version `~a' of extension `~a' overrides required version `~a'" (cadr a) (car a) (cdr e)))) @@ -1016,6 +1021,7 @@ usage: chicken-install [OPTION ...] [NAME[:VERSION] ...] -u -update-db update export database -repository print path used for egg installation -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 chicken-install recognizes the SUDO, http_proxy and proxy_auth environment variables, if set. @@ -1093,6 +1099,18 @@ EOF ((equal? arg "-purge") (set! purge-mode #t) (loop (cdr args))) + ((equal? arg "-from-list") + (unless (pair? (cdr args)) (usage 1)) + (set! eggs + (append eggs + (map (lambda (p) + (if (null? (cdr p)) + (->string (car p)) + (cons (->string (car p)) + (cadr p)))) + (with-input-from-file (cadr args) + read-all)))) + (loop (cddr args))) ((equal? arg "-override") (unless (pair? (cdr args)) (usage 1)) (set! override diff --git a/chicken-status.scm b/chicken-status.scm index d19f068..cc8be19 100644 --- a/chicken-status.scm +++ b/chicken-status.scm @@ -172,7 +172,8 @@ (for-each (lambda (egg) (let ((version (get-egg-property (read-info egg) 'version))) - (pp (list (string->symbol egg) (or version "???"))))) + (pp (cons (string->symbol egg) + (if version (list version) '()))))) (gather-eggs))) (define (usage code) diff --git a/manual/Extensions b/manual/Extensions index 9a397de..ba6536e 100644 --- a/manual/Extensions +++ b/manual/Extensions @@ -581,6 +581,7 @@ Available options: ; {{-u -update-db}} : update export database ; {{-repository}} : print path to egg repository ; {{-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 {{chicken-install}} recognizes the {{SUDO}}, {{http_proxy}} and {{proxy_auth}} environment variables, if set. @@ -604,7 +605,7 @@ Available options: ; {{-match}} : treat egg-names as glob patterns ; {{-host}} : when cross-compiling, show eggs for host system only ; {{-target}} : when cross-compiling, show eggs for target system only -; {{-list}} : list installed egg version in format suitable for {{chicken-install -override}} +; {{-list}} : list installed egg version in format suitable for {{chicken-install -override}} or {{-from-list}} ; {{-c -components}} : list installed components -- 1.7.9.5
_______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
