Hi, as I've promised a patch to chicken-install to enable egg authors to hint foreign dependencies to chicken-install in the .meta file I am delivering the patch for it here. Please find it attached to this mail.
If you want to accept this patch apply it to your git repo with git apply 0001-Add-show-foreign-depends-option-to-chicken-install.patch For this to work egg authors need to add a (foreign-depends ) clause to the egg's .meta files. The clause is free form and will get printed with each element on one line. The new option '-show-foreign-depends' fetches and displays the foreign-depends clause from meta files. When invoked in combination with -r only the retrieved egg's clause will be displayed. I will disect the patch now for the interested reader, not so much for showing off smug lisp skills (far from it) but to seek advice. I am willing to reiterate this process until we do have a satisfactory result. Also to revive this list for patch reviews. The patch: --- chicken-install.scm | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-) diff --git a/chicken-install.scm b/chicken-install.scm index a4d175e..e635705 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -107,6 +107,7 @@ (define *keep-going* #f) (define *override* '()) (define *reinstall* #f) + (define *show-foreign-depends* #f) Trivial flag whether we have seen the option on the command line. (define (repo-path) (if (and *cross-chicken* (not *host-extension*)) @@ -391,6 +392,22 @@ ((pair? egg) (cdr egg)) (else #f)))) + (define (show-foreign-depends eggs) + (print "fetching meta information...") + (retrieve eggs) + (print "Foreign dependencies as reported in .meta:") + (for-each + (lambda (egg) + (and-let* ((meta-file (make-pathname (cadr egg) (car egg) "meta")) + (m (and (file-exists? meta-file) (with-input-from-file meta-file read))) + (ds (deps 'foreign-depends m))) + (unless (null? ds) + (print (car egg) ": ") + (for-each (cut print "\t" <>) (deps 'foreign-depends m))))) + *eggs+dirs+vers*) + (cleanup) + (exit 0)) + This uses the retreive procedure for getting the meta data and resolving dependencies for us. The result is stored in the global *eggs+dirs+vers* variable which we iterate through and check for the foreign-depends clause. If found print it. Afterwards call cleanup to delete the temporary directories and exit. (define (retrieve eggs) (print "retrieving ...") (for-each @@ -816,11 +834,15 @@ EOF (unless *default-location* (error "no default location defined - please use `-location' option"))) - (if listeggs - (display - (list-available-extensions - *default-transport* *default-location*)) - (install (apply-mappings (reverse eggs)))))))) + (cond (listeggs + (display + (list-available-extensions + *default-transport* *default-location*))) + (*show-foreign-depends* + (show-foreign-depends eggs)) + (else + (install (apply-mappings (reverse eggs))))) + )))) This is code is reached when all args are parsed and we now have a list of eggs to process. Inserted show-foreign-depends as a third code branch hence reworded as a cond statement. (else (let ((arg (car args))) (cond ((or (string=? arg "-help") @@ -937,6 +959,9 @@ EOF (unless (pair? (cdr args)) (usage 1)) (set! *password* (cadr args)) (loop (cddr args) eggs)) + ((string=? "-show-foreign-depends" arg) + (set! *show-foreign-depends* #t) + (loop (cdr args) eggs)) ((and (positive? (string-length arg)) (char=? #\- (string-ref arg 0))) (if (> (string-length arg) 2) -- 1.7.3.5 Just checks the presence of the command line option and sets the flag. Because of this giving also -r on the command line will stop at retreiving only the listed egg, thus our EDV list will only contain those eggs. The reuse of retrieve will also generate quite noisy output. Would it be worthwhile to refactor chicken-install to quiet it down? That's all for now! Suggestions, criticism and your thoughts are welcome. Kind regards, Christian -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse.
>From 452567659991a57f58b9a8aac4e748b1ebf477f3 Mon Sep 17 00:00:00 2001 From: Christian Kellermann <ck...@pestilenz.org> Date: Sat, 3 Sep 2011 22:56:29 +0200 Subject: [PATCH] Add -show-foreign-depends option to chicken-install This new option fetches and displays the foreign-depends clause from meta files. When invoked in combination with -r only the retrieved egg's clause will be displayed. --- chicken-install.scm | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-) diff --git a/chicken-install.scm b/chicken-install.scm index a4d175e..e635705 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -107,6 +107,7 @@ (define *keep-going* #f) (define *override* '()) (define *reinstall* #f) + (define *show-foreign-depends* #f) (define (repo-path) (if (and *cross-chicken* (not *host-extension*)) @@ -391,6 +392,22 @@ ((pair? egg) (cdr egg)) (else #f)))) + (define (show-foreign-depends eggs) + (print "fetching meta information...") + (retrieve eggs) + (print "Foreign dependencies as reported in .meta:") + (for-each + (lambda (egg) + (and-let* ((meta-file (make-pathname (cadr egg) (car egg) "meta")) + (m (and (file-exists? meta-file) (with-input-from-file meta-file read))) + (ds (deps 'foreign-depends m))) + (unless (null? ds) + (print (car egg) ": ") + (for-each (cut print "\t" <>) (deps 'foreign-depends m))))) + *eggs+dirs+vers*) + (cleanup) + (exit 0)) + (define (retrieve eggs) (print "retrieving ...") (for-each @@ -747,6 +764,7 @@ usage: chicken-install [OPTION | EXTENSION[:VERSION]] ... -scan DIRECTORY scan local directory for highest available egg versions -override FILENAME override versions for installed eggs with information from file -csi FILENAME use given pathname for invocations of "csi" + -show-foreign-depends display a list of foreign dependencies for the given egg(s) EOF );| (exit code)) @@ -816,11 +834,15 @@ EOF (unless *default-location* (error "no default location defined - please use `-location' option"))) - (if listeggs - (display - (list-available-extensions - *default-transport* *default-location*)) - (install (apply-mappings (reverse eggs)))))))) + (cond (listeggs + (display + (list-available-extensions + *default-transport* *default-location*))) + (*show-foreign-depends* + (show-foreign-depends eggs)) + (else + (install (apply-mappings (reverse eggs))))) + )))) (else (let ((arg (car args))) (cond ((or (string=? arg "-help") @@ -937,6 +959,9 @@ EOF (unless (pair? (cdr args)) (usage 1)) (set! *password* (cadr args)) (loop (cddr args) eggs)) + ((string=? "-show-foreign-depends" arg) + (set! *show-foreign-depends* #t) + (loop (cdr args) eggs)) ((and (positive? (string-length arg)) (char=? #\- (string-ref arg 0))) (if (> (string-length arg) 2) -- 1.7.3.5
_______________________________________________ Chicken-hackers mailing list Chicken-hackers@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-hackers