[asdf-devel] Guard against (push "/foo/bar" asdf:*central-registry*)

Gary King gwking at metabang.com
Thu Jul 9 16:35:09 UTC 2009


How about this:

>
> (defun directory-pathname-p (pathname)
>   (and (member (pathname-name pathname) (list nil :unspecified))
>        (member (pathname-type pathname) (list nil :unspecified))))
>
> (defun sysdef-central-registry-search (system)
>   (let ((name (coerce-name system))
> 	(to-remove nil))
>     (block nil
>       (unwind-protect
> 	   (dolist (dir *central-registry*)
> 	     (let ((defaults (eval dir)))
> 	       (cond ((directory-pathname-p defaults)
> 		      (let ((file (and defaults
> 				       (make-pathname
> 					:defaults defaults :version :newest
> 					:name name :type "asd" :case :local))))
> 			(if (and file (probe-file file))
> 			    (return file))))
> 		     (t
> 		      (warn "~@<While searching for system `~s`: `~s` evaluated to  
> `~s` which is not a directory. Removing entry from *central- 
> registry*~@:>" system dir defaults)
> 		      (push dir to-remove)))))
> 	;; cleanup
> 	(dolist (dir to-remove)
> 	  (setf *central-registry* (remove dir *central-registry*)))))))
>



On Jul 7, 2009, at 7:16 AM, Gary King wrote:

> Hi Tobias,
>
> I think this would be a good thing.
>
> On Jul 7, 2009, at 6:31 AM, Tobias C. Rittweiler wrote:
>
>>
>> I think it's bitten pretty much all of us that we at least once  
>> tried to
>> push a non-directory-designating filename to *CENTRAL-REGISTRY*.
>>
>> It's a common pitfalls for newcomers.
>>
>> Couldn't ASDF signal a warning when it encounters such a thing while
>> grovelling through the registry?
>>
>> -T.
>>
>>
>> _______________________________________________
>> asdf-devel mailing list
>> asdf-devel at common-lisp.net
>> http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel
>
> --
> Gary Warren King, metabang.com
> Cell: (413) 559 8738
> Fax: (206) 338-4052
> gwkkwg on Skype * garethsan on AIM * gwking on twitter
>
>
>
>
>

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









More information about the asdf-devel mailing list