ASDF bug?
Larry Hunter <[email protected]>
| Newsgroups | gmane.lisp.cclan.general |
|---|---|
| Message-ID | <[email protected]> |
Dear CCLAN'ers,
I've recently moved from MK:DEFSYSTEM to ASDF, and noticed what
I consider to be a bug, or at the very least an infelicity.
Using ASDF 1.86 and this very simple system definition
(defsystem "inflate"
:description "handle compressed files (including stream interface)"
:version "like inflate.cl 1.1.4.2, but with extra code from JKF"
:author "See http://opensource.franz.com/deflate/"
:components ((:file "inflate-stream")))
I get this error:
cl-user(2): (asdf:operate 'asdf:load-op 'inflate)
; loading system definition from /home/hunter/lisp/external/inflate.asd into #<The asdf919 package>
; Loading /home/hunter/lisp/external/inflate.asd
; registering #<system "inflate" @ #x70000100095d112> as inflate
Error: `nil' is not of the expected type `number'
[condition type: type-error]
The proximal cause is this code in operation-done-p:
(> (apply #'min (mapcar #'file-write-date out-files))
(apply #'max (mapcar #'file-write-date in-files)))
the spec allows file-write-date to return NIL, which causes max (in
this case) to complain about a non-number. This should probably be
patched to something like
(mapcar (lambda (file) (or (file-write-date file) 0)))
However, the real underlying cause is that the source file name is
"inflate-stream.cl" and source-file-type for cl-source-file's is
defined to be "lisp".
First, I think ".cl" ".lisp" and ".lsp" are all pretty common source
file types, and should be accomodated somehow. Second, it's a pretty
opaque error message, and there is no indication in the documentation
that lisp source files must have type "lisp".
Although I am not that familiar with ASDF (duh!), I think this might
fix the problem. First, we allow source-file-type to return a list of
strings in addition to its current return value. If
component-relative-pathname gets a list of types, it iterates through
them until it finds one that exists, and then uses that. Like this:
(defmethod source-file-type ((c cl-source-file) (s module))
'("lisp" "cl" "lsp"))
(defmethod component-relative-pathname ((component source-file))
(find-if #'probe-file
(mapcar (lambda (name-type)
(if (slot-value component 'relative-pathname)
(merge-pathnames
(slot-value component 'relative-pathname)
name-type)
name-type))
(source-name-types component))))
(defun source-name-types (component)
(let* ((*default-pathname-defaults* (component-parent-pathname component))
(name (component-name component))
(source-types (source-file-type component (component-system component))))
(if (listp source-types)
(mapcar (lambda (type)
(make-pathname :name name :type type))
source-types)
(make-pathname :name name :type source-types))))
It might also be possible to work through the various ways that the
implementations pick out load file types themselves (e.g. Allegro has
*load-search-list*) but I don't have enough implementations around to
do justice to that approach.
Hope you find this useful.
Larry
--
Lawrence Hunter, Ph.D.
Director, Center for Computational Pharmacology
Associate Professor of Pharmacology, PMB & Computer Science
phone: +1 303 724 3574
cell: +1 303 324 0355
fax: +1 303 724 3648
email: [email protected]
URL: http://compbio.uchsc.edu/hunter
US mail: PO Box 6511, MS 8303, Aurora, CO 80045-0511 USA
Express Delivery: 12801 E. 17th Ave, RC-1 South Rm L18-6101, Aurora, CO 80045
PGP key on public keyservers
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click