Commit 60e59ce3 authored by Daniel Barlow's avatar Daniel Barlow
Browse files

Rationalise the system-definition-finding machinery a bit.

*central-registry* no longer takes functions (that feature was broken
anyway), but a new list *system-definition-search-functions*
does.  Its default content is a single function designator for
sysdef-central-registry-search, which does the *central-registry*
search

Update documentation to match

Fix test1.script to call the preferred OPERATE instead of OOS

Update documentation to describe COMPONENT-PROPERTY method
parent cc19f626
Loading
Loading
Loading
Loading
+28 −18
Changes for README: 28 added lines, 18 removed lines.
Original line number Original line Diff line number Diff line
$Id: README,v 1.27 2002/11/12 12:53:26 dan_b Exp $         -*- Text -*-
$Id: README,v 1.28 2003/02/04 17:01:24 dan_b Exp $         -*- Text -*-




asdf: another system definition facility          
asdf: another system definition facility          
@@ -40,12 +40,9 @@ Lisp implementation, by loading it from the startup script, or dumping
a custom core, or something.
a custom core, or something.


- The variable asdf:*central-registry* is a list of system directory
- The variable asdf:*central-registry* is a list of system directory
  designators.  A ssytem directory designator is either a function
  designators.  A system directory designator is a form which will be
  designator for a function of one argument, which when called with
  evaluated whenever a system is to be found, and must evaluate to a
  the system name will return a directory to look for .asd files in,
  directory to look in.  For example, you might have
  or it is a form which will be evaluated whenever a system is to be
  found, and must evaluate to a directory to look in.  For example,
  you might have


     (*default-pathname-defaults* "/home/me/cl/systems/"
     (*default-pathname-defaults* "/home/me/cl/systems/"
      "/usr/share/common-lisp/systems/")
      "/usr/share/common-lisp/systems/")
