Ensuring that ASDF reloads out of date system defs.
Gary King <[email protected]> Sun, 15 Jun 2008 12:19:30 -0400
| Newsgroups | gmane.lisp.cclan.general |
|---|---|
| Message-ID | <[email protected]> |
ASDF reloads system definitions when it can tell that they have been updated on disk since the last time that they were loaded. This works only if system-definition-pathname is able to find the system in question. If one loads a system by hand (i.e., if one loads a system that cannot be found using the *system-definition-search-functions*), then ASDF will not find the system and will not update the system if it is changed on disk. The patch below corrects this behavior by augmenting find-system and modifying system-source-file (to prevent infinite recursion). As I write this up, I wonder if it would make better sense to modify system- definition pathname to return the pathname of systems that are in- memory but cannot be found via the search functions. Hmm, I think it does. I'll send this e-mail but won't be committing the patch below. Instead I'll work out a different patch with the same effect. Once done, I'll e-mail my code for review. > (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)))) > > -(defun system-source-file (system-name) > - (let ((system (asdf:find-system system-name))) > +(defgeneric system-source-file (system) > + (:documentation "Return the source file in which system is > defined.")) > + > +(defmethod system-source-file ((system-name t)) > + (system-source-file (find-system system-name))) > + > +(defmethod system-source-file ((system system)) > (make-pathname > :type "asd" > :name (asdf:component-name system) > - :defaults (asdf:component-relative-pathname system)))) > + :defaults (asdf:component-relative-pathname system))) > > -- 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