There are cases where a spell writer wants to allow a choice of version in a spell. Most of the times this is about pulling the current version from a source code management system like CVS, Subversion, Git, Mercurial, etc. There are other cases where an upstream project releases "stable" and "development" versions.
First rule for allowing such a version choice is that all dependencies of the spell need to work with all versions, otherwise the spell should be split.
The version choice is done in PREPARE using the usual config_query* functions. If there are more than two different versions to choose from, this should be done using config_query_list, always defaulting to the version upstream recommends as "stable":
config_query_list FVWM_RELEASE "Which release would you like to build?" stable unstable cvs
If there are only two versions, an alternative would be to do a single query for the unstable/cvs version:
config_query MPLAYER_CVS "Build CVS version?" n
For versions downloading from a source code management system, the spell should also ask the user whether he wants to update that spell automatically on every sorcery system-update or sorcery queue:
if [[ "${FVWM_RELEASE}" == "cvs" ]]; then
config_query FVWM_CVS_AUTOUPDATE "Update on every system update?" n
fiThe actual multiversion handling is done in DETAILS:
SPELL=mplayer
if [ "$MPLAYER_CVS" == "y" ]; then
if [ "$MPLAYER_CVS_AUTOUPDATE" == "y" ]; then
VERSION=$(date +%Y%m%d)
else
VERSION=cvs
fi
SOURCE=$SPELL-cvs.tar.bz2
SOURCE_URL[0]=cvs://:pserver:anonymous@mplayerhq.hu:/cvsroot/mplayer:main
SOURCE_IGNORE=volatile
FORCE_DOWNLOAD=on
SOURCE_DIRECTORY="$BUILD_DIRECTORY/$SPELL-cvs"
else
VERSION=1.0pre7try2
SOURCE=MPlayer-$VERSION.tar.bz2
SOURCE_URL[0]=ftp://ftp1.mplayerhq.hu/MPlayer/releases/$SOURCE
SOURCE_HASH=sha1:dcaced128167f15d094c9b63ca8b3dfd8f583e32
SOURCE_DIRECTORY="$BUILD_DIRECTORY/MPlayer-$VERSION"
fi
WEB_SITE=http://www.mplayerhq.hu