So, I've taken some time this week-end to implement something close to
what Martin and Anthony suggested in their last messages.
The idea is the following: the installation script accepts an option
specifying the layout to use. A layout is a table of paths to use for
various kinds of data, e.g. documentation, scheme code, and so on. A
layout also specifies the directory in which the "active" link (which
points to the installed package) should be put. This last directory is
the one which should appear in SCSH_LIB_DIRS.
The directories in a layout are all relative to some prefix. There are
two prefixes: one is the final one, where files will really appear, the
other is the staging prefix. Both prefix are given on the command line,
using the "--prefix" and "--install-prefix" options, respectively (they
replace the current "--root" and "--dest-root").
A layout can be specified completely on the command line, with the
--layout option, for example:
./install-pkg --layout scheme=code/scheme,doc=share/doc,lib=lib
--prefix=... ...
A layout can also be stored in a file, currently as a Scheme
association list, which is (read) when one uses the --layout-from
option, as in:
./install-pkg --layout-from ./the-layout --prefix=... ...
There are also some predefined layouts, which can be selected using the
"--layout" option (this option is overloaded right now, but I could
also make two separate options). Currently, I have three predefined
layouts: the default one, called "scsh", which installs things more or
less like in the proposal, except that there are no separate
"installed" and "active" directories; a variant, called "scsh-2",
installs things exactly as in the proposal; the final one, called
"fhs", installs things in an FHS-compatible fashion, as Anthony
suggested.
The idea is that users who install packages use the default layout, and
package managers (Debian, Fink, etc.) use the "fhs" layout. The option
to specify a complete layout on the command line should not be used
often, but is there just in case somebody needs it.
The installation library has also been changed, more or less like I
suggested in my previous e-mail. The function to install a single file
looks as follows:
(install-file <name> <location> <target-dir> <permissions>)
This installs file called <name> in a final directory which is computed
by appending the following parts:
- the installation prefix (--install-prefix option, or --prefix if
absent),
- the entry in the active layout for the given <location>, which can
be "doc", "scheme", "lib", etc.
- the <target-dir>, which must be relative.
The final name of the file will be the same as the original one, except
if <file> is a pair, in which case its CAR is the source file name, and
its CDR is the target name.
For example, if we assume that the user invokes the installation script
for package "foo" v1.2 with the following options:
./install-pkg --prefix /usr/local --layout fhs
and the installation script (pkg-def.scm) contains the following call:
(install-file '("COPYING" . "COPYING.txt") 'doc "license" #o644)
then the file "COPYING" from the current directory will be copied to:
/usr/local/share/doc/foo-1.2/license/COPYING.txt
\________/ \_______________/ \_____/ \_________/
part 1 part 2 part 3 part 4
Part 1 is the prefix, part 2 comes from the "fhs" layout, part 3 is the
<target-dir> and part 4 is the new name of the file.
I have similar functions to install several files, one or several
directories, and the contents of one or several directories.
The code is mostly written and appears to work, but I'd like to test it
a bit more before putting it on the Web page. And I'd also like your
opinion, of course, in particular to know whether this is reasonably
close to what you (Anthony and Martin) expected.
And BTW, I found to my great embarrassment that the package for sunet
which is on my Web page is still incomplete, and ignores some files in
the top-level directory. It should also patch "start-web-server" to
reflect the new location of "packages.scm". I'm really sorry for that,
I should be way more careful, so for the moment please take this
package as a simplistic example.
Michel.
|