@@ -53,6 +50,10 @@ a custom core, or something.
  (When we say "directory" here, we mean "designator for a pathname
  (When we say "directory" here, we mean "designator for a pathname
  with a supplied DIRECTORY component")
  with a supplied DIRECTORY component")


  It is possible to customize the system definition file search.
  That's considered advanced use, and covered later: search forward
  for *system-definition-search-functions*

- To compile and load a system 'foo', you need to (1) ensure that
- To compile and load a system 'foo', you need to (1) ensure that
  foo.asd is in one of the directories in *central-registry* (a
  foo.asd is in one of the directories in *central-registry* (a
  symlink to the real location of foo.asd is preferred), (2) execute
  symlink to the real location of foo.asd is preferred), (2) execute
@@ -182,7 +183,7 @@ to make-pathname in whatever filesystem the system is to be found.
The lower-casing-symbols behaviour is unconventional, but was selected
The lower-casing-symbols behaviour is unconventional, but was selected
after some consideration.  Observations suggest that the type of
after some consideration.  Observations suggest that the type of
systems we want to support either have lowercase as customary case
systems we want to support either have lowercase as customary case
(unix, mac, windows) or silently convert lowercase to uppercase
(Unix, Mac, windows) or silently convert lowercase to uppercase
(lpns), so this makes more sense than attempting to use :case :common,
(lpns), so this makes more sense than attempting to use :case :common,
which is reported not to work on some implementations
which is reported not to work on some implementations


@@ -194,8 +195,8 @@ This is used by the test-system-version operation (see later).


Traditionally defsystem users have used reader conditionals to include
Traditionally defsystem users have used reader conditionals to include
or exclude specific per-implementation files.  This means that any
or exclude specific per-implementation files.  This means that any
single implmentation cannot read the entire system, which becomes a
single implementation cannot read the entire system, which becomes a
problem if it doesnb't wish to compile it, but instead for example to
problem if it doesn't wish to compile it, but instead for example to
create an archive file containing all the sources, as it will omit to
create an archive file containing all the sources, as it will omit to
process the system-dependent sources for other systems.
process the system-dependent sources for other systems.


@@ -295,9 +296,9 @@ information to satisfy these systems. Sometimes the creator of an
asdf system may know the additional information and wish to provide it
asdf system may know the additional information and wish to provide it
directly.
directly.


component-properties is a symbol-value alist (plist?) which system
(component-property component property-name) and associated setf method 
authors may set and package building rograms may query.  asdf make sno
will allow the programmatic update of this information.  Property
further specification of the contents of this slot.
names are compared as if by EQL, so use symbols or keywords or something


** Subclasses of component
** Subclasses of component


@@ -456,11 +457,9 @@ any other component names (including case conversion)
** find-system
** find-system


Given a system designator, find-system finds an actual system - either
Given a system designator, find-system finds an actual system - either
in memory, or in a file on the disk.  This file has the name of the
in memory, or in a file on the disk.  It funcalls each element in the
system, the type "asd", and is looked for in each of the directories
*system-definition-search-functions* list, expecting a pathname to be
given by evaluating members of *central-registry*.  The first matching
returned.
file is considered, whether or not it turns out to actually define the
appropriate system


If a suitable file exists, it is loaded if
If a suitable file exists, it is loaded if


@@ -475,6 +474,17 @@ is recommended to) include defpackage and in-package forms in his
system definition files, however, so that they can be loaded manually
system definition files, however, so that they can be loaded manually
if need be.
if need be.


For convenience in the normal case, and for backward compatibility
with the spirit of mk-defsystem, the default contents of
*system-definition-search-functions* is a function called
sysdef-central-registry-search.  This looks in each of the directories
given by evaluating members of *central-registry*, for a file whose
name is the name of the system and whose type is "asd".  The first
such file is returned, whether or not it turns out to actually define
the appropriate system



** Syntax
** Syntax


Systems can always be constructed programmatically by instantiating
Systems can always be constructed programmatically by instantiating
+23 −17
Changes for asdf.lisp: 23 added lines, 17 removed lines.
Original line number Original line Diff line number Diff line
;;; This is asdf: Another System Definition Facility.  $Revision: 1.56 $
;;; This is asdf: Another System Definition Facility.  $Revision: 1.57 $
;;;
;;;
;;; Feedback, bug reports, and patches are all welcome: please mail to
;;; Feedback, bug reports, and patches are all welcome: please mail to
;;; <cclan-list@lists.sf.net>.  But note first that the canonical
;;; <cclan-list@lists.sf.net>.  But note first that the canonical
@@ -13,7 +13,7 @@
;;; is the latest development version, whereas the revision tagged
;;; is the latest development version, whereas the revision tagged
;;; RELEASE may be slightly older but is considered `stable'
;;; RELEASE may be slightly older but is considered `stable'


;;; Copyright (c) 2001, 2002 Daniel Barlow and contributors
;;; Copyright (c) 2001-2003 Daniel Barlow and contributors
;;;
;;;
;;; Permission is hereby granted, free of charge, to any person obtaining
;;; Permission is hereby granted, free of charge, to any person obtaining
;;; a copy of this software and associated documentation files (the
;;; a copy of this software and associated documentation files (the
@@ -88,7 +88,7 @@
(in-package #:asdf)
(in-package #:asdf)


;;; parse the cvs revision into something that might be vaguely useful.  
;;; parse the cvs revision into something that might be vaguely useful.  
(defvar *asdf-revision* (let* ((v "$Revision: 1.56 $")
(defvar *asdf-revision* (let* ((v "$Revision: 1.57 $")
			       (colon (position #\: v))
			       (colon (position #\: v))
			       (dot (position #\. v)))
			       (dot (position #\. v)))
			  (and v colon dot 
			  (and v colon dot 
@@ -305,27 +305,33 @@ and NIL NAME and TYPE components"
     (string name)
     (string name)
     (t (sysdef-error "Invalid component designator ~A" name))))
     (t (sysdef-error "Invalid component designator ~A" name))))


(defvar *central-registry*
  '(*default-pathname-defaults*
    "/home/dan/src/sourceforge/cclan/asdf/systems/"
    #+nil "telent:asdf;systems;"))

(defun system-definition-pathname (system)
(defun system-definition-pathname (system)
  (some (lambda (x) (funcall x system))
	*system-definition-search-functions*))
	
(defun sysdef-central-registry-search (system)
  (let ((name (coerce-name system)))
  (let ((name (coerce-name system)))
    (block nil
      (dolist (dir *central-registry*)
      (dolist (dir *central-registry*)
      (let* ((defaults (if (and (symbolp dir)
	(let* ((defaults (eval dir))
				(fboundp dir))
			   (funcall dir name)
			   (eval dir)))
	       (file (and defaults
	       (file (and defaults
			  (make-pathname
			  (make-pathname
			 :name name :case :local :type "asd"
			   :defaults defaults :version :newest
			 :defaults defaults
			   :name name :type "asd" :case :local))))
			 :version :newest))))
	  (if (and file (probe-file file))
	  (if (and file (probe-file file))
	    (return-from system-definition-pathname file))))
	      (return file)))))))
    nil))


(defvar *central-registry*
  '(*default-pathname-defaults*
    #+nil "/home/dan/src/sourceforge/cclan/asdf/systems/"
    #+nil "telent:asdf;systems;"))

;;; for the sake of keeping things reasonably neat, we adopt a
;;; convention that functions in this list are prefixed SYSDEF-


(defvar *system-definition-search-functions*
  '(sysdef-central-registry-search))


(defun find-system (name &optional (error-p t))
(defun find-system (name &optional (error-p t))
  (let* ((name (coerce-name name))
  (let* ((name (coerce-name name))
+2 −2
Changes for test/test1.script: 2 added lines, 2 removed lines.
Original line number Original line Diff line number Diff line
;;; -*- Lisp -*-
;;; -*- Lisp -*-
(load "../asdf")
(load "../asdf")
(setf asdf:*central-registry* '(*default-pathname-defaults*))
(setf asdf:*central-registry* '(*default-pathname-defaults*))
(asdf:oos 'asdf:load-op 'test1)
(asdf:operate 'asdf:load-op 'test1)


;; test that it compiled
;; test that it compiled
(defvar file1-date (file-write-date (compile-file-pathname "file1")))
(defvar file1-date (file-write-date (compile-file-pathname "file1")))
@@ -16,7 +16,7 @@


(asdf::run-shell-command "rm ~A"
(asdf::run-shell-command "rm ~A"
			 (namestring (compile-file-pathname "file2")))
			 (namestring (compile-file-pathname "file2")))
(asdf:oos 'asdf:load-op 'test1)
(asdf:operate 'asdf:load-op 'test1)
(assert (= file1-date (file-write-date (compile-file-pathname "file1"))))
(assert (= file1-date (file-write-date (compile-file-pathname "file1"))))
(assert (file-write-date (compile-file-pathname "file2")))
(assert (file-write-date (compile-file-pathname "file2")))