[[http://www.sourcemage.org/|Source Mage GNU/Linux]] Versioning
Draft 0.1
Here is the proposed implementation of versioning by David Brown, Ben Ford, and Eric Sandall.
Grimoire Layout
Spell structure
$SECTION_DIRECTORY/$SPELL/
files for current version and that apply to other versions
branch #1/
files for current version of branch that apply to other versions #1
version #1/
files specific to version #1
version #2/
files specific to version #2
branch #2/
files for current version of branch that apply to other versions #2
version #1/
files specific to version #1
version #2/
viles specific to version #2
etc.
Example Versioned Spell - kernels/linux
Here is an example spell using kernels/linux for versioning.
kernels/linux
DETAILS : default to current 2.x.x kernel (pick one, most likely 2.6.x kernel)
CONFIGURE : for all versions
DEPENDS : for all versions
INSTALL : for all versions
FINAL : for all versions
2.6/
10/
DETAILS : for older 2.6.10 kernel
9/
DETAILS : for older 2.6.9 kernel
etc...
2.4/
DETAILS : for current 2.4.x kernel
CONFIGURE : for 2.4.x kernels
28/
DETAILS : for older 2.4.28 version of kernel
27/
DETAILS : for older 2.4.27 version of kernel
etc...
2.2/
DETAILS : for current 2.2.x kernel
CONFIGURE : for 2.2.x kernels
25/
DETAILS : for older 2.2.25 kernel
etc...
2.0/
DETAILS : for current 2.0.x kernel
39/
DETAILS : for old 2.0.39 kenrnel
CONFLICTS : for old 2.0.39 kernel
etc...
Example Versioned Spell - libs/apr
Here is an example spell using libs/apr for versioning. The "structure" is layed out in the order that it would be checked via Sorcery (e.g. the "current" is used by default and so checked first ($SPELL/), and then the next versions in a decrementing pattern (going older as we go down)).
libs/apr
DETAILS : for 0.9.6 (the default version we want). This contains a normal DETAILS for apr set to 0.9.6
CONFIGURE : for all versions
DEPENDS : for almost all versions
BUILD : that works for almost all versions
INSTALL : for 0.9.6 and cvs
FINAL : for 0.9.6 version
TRIGGERS : for all versions
0.9/
5/
DETAILS : for 0.9.5 (older version of apr)
1.1/
DETAILS : for 1.1.0 (contains VERSION, MD5[0], and REPOS_URI only)
INSTALL : for 1.1.x
FINAL : for 1.1.x version
1.0/
DETAILS : for 1.0.1 (contains VERSION, MD5[0], and REPOS_URI only)
INSTALL : for 1.0.x
FINAL : for 1.0.x version
cvs/
DETAILS : for 1.1.0 (contains VERSION, MD5[0], and SOURCE_URL[0] only)
DEPENDS : for cvs version (includes python and SVN)
BUILD : that works with CVS (e.g. needs to run ./buildconf). Here we could run ./buildconf and then source $SECTION_DIRECTORY/$SPELL/BUILD for the "default BUILD" for apr
DEPENDS
Based on mathematical expression order.
Simple: <spell> will always be to the left of <version> for simple cases.
depends <spell>[/<branch>[/<version>]]
optional_depends <spell>[/<branch>[/<version>]]
Ranged: <operator> -> '<' | '<=' | '>' | '>=' | '==' | '!='
depends [branch[/version]<operator>]<spell>[<operator>branch[/version]]
eg.
depends <spell><<branch>
depends <branch>/<version><<spell>
depends <branch><=<spell>
depends <branch>/<version><=<spell><=<branch>
optional_depends <branch><<spell><=<branch>/<version>
Exclusionary: <spell> will always be on the left and <version> on the right for exclusionary checks.
depends <spell>!=<version>
depends <spell>==<version>
optional_depends <spell>!=<version>
Example of dependencies
depends zlib &&
depends 1.4<=automake<=1.9/5 &&
depends apr=>1.1 &&
depends gcc<=3.3/3 &&
depends linux!=2.6 &&
optional_depends 1.0<=firefox
This package would depend on the default zlib, any automake from 1.4 branch to 1.9.5, any apr of in the 1.1 branch, any gcc that's 3.3.3 or older, and any linux kernel version except 2.6 branch while optionally depending on any version of firefox 1.0 or newer.
CONFLICTS
CONFLICTS will have the same syntax (except for there is no optional_conflicts) as DEPENDS.
Example of conflicts
conflicts 1.0<=apr &&
conflicts gcc==3.4
This package would conflict with any apr of 1.0 branch or newer and gcc 3.4 branch only.
PROVIDES
Most cases of provides will be gone. No more. Cease to be. Providers of alternate spell versions (e.g. providers of APACHE) will now be done via depends and versioning, not provides.
Other cases of provides (two or more distinct packages (e.g. mozilla and nss) provide the same thing (e.g. NSS)).
CONFLICTS
Most conflicts from versioning could be removed, however, conflicts for the same spell (e.g. qt-x11 cannot be compiled while it is also installed) would be retained.
Sorcery Setup
We will use a new api for versioning support. The targetted build_api is "3".
Casting a Spell Differentiation
<spell> Will be the default spell in $SECTION_DIRECTORY/$SPELL
- # cast apr
<spell>/<branch> Will be the branch of <spell> in $SECTION_DIRECTORY/$SPELL/<branch>
If <spell>/<branch> doesn't exist it is the same as if <spell> doesn't exist
If any spell file (e.g. INSTALL BUILD CONFLICTS DETAILS) are not found in the $SECTION_DIRECTORY/$SPELL/<branch> directory files in the $SECTION_DIRECTORY/$SPELL directory will be used else default actions will be taken
- # cast apr/1.0
<spell>/<branch>/<version> Will be the version of <spell> in $SECTION_DIRECTORY/$SPELL/<branch>/<version>
If <spell>/<branch>/<version> doesn't exist it is the same as if <spell> doesn't exist
If any spell file (e.g. INSTALL BUILD CONFLICTS DETAILS) are not found in the $SECTION_DIRECTORY/$SPELL/<branch>/<version> directory the files in $SECTION_DIRECTORY/$SPELL/<branch> will be used and if the files are not found there files in the $SECTION_DIRECTORY/$SPELL directory will be used else default actions will be taken
- # cast apr/0.9/6
default_build
Needs to have a spell install to <location>/<spell>/<version> for all directories (except $INSTALL_ROOT/bin)).
Example default_build
function real_default_build() { debug "build_api/api3" "real_default_build"
{{{ OPTS="$OPTS --build=${BUILD}"
- #If these switches are used, they _may_ stop distcc and ccache from working # for some spells (bug 3798) # We could write wrappers for all of the possible binaries
$CROSS_INSTALL == on && OPTS="$OPTS --host=${HOST}"}}}
./configure --prefix=${INSTALL_ROOT}/usr \\
--datadir=${INSTALL_ROOT}/usr/share/$SPELL/$VERSION \\
--sysconfdir=${INSTALL_ROOT}/etc/$SPELL/$VERSION \\
--localstatedir=${INSTALL_ROOT}/var/$SPELL/$VERSION \\
--oldincludedir=${INSTALL_ROOT}/usr/include/$SPELL/$VERSION \\
--includedir=${INSTALL_ROOT}/usr/include/$SPELL/$VERSION \\
--libdir=${INSTALL_ROOT}/usr/lib/$SPELL/$VERSION \\
--mandir=${INSTALL_ROOT}/usr/share/$SPELL/$VERSION/man \\
--infodir=${INSTALL_ROOT}/usr/share/$SPELL/$VERSION/info \\
--program-suffix=$VERSION \\
$OPTS &&
make
}
Note that this default_build does not fix any binaries to have -$VERSION appended to them. We'll need a way to work around this. Until a better method is available (no-dispel/tmp_root?) then we may have to use --bindir and --sbindir to specify $INSTALL_ROOT/{dir}/$SPELL/$VERSION and then have check_bin create the symlinks like the other check_* functions do.
Example of installed files after default_install only - libs/apr
/usr/bin/apr-config-0.9.6
/usr/include/apr/0.9.6/
/usr/include/apr/0.9.6/apr.h
/usr/include/apr/0.9.6/apr_allocator.h
...
/usr/include/apr/0.9.6/apr_version.h
/usr/include/apr/0.9.6/apr_want.h
/usr/lib/apr/0.9.6/apr.exp
/usr/lib/apr/0.9.6/libapr.a
/usr/lib/apr/0.9.6/libapr.la
/usr/lib/apr/0.9.6/libapr.so
/usr/lib/apr/0.9.6/libapr.so.0
/usr/lib/apr/0.9.6/libapr.so.0.9.6
/usr/share/apache2/build/apr/0.9.6/PrintPath
/usr/share/apache2/build/apr/0.9.6/apr_common.m4
...
/usr/share/apache2/build/apr/0.9.6/make_var_export.awk
/usr/share/apache2/build/apr/0.9.6/mkdir.sh
check_libs
check_includes
check_bin
check_docs
default_post_install
Needs to run:
check_libs $SPELL &&
check_includes $SPELL &&
check_bin $SPELL &&
check_docs $SPELL &&
default_post_remove
Needs to run:
check_libs $SPELL &&
check_includes $SPELL &&
check_bin $SPELL &&
check_docs $SPELL &&
Examples of what installation would look like after FINAL
Example installed package - libs/apr
/usr/bin/apr-config-0.9.6
/usr/bin/apr-config -> /usr/bin/apr-config-0.9.6
/usr/include/apr/0.9.6/
/usr/include/apr/0.9.6/apr.h
/usr/include/apr/0.9.6/apr_allocator.h
...
/usr/include/apr/0.9.6/apr_version.h
/usr/include/apr/0.9.6/apr_want.h
/usr/include/apr/apr.h -> /usr/include/apr/0.9.6/apr.h
/usr/include/apr/apr_allocator.h -> /usr/include/apr/0.9.6/apr_allocator.h
...
/usr/include/apr/apr_version.h -> /usr/include/apr/0.9.6/apr_version.h
/usr/include/apr/apr_want.h -> /usr/include/apr/0.9.6/apr_want.h
/usr/lib/apr/0.9.6/apr.exp
/usr/lib/apr/0.9.6/libapr.a
/usr/lib/apr/0.9.6/libapr.la
/usr/lib/apr/0.9.6/libapr.so
/usr/lib/apr/0.9.6/libapr.so.0
/usr/lib/apr/0.9.6/libapr.so.0.9.6
/usr/lib/apr.exp -> /usr/lib/apr/0.9.6/apr.exp
/usr/lib/libapr.a -> /usr/lib/apr/0.9.6/libapr.a
/usr/lib/libapr.la -> /usr/lib/apr/0.9.6/libapr.la
/usr/lib/libapr.so -> /usr/lib/apr/0.9.6/libapr.so
/usr/lib/libapr.so.0 -> /usr/lib/apr/0.9.6/libapr.so.0
/usr/lib/libapr.so.0.9.6 -> /usr/lib/apr/0.9.6/libapr.so.0.9.6
/usr/share/apache2/build/apr/0.9.6/PrintPath
/usr/share/apache2/build/apr/0.9.6/apr_common.m4
...
/usr/share/apache2/build/apr/0.9.6/make_var_export.awk
/usr/share/apache2/build/apr/0.9.6/mkdir.sh
/usr/share/apache2/build/PrintPath -> /usr/share/apache2/build/apr/0.9.6/PrintPath
/usr/share/apache2/build/apr_common.m4 -> /usr/share/apache2/build/apr/0.9.6/apr_common.m4
...
/usr/share/apache2/build/make_var_export.awk -> /usr/share/apache2/build/apr/0.9.6/make_var_export.awk
/usr/share/apache2/build/mkdir.sh -> /usr/share/apache2/build/apr/0.9.6/mkdir.sh
Example installed package - libs/apr/1.1.0 with libs/apr still installed
/usr/bin/apr-config-1.1.0
/usr/bin/apr-config -> /usr/bin/apr-config-1.1.0
/usr/include/apr/1.1.0/
/usr/include/apr/1.1.0/apr.h
/usr/include/apr/1.1.0/apr_allocator.h
...
/usr/include/apr/1.1.0/apr_version.h
/usr/include/apr/1.1.0/apr_want.h
/usr/include/apr/apr.h -> /usr/include/apr/1.1.0/apr.h
/usr/include/apr/apr_allocator.h -> /usr/include/apr/1.1.0/apr_allocator.h
...
/usr/include/apr/apr_version.h -> /usr/include/apr/1.1.0/apr_version.h
/usr/include/apr/apr_want.h -> /usr/include/apr/1.1.0/apr_want.h
- Note that all of the headers in /usr/include/apr are replaced by the new version as headers are not versioned
...
/usr/lib/apr/1.1.0/apr.exp
/usr/lib/apr/1.1.0/libapr.a
/usr/lib/apr/1.1.0/libapr.la
/usr/lib/apr/1.1.0/libapr.so
/usr/lib/apr/1.1.0/libapr.so.1
/usr/lib/apr/1.1.0/libapr.so.1.1.0
/usr/lib/apr.exp -> /usr/lib/apr/1.1.0/apr.exp
/usr/lib/libapr.a -> /usr/lib/apr/1.1.0/libapr.a
/usr/lib/libapr.la -> /usr/lib/apr/1.1.0/libapr.la
/usr/lib/libapr.so -> /usr/lib/apr/1.1.0/libapr.so
/usr/lib/libapr.so.1 -> /usr/lib/apr/1.1.0/libapr.so.1
/usr/lib/libapr.so.1.1.0 -> /usr/lib/apr/1.1.0/libapr.so.1.1.0
- Note that /usr/lib/libapr.so.0 and /usr/lib/libapr.so.0.9.6 were not removed/overwritten
...
/usr/share/apache2/build/apr/1.1.0/PrintPath
/usr/share/apache2/build/apr/1.1.0/apr_common.m4
...
/usr/share/apache2/build/apr/1.1.0/make_var_export.awk
/usr/share/apache2/build/apr/1.1.0/mkdir.sh
/usr/share/apache2/build/PrintPath -> /usr/share/apache2/build/apr/1.1.0/PrintPath
/usr/share/apache2/build/apr_common.m4 -> /usr/share/apache2/build/apr/1.1.0/apr_common.m4
...
/usr/share/apache2/build/make_var_export.awk -> /usr/share/apache2/build/apr/1.1.0/make_var_export.awk
/usr/share/apache2/build/mkdir.sh -> /usr/share/apache2/build/apr/1.1.0/mkdir.sh
Example installed package - libs/apr/1.0.1 with libs/apr and libs/apr/1.1.0 still installed
/usr/bin/apr-config-1.0.1
/usr/bin/apr-config -> /usr/bin/apr-config-1.0.1
/usr/include/apr/1.0.1/
/usr/include/apr/1.0.1/apr.h
/usr/include/apr/1.0.1/apr_allocator.h
...
/usr/include/apr/1.0.1/apr_version.h
/usr/include/apr/1.0.1/apr_want.h
- Note that none of the non-versioned files in /usr/include/apr were replaced as they're owned by a newer version (apr/1.1.0)
...
/usr/lib/apr/1.0.1/apr.exp
/usr/lib/apr/1.0.1/libapr.a
/usr/lib/apr/1.0.1/libapr.la
/usr/lib/apr/1.0.1/libapr.so
/usr/lib/apr/1.0.1/libapr.so.1
/usr/lib/apr/1.0.1/libapr.so.1.0.1
/usr/lib/libapr.so.1.0.1 -> /usr/lib/apr/1.0.1/libapr.so.1.0.1
- Note that only files not owned by a newer version (apr/1.1.0) were replaced
...
/usr/share/apache2/build/apr/1.0.1/PrintPath
/usr/share/apache2/build/apr/1.0.1/apr_common.m4
...
/usr/share/apache2/build/apr/1.0.1/make_var_export.awk
/usr/share/apache2/build/apr/1.0.1/mkdir.sh
