disambiguating two reasons for missing-component errors

Gary King <[email protected]> Sun, 15 Jun 2008 12:18:02 -0400
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
Currently, ASDF does not distinguish the case of being unable to find  
a system at all and being unable to find a system of a high enough  
version. Error messages that include "or" always bug me because, after  
all, ASDF does know why it got the error. The patch below  
disambiguates the two cases into missing-component condition and  
missing-component-of-version condition.


If I don't hear from anyone, I'll commit this sometime this week.

> @@ -179,9 +200,11 @@
>
>  (define-condition missing-component (system-definition-error)
>    ((requires :initform "(unnamed)" :reader missing- 
> requires :initarg :requires)
> -   (version :initform nil :reader missing-version :initarg :version)
>     (parent :initform nil :reader missing-parent :initarg :parent)))
>
> +(define-condition missing-component-of-version (missing-component)
> +  ((version :initform nil :reader missing- 
> version :initarg :version)))
> +
>  (define-condition missing-dependency (missing-component)
>    ((required-by :initarg :required-by :reader missing-required-by)))
>

> @@ -230,7 +253,13 @@
>
>  (defmethod print-object ((c missing-component) s)
>    (format s "~@<component ~S not found~
> -             ~@[ or does not match version ~A~]~
> +             ~@[ in ~A~]~@:>"
> +          (missing-requires c)
> +          (when (missing-parent c)
> +            (component-name (missing-parent c)))))
> +
> +(defmethod print-object ((c missing-component-of-version) s)
> +  (format s "~@<component ~S does not match version ~A~
>               ~@[ in ~A~]~@:>"
>            (missing-requires c)
>            (missing-version c)
> @@ -388,7 +417,11 @@
>  (defun find-system (name &optional (error-p t))
>    (let* ((name (coerce-name name))
>           (in-memory (gethash name *defined-systems*))
> -         (on-disk (system-definition-pathname name)))
> +         (on-disk (or (system-definition-pathname name)
> +		      (and in-memory
> +			   (slot-boundp (cdr in-memory) 'relative-pathname)
> +			   (system-source-file (cdr in-memory))
> +			   (probe-file (system-source-file (cdr in-memory)))))))
>      (when (and on-disk
>                 (or (not in-memory)
>                     (< (car in-memory) (file-write-date on-disk))))
>

--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM





-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php