diff --git a/lisp/install-abcl-bin.lisp b/lisp/install-abcl-bin.lisp index a31b5db..ad0dbf3 100644 --- a/lisp/install-abcl-bin.lisp +++ b/lisp/install-abcl-bin.lisp @@ -24,31 +24,14 @@ (cons t argv)) (defun abcl-bin-download (argv) - (loop for repeat = nil - do (set-opt "as" (version argv)) - (set-opt "download.uri" (format nil "~@{~A~}" (abcl-bin-uri) - (version argv) "/abcl-bin-" (version argv)".tar.gz")) - (set-opt "download.archive" - (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) - (when pos - (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) - (handler-case - (if (or (not (probe-file (get-opt "download.archive"))) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive:~A~%" (get-opt "download.uri")) - ;;TBD proxy support... and other params progress bar? - (download (get-opt "download.uri") (get-opt "download.archive"))) - (format t "~&Skip downloading ~A~%specify download.force=t to download it again.~%" - (get-opt "download.uri"))) - (uiop/run-program:subprocess-error () - (format t "Failure~%") - (setf repeat t))) - while (and repeat - (incf (getf argv :version-not-specified)) - (> (length (funcall *version-func*)) - (getf argv :version-not-specified)))) - (cons (not (get-opt "without-install")) argv)) + (set-opt "as" (version argv)) + (set-opt "download.uri" (format nil "~@{~A~}" (abcl-bin-uri) + (version argv) "/abcl-bin-" (version argv)".tar.gz")) + (set-opt "download.archive" + (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) + (when pos + (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) + `((,(get-opt "download.archive") ,(get-opt "download.uri")))) (defun abcl-bin-expand (argv) (format t "~%Extracting archive:~A~%" (get-opt "download.archive")) @@ -90,7 +73,7 @@ (push `("abcl-bin" . (,(decide-version 'abcl-bin-get-version) abcl-bin-argv-parse - abcl-bin-download + ,(decide-download 'abcl-bin-download) abcl-bin-expand abcl-bin-script setup)) diff --git a/lisp/install-allegro.lisp b/lisp/install-allegro.lisp index d9c832e..e72702e 100644 --- a/lisp/install-allegro.lisp +++ b/lisp/install-allegro.lisp @@ -21,27 +21,20 @@ (defun allegro-argv-parse (argv) (format *error-output* "~&Installing allegro/~A...~%" (getf argv :version)) - (set-opt "as" (getf argv :version)) (cons t argv)) (defun allegro-download (argv) (let ((uname (allegro-uname)) (uname-m (allegro-uname-m))) + (set-opt "as" (getf argv :version)) (set-opt "download.uri" (format nil "~@{~A~}" (allegro-uri) "/acl" (getf argv :version) "/" uname uname-m "/acl" (getf argv :version) "-" uname "x-" uname-m (cond ((equal uname "macos") ".dmg") ((equal uname "linu") ".bz2")))) (set-opt "download.archive" (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) (when pos - (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir)))))) - (if (or (not (probe-file (get-opt "download.archive"))) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive:~A~%" (get-opt "download.uri")) - (download (get-opt "download.uri") (get-opt "download.archive"))) - (format t "~&Skip downloading ~A~%specify download.force=t to download it again.~%" - (get-opt "download.uri"))) - (cons t argv)) + (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) + `((,(get-opt "download.archive") ,(get-opt "download.uri"))))) (defun allegro-expand (argv) (format t "~%Extracting archive:~A~%" (get-opt "download.archive")) @@ -86,10 +79,10 @@ (cons t argv)) (push `("allegro" . (,(decide-version 'allegro-get-version) - allegro-argv-parse - allegro-download - allegro-expand - setup)) + allegro-argv-parse + ,(decide-download 'allegro-download) + allegro-expand + setup)) *install-cmds*) (push `("allegro" . ,(list 'allegro-help)) *help-cmds*) diff --git a/lisp/install-ccl-bin.lisp b/lisp/install-ccl-bin.lisp index d8d8fc6..6cb6e8f 100644 --- a/lisp/install-ccl-bin.lisp +++ b/lisp/install-ccl-bin.lisp @@ -36,16 +36,8 @@ ".zip"".tar.gz"))) (set-opt "download.archive" (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) (when pos - (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir)))))) - (if (or (not (probe-file (get-opt "download.archive"))) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive:~A~%" (get-opt "download.uri")) - ;;TBD proxy support... and other params progress bar? - (download (get-opt "download.uri") (get-opt "download.archive"))) - (format t "~&Skip downloading ~A~%specify download.force=t to download it again.~%" - (get-opt "download.uri"))) - (cons (not (get-opt "without-install")) argv)) + (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) + `((,(get-opt "download.archive") ,(get-opt "download.uri"))))) (defun ccl-bin-expand (argv) (format t "~%Extracting archive:~A~%" (get-opt "download.archive")) @@ -78,7 +70,7 @@ (push `("ccl-bin" . (,(decide-version 'ccl-bin-get-version) ccl-bin-argv-parse - ccl-bin-download + ,(decide-download 'ccl-bin-download) ccl-bin-expand setup)) *install-cmds*) diff --git a/lisp/install-clisp.lisp b/lisp/install-clisp.lisp index 89cf6af..1e05cd2 100644 --- a/lisp/install-clisp.lisp +++ b/lisp/install-clisp.lisp @@ -31,14 +31,7 @@ (set-opt "download.archive" (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) (when pos (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) - (if (or (not (probe-file (get-opt "download.archive"))) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive: ~A~%" (get-opt "download.uri")) - (download (get-opt "download.uri") (get-opt "download.archive"))) - (format t "~&Skip downloading ~A.~%Specify 'download.force=t' to download it again.~%" - (get-opt "download.uri"))) - (cons t argv)) + `((,(get-opt "download.archive") ,(get-opt "download.uri")))) (defun clisp-lib (argv) (when (and (find :linux *features*) @@ -131,7 +124,7 @@ (push `("clisp" . (,(decide-version 'clisp-get-version) clisp-argv-parse start - clisp-download + ,(decide-download 'clisp-download) clisp-lib clisp-expand clisp-patch diff --git a/lisp/install-cmu-bin.lisp b/lisp/install-cmu-bin.lisp index 4a0bbd2..754e436 100644 --- a/lisp/install-cmu-bin.lisp +++ b/lisp/install-cmu-bin.lisp @@ -43,17 +43,8 @@ (set-opt "download.extra.archive" (let ((pos (position #\/ (get-opt "download.extra.uri") :from-end t))) (when pos (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.extra.uri") (1+ pos))) (homedir))))) - (loop for archive in (list (get-opt "download.archive") (get-opt "download.extra.archive")) - for uri in (list (get-opt "download.uri") (get-opt "download.extra.uri")) - do (if (or (not (probe-file archive)) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive:~A~%" uri) - ;;TBD proxy support... and other params progress bar? - (download uri archive)) - (format t "~&Skip downloading ~A~%specify download.force=t to download it again.~%" - uri))) - (cons (not (get-opt "without-install")) argv)) + `((,(get-opt "download.archive") ,(get-opt "download.uri")) + (,(get-opt "download.extra.archive") ,(get-opt "download.extra.uri")))) (defun cmu-bin-expand (argv) (loop for archive in (list (get-opt "download.archive") (get-opt "download.extra.archive")) @@ -84,7 +75,7 @@ (push `("cmu-bin" . (,(decide-version 'cmu-bin-get-version) cmu-bin-argv-parse - cmu-bin-download + ,(decide-download 'cmu-bin-download) cmu-bin-expand setup)) *install-cmds*) diff --git a/lisp/install-ecl.lisp b/lisp/install-ecl.lisp index 52f0472..1d7048c 100644 --- a/lisp/install-ecl.lisp +++ b/lisp/install-ecl.lisp @@ -49,14 +49,7 @@ (set-opt "download.archive" (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) (when pos (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) - (if (or (not (probe-file (get-opt "download.archive"))) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive: ~A~%" (get-opt "download.uri")) - (download (get-opt "download.uri") (get-opt "download.archive"))) - (format t "~&Skip downloading ~A.~%Specify 'download.force=t' to download again.~%" - (get-opt "download.uri"))) - (cons (not (get-opt "without-install")) argv)) + `((,(get-opt "download.archive") ,(get-opt "download.uri")))) (defun ecl-expand (argv) (format t "~%Extracting archive:~A~%" (get-opt "download.archive")) @@ -128,7 +121,7 @@ ,(decide-version 'ecl-get-version) ecl-argv-parse start - ecl-download + ,(decide-download 'ecl-download) ecl-expand ecl-config ecl-make diff --git a/lisp/install-sbcl.lisp b/lisp/install-sbcl.lisp index 7a646f6..2f5e2f9 100644 --- a/lisp/install-sbcl.lisp +++ b/lisp/install-sbcl.lisp @@ -79,14 +79,7 @@ (set-opt "download.archive" (let ((pos (position #\/ (get-opt "download.uri") :from-end t))) (when pos (merge-pathnames (format nil "archives/~A" (subseq (get-opt "download.uri") (1+ pos))) (homedir))))) - (if (or (not (probe-file (get-opt "download.archive"))) - (get-opt "download.force")) - (progn - (format t "~&Downloading archive: ~A~%" (get-opt "download.uri")) - (download (get-opt "download.uri") (get-opt "download.archive"))) - (format t "~&Skip downloading ~A.~%Specify 'download.force=t' to download again.~%" - (get-opt "download.uri"))) - (cons t argv)) + `((,(get-opt "download.archive") ,(get-opt "download.uri")))) (defun sbcl-expand (argv) (format t "~%Extracting archive:~A~%" (get-opt "download.archive")) @@ -311,7 +304,7 @@ #+win32 sbcl-msys sbcl-start start - sbcl-download + ,(decide-download 'sbcl-download) sbcl-expand sbcl-patch sbcl-config diff --git a/lisp/util-install-quicklisp.lisp b/lisp/util-install-quicklisp.lisp index 815a29a..c3734d7 100644 --- a/lisp/util-install-quicklisp.lisp +++ b/lisp/util-install-quicklisp.lisp @@ -79,6 +79,30 @@ (getf argv :version-not-specified) 0))) (cons t argv))) +(defun decide-download (func) + (lambda (argv) + (loop for repeat = nil + for list = (funcall func argv) + do (handler-case + (loop for (archive uri) in list + do (if (or (not (probe-file archive)) + (get-opt "download.force")) + (progn + (format t "~&Downloading archive:~A:" uri) + ;;TBD proxy support... and other params progress bar? + (download uri archive) + (format t "OK~%")) + (format t "~&Skip downloading ~A~%specify download.force=t to download it again.~%" + uri))) + (uiop/run-program:subprocess-error () + (format t "NG~%") + (setf repeat t))) + while (and repeat + (incf (getf argv :version-not-specified)) + (> (length (funcall *version-func*)) + (getf argv :version-not-specified)))) + (cons (not (get-opt "without-install")) argv))) + (defun install-running-p (argv) ;;TBD (declare (ignore argv))