Commit 1759ae26 authored by Peter Van Eynde's avatar Peter Van Eynde
Browse files

imported new upstream 1.704

parents 5274f11a 6df0471a
......@@ -4,18 +4,31 @@ common-lisp.net
.vcs
init-lisp.lisp
website/changelog.xml
push
resbcl
reccl
# Test stuff
test/results/
test/tmp/
test/conf.d/
test/dir1/
test/dir2/
# Temporary files from documentation build
doc/asdf/
doc/asdf.aux
doc/asdf.cp
doc/asdf.cps
doc/asdf.fn
doc/asdf.fns
doc/asdf.html
doc/asdf.info
doc/asdf.ky
doc/asdf.log
doc/asdf.pdf
doc/asdf.pg
doc/asdf.toc
doc/asdf.tp
doc/asdf.vr
doc/asdf.vrs
# We build these at various stages in the make process
LICENSE
website/output/
test-results/
tmp/
lift-local.config
*.dribble
......
......@@ -21,7 +21,6 @@ bump_revision: FORCE
bin/bump-revision-and-tag.sh
archive: FORCE
sbcl --userinit /dev/null --sysinit /dev/null --load bin/make-helper.lisp \
--eval "(rewrite-license)" --eval "(quit)"
bin/build-tarball.sh
......@@ -33,12 +32,11 @@ archive-copy: archive
git push cl.net
git push --tags cl.net
website-copy: FORCE
bin/rsync-cp.sh website/output/ $(webhome_private)
bin/rsync-cp.sh tmp/asdf.lisp $(webhome_private)
website:
make -C doc website
clean_dirs = $(sourceDirectory)
clean_extensions = fasl dfsl cfsl fasl fas lib dx32fsl lx64fsl lx32fsl o
clean_extensions = fasl dfsl cfsl fasl fas lib dx32fsl lx64fsl lx32fsl o bak
clean: FORCE
@for dir in $(clean_dirs); do \
......@@ -52,6 +50,8 @@ clean: FORCE
done; \
fi; \
done
rm -rf tmp
make -C doc clean
test: FORCE
@cd test; make clean;./run-tests.sh $(lisp) $(test-regex)
......
========================
ASDF Output Translations
========================
This file specifies how ASDF stores "binary" outputs for its operations,
typically Lisp FASL files, but also any other files
that may be generated, e.g. C files and executables from CFFI-GROVEL.
Configurations
==============
Configurations specify mappings from source locations to binary locations.
1- An application may explicitly initialize the output-translations
configuration using the `Configuration API`_ below,
in which case this takes precedence.
It may itself compute this configuration from the command-line,
from a script, from its own configuration file, etc.
2- The source registry will be configured from
the environment variable ``ASDF_OUTPUT_TRANSLATIONS`` if it exists.
3- The source registry will be configured from
user configuration file
``~/.config/common-lisp/asdf-output-translations.conf``
if it exists.
4- The source registry will be configured from
user configuration directory
``~/.config/common-lisp/asdf-output-translations.conf.d/``
if it exists.
5- The source registry will be configured from
system configuration file
``/etc/common-lisp/asdf-output-translations.conf``
if it exists.
6- The source registry will be configured from
system configuration directory
``/etc/common-lisp/asdf-output-translations.conf.d/``
if it exists.
Each of these configurations is specified as a SEXP
in a trival domain-specific language (defined below).
Additionally, a more shell-friendly syntax is available
for the environment variable (defined yet below).
Each of these configurations is only used if the previous
configuration explicitly or implicitly specifies that it
includes its inherited configuration.
Additionally, some implementation-specific directories
may be automatically added to whatever mappings are specified
in configuration files, no matter if the last one inherits or not.
Backward Compatibility
======================
We purposefully do NOT provide backward compatibility with earlier versions of
asdf-binary-locations (8 Sept 2009),
common-lisp-controller (7.00) or
cl-launch (2.35),
each of which had similar general capabilities.
Future versions of same packages (if any)
will hopefully use the new ASDF API as defined below.
These previous programs' API was not designed
for easy configuration by the end-user
in an easy way with configuration files,
and their previous API didn't fit the new paradigm.
But this incompatibility won't inconvenience many people.
Indeed, few people use and customize these packages;
these people are experts who can trivially adapt to the new configuration.
Most people are not experts, could not properly configure these features
(except inasmuch as the default configuration of
common-lisp-controller and/or cl-launch
might have been doing the right thing for some users),
and yet will experience software that "just works",
as configured by the system distributor, or by default.
Nevertheless, if you want to use the old ASDF-Binary-Locations
(the one available as an extension to load of top of ASDF,
not the one built into a few old versions of ASDF),
it may still work if you just make sure you do not configure the new
builtin ASDF-Output-Translations.
But if you configure both ASDF's new builtin and ASDF-Binary-Locations
(or an old common-lisp-controller or cl-launch),
you may experience "interesting" issues, so don't do it.
Configuration DSL
=================
Here is the grammar of the SEXP DSL for asdf-output-translations configuration:
;; A configuration is single SEXP starting with keyword :source-registry
;; followed by a list of directives.
CONFIGURATION := (:output-translations DIRECTIVE ...)
;; A directive is one of the following:
DIRECTIVE :=
;; include a configuration file or directory
(:include PATHNAME-DESIGNATOR) |
;; 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
;; enable global cache in ~/.common-lisp/cache/sbcl-1.0.35-x86-64/ or something.
:enable-user-cache |
;; Disable global cache. Map / to /
:disable-cache |
;; add a single directory to be scanned (no recursion)
(DIRECTORY-DESIGNATOR DIRECTORY-DESIGNATOR)
DIRECTORY-DESIGNATOR :=
ABSOLUTE-COMPONENT-DESIGNATOR |
(ABSOLUTE-COMPONENT-DESIGNATOR RELATIVE-COMPONENT-DESIGNATOR ...)
ABSOLUTE-COMPONENT-DESIGNATOR :=
STRING | ;; namestring (directory is assumed, better be absolute or bust, ``/**/*.*`` added)
PATHNAME | ;; pathname (better be an absolute directory or bust)
:HOME | ;; designates the user-homedir-pathname ~/
:USER-CACHE | ;; designates the default location for the user cache
:SYSTEM-CACHE | ;; designates the default location for the system cache
:ROOT | ;; the root of the filesystem hierarchy
:CURRENT-DIRECTORY ;; the current directory
RELATIVE-COMPONENT-DESIGNATOR :=
STRING | ;; namestring, directory is assumed. If the last component, ``/**/*.*`` is added
PATHNAME | ;; pathname unless last component, directory is assumed.
:IMPLEMENTATION | ;; a directory based on implementation, e.g. sbcl-1.0.32.30-linux-x86-64
:IMPLEMENTATION-TYPE | ;; a directory based on lisp-implementation-type only, e.g. sbcl
:CURRENT-DIRECTORY | ;; all components of the current directory, without the :absolute
:UID | ;; current UID -- not available on Windows
:USER ;; current USER name -- NOT IMPLEMENTED(!)
Relative components better be either relative
or subdirectories of the path before them, or bust.
The last component, if not a pathname, is notionally completed by ``/**/*.*``.
You can specify more fine-grained patterns by using a pathname object,
e.g. ``#p"some/path/**/foo*/bar-*.fasl"``
You may use ``#+features`` to customize the configuration file.
The second designator of a mapping may be ``NIL``, indicating that files are not mapped
to anything but themselves (same as if the second designator was the same as the first).
``: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).
:enable-user-cache is the same as ``(:root :user-cache)``.
:disable-cache is the same as ``(:root :root)``.
:user-cache uses the contents of variable ``asdf::*user-cache*``
which by default is the same as using
``(:home ".cache" "common-lisp" :implementation)``.
:system-cache uses the contents of variable ``asdf::*system-cache*``
which by default is the same as using
``(:root "var" "cache" "common-lisp" :uid :implementation-type)``
Configuration Directories
=========================
Configuration directories consist in files each contains
a list of directives without any enclosing ``(:asdf-output-translations ...)`` 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 that 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
=======================================
When considering environment variable ``ASDF_OUTPUT_TRANSLATIONS``
ASDF will skip to next configuration if it's an empty string.
It will ``READ`` the string as a SEXP in the DSL
if it begins with a paren ``(``
and it will be interpreted as a colon-separated list of directories.
Directories should come in pairs, each pair indicating a :map directive.
The magic empty entry indicates the splicing of inherited configuration
rather than one of entry in a mapping pair.
Semantics of Output Translations
================================
From the specified configuration, a list of mappings is extracted
in a straightforward way:
mappings are collected in order, recursing through
included or inherited configuration as specified.
To this list is prepended some implementation-specific mappings,
and is appended a global default.
The list is then compiled to a mapping table as follows:
for each entry, in order, resolve the first designated directory
into an actual directory pathname for source locations.
If no mapping was specified yet for that location,
resolve the second designated directory to an output location directory
add a mapping to the table mapping the source location to the output location,
and add another mapping from the output location to itself
(unless a mapping already exists for the output location).
Based on the table, a mapping function is defined,
mapping source pathnames to output pathnames:
given a source pathname, locate the longest matching prefix
in the source column of the mapping table.
Replace that prefix by the corresponding output column
in the same row of the table, and return the result.
If no match is found, return the source pathname.
(A global default mapping the filesystem root to itself
may ensure that there will always be a match,
with same fall-through semantics).
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.
To explicitly flush any information cached by the system, use the API below.
Output location API
===================
The specified functions are exported from package ASDF.
(initialize-output-translations)
will read the configuration and initialize all internal variables.
(clear-output-translations)
undoes any output location configuration
and clears any cache for the mapping algorithm.
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.
(ensure-output-translations)
checks whether output translations have been initialized.
If not, initialize them.
This function will be called before any attempt to operate on a system.
If your application wants to override the provided defaults,
it will have to use the below function process-output-translations.
(apply-output-translations PATHNAME)
Applies the configured output location translations to PATHNAME
(calls ensure-output-translations for the translations).
Credits
=======
Thanks a lot to Bjorn Lindberg and Gary King for ASDF-Binary-Locations,
and to Peter van Eynde for Common Lisp Controller.
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>
..
;;; Local Variables:
;;; mode: rst
;;; End:
===========================
Common Lisp Source Registry
===========================
This file specifies how build systems such as ASDF and XCVB
may be configured with respect to filesystem paths
where to search for Common Lisp source code.
Configurations
==============
Configurations specify paths where to find system files.
1- An application may explicitly initialize the source-registry
configuration using the `Configuration API`_ below,
in which case this takes precedence.
It may itself compute this configuration from the command-line,
from a script, from its own configuration file, etc.
2- The source registry will be configured from
the environment variable ``CL_SOURCE_REGISTRY`` if it exists.
3- The source registry will be configured from
user configuration file
``~/.config/common-lisp/source-registry.conf``
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.
6- The source registry will be configured from
system configuration directory
``/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`_).
Each of these configuration is specified as a SEXP
in a trival domain-specific language (defined below).
Additionally, a more shell-friendly syntax is available
for the environment variable (defined yet below).
Each of these configurations is only used if the previous
configuration explicitly or implicitly specifies that it
includes its inherited configuration.
Additionally, some implementation-specific directories
may be automatically prepended to whatever directories are specified
in configuration files, no matter if the last one inherits or not.
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.
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
=================
Here is the grammar of the SEXP DSL for source-registry configuration:
;; A configuration is single SEXP starting with keyword :source-registry
;; followed by a list of directives.
CONFIGURATION := (:source-registry DIRECTIVE ...)
;; A directive is one of the following:
DIRECTIVE :=
;; add a single directory to be scanned (no recursion)
(:directory DIRECTORY-PATHNAME-DESIGNATOR) |
;; add a directory hierarchy, recursing but excluding specified patterns
(:tree DIRECTORY-PATHNAME-DESIGNATOR) |
;; override the default defaults for exclusion patterns
(:exclude PATTERN ...) |
;; splice the parsed contents of another config file
(:include REGULAR-FILE-PATHNAME-DESIGNATOR) |
;; 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
;; This directive specifies that some default must be spliced.
: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"
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 that 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
=======================================
When considering environment variable ``CL_SOURCE_REGISTRY``
ASDF will skip to next configuration if it's an empty string.
It will ``READ`` the string as a SEXP in the DSL
if it begins with a paren ``(``
and it will be interpreted much like ``TEXINPUTS``
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.
* if the entry is the empty string (which may only appear once),
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 looking in a directory, if the system is found, the search succeeds,
otherwise it continues.
When looking in a tree, if one system is found, the search succeeds.
If multiple systems are found, the consequences are unspecified:
the search may succeed with any of the found systems,
or an error may be raised.
ASDF currently returns the first system found,
XCVB currently raised an error.
If none is found, the search continues.
Exclude statements specify patterns of subdirectories the systems of which
to ignore. Typically you don't want to use copies of files kept by such
version control systems as Darcs.
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).
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.
To explicitly flush any information cached by the system, use the API below.
Configuration API
=================
The specified functions are exported from your build system's package.
Thus for ASDF the corresponding functions are in package ASDF,
and for XCVB the corresponding functions are in package XCVB.
(initialize-source-registry)
will read the configuration and initialize all internal variables.
(clear-source-registry)
undoes any source registry configuration
and clears any cache for the search algorithm.
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.
(ensure-source-registry)
checks whether a source registry has been initialized.
If not, initialize it.
This function will be called before any attempt to find a system
in the source registry.
If your application wants to override the provided defaults,
it will have to use the below function process-source-registry.
(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
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.
Future
======
If this mechanism is successful, in the future, we may declare
``asdf:*central-registry*`` obsolete and eventually remove it.
Any hook into implementation-specific search mechanisms will by then
have been integrated in the ``:default-configuration`` which everyone
should either explicitly use or implicit inherit. Some shell syntax
for it should probably be added somehow.
But we're not there yet. For now, let's see how practical this new
source-registry is.
Rejected ideas
==============
Alternatives I considered and rejected included:
1- Keep asdf:*central-registry* as the master with its current semantics,
and somehow the configuration parser expands the new configuration
language into a expanded series of directories of subdirectories to
lookup, pre-recursing through specified hierarchies. This is kludgy,
and leaves little space of future cleanups and extensions.
2- Keep asdf:*central-registry* remains the master but extend its semantics
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.
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.
4- Replace asdf:*central-registry* by a symbol-macro with appropriate magic
when you dereference it or setf it. Only the new variable with new
semantics is handled by the new search procedure.
I've been suggested the below features, but have rejected them,
for the sake of keeping ASDF no more complex than strictly necessary.
* More syntactic sugar: synonyms for the configuration directives, such as
(:add-directory X) for (:directory X), or (:add-directory-hierarchy X)
or (:add-directory X :recurse t) for (:tree X).
* The possibility to register individual files instead of directories.