(defun autoload-system-and-dependencies (name &key prompt)
"Try to load the system named by NAME, automatically loading any
Quicklisp-provided systems first, and catching ASDF missing
dependencies too if possible."
(setf name (string-downcase name))
(with-simple-restart (abort "Give up on ~S" name)
(let ((strategy (compute-load-strategy name)) (tried-so-far (make-hash-table :test 'equalp)))
(show-load-strategy strategy)
(when (or (not prompt) (press-enter-to-continue))
(tagbody
retry (handler-bind ((asdf:missing-dependency-of-version (lambda (c)
;; Nothing Quicklisp can do to recover from this, so
;; just resignal (error c))) (asdf:missing-dependency (lambda (c) (let ((parent (asdf::missing-required-by c)) (missing (asdf::missing-requires c))) (when (typep parent 'asdf:system) (if (gethash missing tried-so-far) (error "Dependency looping -- already tried to load ~ ~A" missing) (setf (gethash missing tried-so-far) missing)) (autoload-system-and-dependencies missing :prompt prompt) (go retry)))))) (apply-load-strategy strategy)))))
name))
APPLY-LOAD-STRATEGY will install new things if they are available in Quicklisp.
By "installing" I mean downloading a tgz file, unpacking it, and making it visible via QL-DIST:SYSTEM-DEFINITION-SEARCHER, which is part of asdf:*system-definition-search-functions*.
Here's the code:
(defun autoload- system- and-dependencie s (name &key prompt) simple- restart (abort "Give up on ~S" name) load-strategy name))
(tried- so-far (make-hash-table :test 'equalp))) show-load- strategy strategy)
(press- enter-to- continue) )
(handler- bind
( (asdf:missing- dependency- of-version
(lambda (c)
(error c)))
(asdf:missing- dependency
(lambda (c)
(let ((parent (asdf:: missing- required- by c))
(missing (asdf:: missing- requires c)))
(when (typep parent 'asdf:system)
(if (gethash missing tried-so-far)
(error "Dependency looping -- already tried to load ~
~A" missing)
(setf (gethash missing tried-so-far) missing))
(autoload- system- and-dependencie s missing
: prompt prompt)
(go retry))))))
(apply- load-strategy strategy)))))
"Try to load the system named by NAME, automatically loading any
Quicklisp-provided systems first, and catching ASDF missing
dependencies too if possible."
(setf name (string-downcase name))
(with-
(let ((strategy (compute-
(
(when (or (not prompt)
(tagbody
retry
;; Nothing Quicklisp can do to recover from this, so
;; just resignal
name))
APPLY-LOAD-STRATEGY will install new things if they are available in Quicklisp.
By "installing" I mean downloading a tgz file, unpacking it, and making it visible via QL-DIST: SYSTEM- DEFINITION- SEARCHER, which is part of asdf:*system- definition- search- functions* .