From 7c8c0ab1c48699b94327ba30e7ef450eb1a44f29 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Wed, 5 Sep 2018 18:05:22 +0200 Subject: Improve egg/meta-file handling by only allowing "distribution-files" in egg-files and "files" in meta-files There's some minor code duplication but it's worth the loss of confusion and potential for error. --- henrietta-cache.scm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/henrietta-cache.scm b/henrietta-cache.scm index 832dcc3..fae2499 100644 --- a/henrietta-cache.scm +++ b/henrietta-cache.scm @@ -174,19 +174,27 @@ EOF ((zip) (sprintf "unzip -d ~A -o -qq ~A" (qs dir) (qs archive))) (else (error (sprintf "Unknown archive type `~S' (shouldn't happen!)" distribution-file-type))))))) - ((meta-file egg-file) + ;; CHICKEN 5 egg description format: .egg + ((egg-file) (condition-case (let* ((meta (car (call-with-input-request uri #f read-file))) - (files (or (alist-ref 'files meta) - ;; Egg description files for C5 use - ;; `distribution-files' to specify files to - ;; cache. - (alist-ref 'distribution-files meta)))) + (files (alist-ref 'distribution-files meta))) (unless files - (error "No \"files\" entry found in meta or egg file" uri)) + (error "No \"distribution-files\" entry found in egg file" uri)) (download-files-from-list (uri-reference uri) files cache-dir)) (e (exn http) - (error (sprintf "Could not download meta or egg file \"~A\" -- ~A\n" + (error (sprintf "Could not download meta file \"~A\" -- ~A\n" + uri (get-condition-property e 'exn 'message)))))) + ;; CHICKEN 4 egg meta information format: .meta + ((meta-file) + (condition-case + (let* ((meta (car (call-with-input-request uri #f read-file))) + (files (alist-ref 'files meta))) + (unless files + (error "No \"files\" entry found in meta file" uri)) + (download-files-from-list (uri-reference uri) files cache-dir)) + (e (exn http) + (error (sprintf "Could not download meta file \"~A\" -- ~A\n" uri (get-condition-property e 'exn 'message)))))) ((files-list) (condition-case -- cgit v1.2.3