Commit f3ed8252 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Merge branch 'master' of /home/fare/src/asdf

parents 5454c595 dcbd8af7
......@@ -26,11 +26,21 @@ Configurations specify paths where to find system files.
if it exists.
4- The source registry will be configured from
user configuration directory
``~/.config/common-lisp/source-registry.conf.d/``
if it exists.
5- The source registry will be configured from
system configuration file
``/etc/common-lisp/source-registry.conf``
if it exists.
5- The source registry will be configured from a default configuration,
6- The source registry will be configured from
system configuration file
``/etc/common-lisp/source-registry.conf.d/``
if it exists.
7- The source registry will be configured from a default configuration,
which allows for implementation-specific software to be searched.
(See below `Backward Compatibility`_).
......@@ -44,16 +54,17 @@ Backward Compatibility
======================
For backward compatibility, ASDF will fall back to its old ways
of searching for ``.asd`` files in the directories specified in
``asdf:*central-registry*``
if it fails to find a configuration for the source registry, or
if it fails to find a requested system in the configured source registry.
This new mechanism will therefore not affect you if you don't use it,
but will take precedence over the old mechanism if you do use it.
For the record, with the old mechanism, ASDF will first look
(on SBCL only) for a matching system in the implementation-specific
``contrib`` directory. Then (on all implementations) it will look
at your ``asdf:*central-registry*`` and search in the directories
specified there.
Moreover, when using SBCL, now as before, ASDF will first look
for a matching system in the implementation-specific ``contrib`` directory.
This allows for some magic implementation-provided systems
to be loaded specially in a version that matches your implementation.
Configuration DSL
......@@ -79,7 +90,8 @@ DIRECTIVE :=
;; splice the parsed contents of another config file
(:include REGULAR-FILE-PATHNAME-DESIGNATOR) |
;; Your configuration expression MUST contain exactly one of either of these:
;; Your configuration expression MUST contain
;; exactly one of either of these:
(:inherit-configuration) | ; splices contents of inherited configuration
(:ignore-inherited-configuration) ; drop contents of inherited configuration
......@@ -87,8 +99,27 @@ DIRECTIVE :=
(:default-registry)
PATTERN := a string without wildcards, that will be matched exactly
against the name of a any subdirectory in the directory component of a path.
e.g. "_darcs" will match #p"/foo/bar/_darcs/src/bar.asd"
against the name of a any subdirectory in the directory component
of a path. e.g. "_darcs" will match #p"/foo/bar/_darcs/src/bar.asd"
Configuration Directories
=========================
Configuration directories consist in files each contains
a list of directives without any enclosing ``(:source-registry ...)`` form.
The files will be sorted by namestring as if by #'string< and
the lists of directives of these files with be concatenated in order.
An implicit ``:inherit-configuration`` will be included
at the end of the list.
This allows for packaging software with has file granularity
(e.g. Debian's ``dpkg`` or some future version of ``clbuild``)
to easily include configuration information about distributed software.
Directories may be included by specifying a directory pathname
or namestring in an ``:include`` directive, e.g.::
(:include "/foo/bar/")
Shell-friendly syntax for configuration
......@@ -104,17 +135,20 @@ as ``:`` (colon) separated list of paths, where
* each entry is a directory to add to the search path.
* if the entry ends with a double slash ``//``
then it instead indicates a tree in the subdirectories of which to recurse.
then it instead indicates a tree in the subdirectories
of which to recurse.
* if the entry is the empty string (which may only appear once),
then it indicates that the inherited configuration should be spliced there.
then it indicates that the inherited configuration should be
spliced there.
Search Algorithm
================
In case that isn't clear, the semantics of the configuration is that
when searching for a system of a given name, directives are processed in order.
when searching for a system of a given name,
directives are processed in order.
When looking in a directory, if the system is found, the search succeeds,
otherwise it continues.
......@@ -135,15 +169,16 @@ Include statements cause the search to recurse with the path specifications
from the file specified.
An inherit-configuration statement cause the search to recurse with the path
specifications from the next configuration (see section Configurations_ above).
specifications from the next configuration
(see section Configurations_ above).
Caching Results
===============
The implementation is allowed to either eagerly compute the information
from the configurations and file system, or to lazily re-compute it every time,
or to cache any part of it as it goes.
from the configurations and file system, or to lazily re-compute it
every time, or to cache any part of it as it goes.
To explicitly flush any information cached by the system, use the API below.
......@@ -163,8 +198,9 @@ and for XCVB the corresponding functions are in package XCVB.
You might want to call that before you
dump an image that would be resumed with a different configuration,
and return an empty configuration.
Note that this does not include clearing information about systems defined
in the current image, only about where to look for systems not yet defined.
Note that this does not include clearing information about
systems defined in the current image, only about
where to look for systems not yet defined.
(ensure-source-registry)
checks whether a source registry has been initialized.
......@@ -177,12 +213,15 @@ and for XCVB the corresponding functions are in package XCVB.
(process-source-registry X &key inherit collect)
If X is a CONS, parse it as a SEXP in the configuration DSL,
and extend or override inheritted configuration.
If X is a STRING, first parse it into a SEXP as for the CL_SOURCE_REGISTRY
If X is a STRING, first parse it into a SEXP
as for the CL_SOURCE_REGISTRY
environment variable (see above) then process it.
If X is a PATHNAME, read the file as a single SEXP and process it.
The inheritted configuration is provided in keyword argument inherit,
itself a list of functions that take inherit and collect keyword arguments
and defaulting to a list of functions that implements the default behavior.
itself a list of functions that take inherit
and collect keyword arguments
and defaulting to a list of functions
that implements the default behavior.
Future
......@@ -214,7 +253,8 @@ Alternatives I considered and rejected included:
in completely new ways, so that new kinds of entries may be implemented
as a recursive search, etc. This seems somewhat backwards.
3- Completely remove asdf:*central-registry* and break backwards compatibility.
3- Completely remove asdf:*central-registry*
and break backwards compatibility.
Hopefully this will happen in a few years after everyone migrate to
a better ASDF and/or to XCVB, but it would be very bad to do it now.
......@@ -254,4 +294,4 @@ Thanks to Rommel Martinez for the initial implementation attempt.
All bad design ideas and implementation bugs are to mine, not theirs.
But so are good design ideas and elegant implementation tricks.
-- Francois-Rene Rideau <fare@tunes.org>, Mon, 18 Jan 2010 14:12:57 -0500
-- Francois-Rene Rideau <fare@tunes.org>, Sun, 24 Jan 2010 20:54:19 -0500
......@@ -2043,47 +2043,6 @@ applied by the plain `*source-to-target-mappings*`."
(end-of-file ()
nil))))
;;;; -----------------------------------------------------------------
;;;; SBCL hook into REQUIRE
;;;;
#+sbcl
(progn
(defun module-provide-asdf (name)
(handler-bind ((style-warning #'muffle-warning))
(let* ((*verbose-out* (make-broadcast-stream))
(system (asdf:find-system name nil)))
(when system
(asdf:operate 'asdf:load-op name)
t))))
(defun contrib-sysdef-search (system)
(let ((home (getenv "SBCL_HOME")))
(when (and home (not (string= home "")))
(let* ((name (coerce-name system))
(home (truename home))
(contrib (merge-pathnames
(make-pathname :directory `(:relative ,name)
:name name
:type "asd"
:case :local
:version :newest)
home)))
(probe-file contrib)))))
(pushnew
'(let ((home (getenv "SBCL_HOME")))
(when (and home (not (string= home "")))
(merge-pathnames "site-systems/" (truename home))))
*central-registry*)
(pushnew
'(merge-pathnames ".sbcl/systems/"
(user-homedir-pathname))
*central-registry*)
(pushnew 'module-provide-asdf sb-ext:*module-provider-functions*)
(pushnew 'contrib-sysdef-search *system-definition-search-functions*))
;;;; -----------------------------------------------------------------
;;;; Source Registry Configuration, by Francois-Rene Rideau
;;;; See README.source-registry and https://bugs.launchpad.net/asdf/+bug/485918
......@@ -2183,6 +2142,15 @@ with a different configuration, so the configuration would be re-read then."
(error "Only and only one form allowed for source registry. Got: ~S~%" forms))
(validate-source-registry-form (car forms))))
(defun validate-source-registry-directory (directory)
(let ((files (sort (directory (merge-pathnames "*.*" directory)
#+sbcl :resolve-symlinks #+sbcl nil)
#'string< :key #'namestring)))
`(:source-registry
,@(loop :for x :in files :append
(mapcar #'validate-source-registry-directive (read-file-forms file)))
(:inherit-configuration))))
(defun parse-source-registry-string (string)
(cond
((or (null string) (equal string ""))
......@@ -2232,12 +2200,22 @@ with a different configuration, so the configuration would be re-read then."
process-system-source-registry
process-default-source-registry))
(defun user-configuration-pathname ()
(merge-pathnames ".config/" (user-homedir-pathname)))
(defun system-configuration-pathname ()
#p"/etc/")
(defun source-registry-under (directory)
(merge-pathnames "common-lisp/source-registry.conf" directory))
(defun user-source-registry-pathname ()
(source-registry-under (merge-pathnames ".config/" (user-homedir-pathname))))
(source-registry-under (user-configuration-pathname)))
(defun system-source-registry-pathname ()
(source-registry-under "/etc/"))
(source-registry-under (system-configuration-pathname)))
(defun source-registry-directory-under (directory)
(merge-pathnames "common-lisp/source-registry.conf.d/" directory))
(defun user-source-registry-directory-pathname ()
(source-registry-directory-under (user-configuration-pathname)))
(defun system-source-registry-directory-pathname ()
(source-registry-directory-under (system-configuration-pathname)))
(defun process-environment-source-registry (&key inherit collect)
(process-source-registry (getenv "CL_SOURCE_REGISTRY")
......@@ -2256,10 +2234,14 @@ with a different configuration, so the configuration would be re-read then."
(defmethod process-source-registry ((pathname pathname) &key
(inherit *default-source-registries*)
collect)
(if (probe-file pathname)
(process-source-registry (validate-source-registry-file pathname)
:inherit inherit :collect collect)
(inherit-source-registry inherit :collect collect)))
(cond
((directory-pathname-p pathname)
(process-source-registry (validate-source-registry-directory pathname)))
((probe-file pathname)
(process-source-registry (validate-source-registry-file pathname)
:inherit inherit :collect collect))
(t
(inherit-source-registry inherit :collect collect))))
(defmethod process-source-registry ((string string) &key
(inherit *default-source-registries*)
collect)
......@@ -2327,6 +2309,47 @@ with a different configuration, so the configuration would be re-read then."
(source-registry)
(initialize-source-registry)))
;;;; -----------------------------------------------------------------
;;;; SBCL hook into REQUIRE
;;;;
#+sbcl
(progn
(defun module-provide-asdf (name)
(handler-bind ((style-warning #'muffle-warning))
(let* ((*verbose-out* (make-broadcast-stream))
(system (asdf:find-system name nil)))
(when system
(asdf:operate 'asdf:load-op name)
t))))
(defun contrib-sysdef-search (system)
(let ((home (getenv "SBCL_HOME")))
(when (and home (not (string= home "")))
(let* ((name (coerce-name system))
(home (truename home))
(contrib (merge-pathnames
(make-pathname :directory `(:relative ,name)
:name name
:type "asd"
:case :local
:version :newest)
home)))
(probe-file contrib)))))
(pushnew
'(let ((home (getenv "SBCL_HOME")))
(when (and home (not (string= home "")))
(merge-pathnames "site-systems/" (truename home))))
*central-registry*)
(pushnew
'(merge-pathnames ".sbcl/systems/"
(user-homedir-pathname))
*central-registry*)
(pushnew 'module-provide-asdf sb-ext:*module-provider-functions*)
(pushnew 'contrib-sysdef-search *system-definition-search-functions*))
;;;; -------------------------------------------------------------------------
;;;; Cleanups after hot-upgrade.
;;;; Things to do in case we're upgrading from a previous version of ASDF.
......
{include resources/header.md}
{include "resources/header.md"}
<div class="contents">
### Contributors
* crhodes - Christophe Rhodes <csr21@cantab.net>
* dan_b - Daniel Barlow
* dan_b - Daniel Barlow
* demoss - Nikodemus Siivola <nikodemus@random-state.net>
* gwking - Gary King <gwking@metabang.com>
* kevinrosenberg - Kevin Rosenberg
* kevinrosenberg - Kevin Rosenberg
* nhabedi - Edi Weitz
* pvaneynd - Peter Van Eynde
* rjain - Rahul Jain
......@@ -19,7 +19,7 @@
</div>
</div>
{include resources/footer.md}
{include "resources/footer.md"}
</div>
{include resources/header.md}
{include "resources/header.md"}
<div class="contents">
### Copyright
ASDF Copyright (C) 2001-2009 Daniel Barlow and contributors
ASDF Copyright (C) 2001-2009 Daniel Barlow and contributors
This website Copyright (C) 2001-2009 Daniel Barlow and
contributors
......@@ -34,7 +34,5 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</div>
</div>
{include resources/footer.md}
{include "resources/footer.md"}
</div>
{include resources/header.md}
{include "resources/header.md"}
## Glossary
{glossary}
[fixture]> glossary The fixture is the environment in which a testcase runs. The
fixture is the code that prepares the environment for the test and that resets
[fixture]> glossary The fixture is the environment in which a testcase runs. The
fixture is the code that prepares the environment for the test and that resets
the environment after the test. Fixtures can be shared by many test-cases.
{include resources/footer.md}
{include "resources/footer.md"}
{include shared-header.md}
{include "shared-header.md"}
<div class="header">
<span class="logo">
......
{include shared-links.md}
{include "shared-links.md"}
{set-property html yes}
{set-property author "the ASDF group"}
......@@ -17,19 +17,19 @@
[tests]: test-results.html
[git-browse]: http://common-lisp.net/gitweb?p=projects/asdf/asdf.git;a=summary
[git-resources]: git.html
[asdf-devel]: http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel
[asdf-announce]: http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-announce
[asdf-home]: http://common-lisp.net/project/asdf/
[asdf.lisp]: http://common-lisp.net/project/asdf/asdf.lisp
[tarball]: http://common-lisp.net/project/asdf/asdf.tar.gz
[kmp-large]: http://www.nhplace.com/kent/Papers/Large-Systems.html
[hs-require]: http://www.lispworks.com/documentation/HyperSpec/Body/f_provid.htm#require
[hs-standard-output]: http://www.lispworks.com/documentation/HyperSpec/Body/v_debug_.htm#STstandard-outputST
[tinaa-project]: http://common-lisp.net/project/tinaa/
[albert-project]: http://www.cliki.net/Albert/
\ No newline at end of file
{include shared-header.md}
{include "shared-header.md"}
{set-property style-sheets
{set-property style-sheets
"user-guide.css"
"http://common-lisp.net/project/cl-containers/shared/style-200.css"}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment