sidai-vwrapper (was Re: development/staging/production)
Matt Holgate <[email protected]>
| Newsgroups | gmane.comp.sysutils.ark.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Just thought I'd let you know about my "vwrapper" (version wrapper)
stuff that I checked in a few weeks ago, but forgot to announce on the
mailing list.
It's kind of related to Harlan's development/staging/production point in
that it allows a number of different versions of a particular tool to
coexist on the system and allows different users to use different versions
transparently. This is handy for a number of situations:
* testing new versions of software before making them generally available
* to use freeze a project by insisting on a particular version of a tool,
to prevent the tool changing "under your feet" when it comes to release
time.
So for instance, with coreBulder (from Synopsys' SRT hardware design
package), you can do:
sli4523:/home/mholgate: coreBuilder --show-versions
Versions of coreBuilder available:
2000_10_25
2001_01_30
and
sli4523:/home/mholgate: coreBuilder --use-version=2000_10_25
and the correct version will be invoked. It can be conceived that this
would be used in a Makefile to ensure that every developer in a project
uses the same set of tools.
In addition, you can have a ~/.wrapperrc file which specifies default
versions of packages to use, which is more use when manually invoking
tools:
synopsys-srt=2000_10_25
gcc=2.95.2
textutils=4.0z
There is also an equivalent site wide file.
Vwrapper it takes advantage of the fact that the Sidai Way of handling
packages is to have a deployment directory with a name containing the
version of the package eg:
/.-ark-deploy/synopsys-srt--2000_10_25
/.-ark-deploy/synopsys-srt--2001_01_30
It generates a wrapper for each executable which simply invokes the
correct version of the real tool.
The actual code for the wrapper is in the sidai-vwrapper package, while
the ark-vwrapped proto-package is used for packages that wish to use the
wrapper. So for gnu ls (a silly example!), you might have the following
packages:
fileutils--4.0z
fileutils--4.1
which are standard ARK packages, but are only deployed and not revealed.
You would also have a
fileutils-wrapper
package, which would have ark-vwrapper as a prototype and would simply
generate a wrapper script for all the binaries in fileutils (including
ls). (See below). These would be revealed in place of the real binary.
So you would have:
/our/bin/gls (wrapper script from fileutils-wrapper package)
and
/.-ark-deploy/fileutils--4.0z/bin/gls
/.-ark-deploy/fileutils--4.1/bin/gls
(real binaries from the fileutils--4.0z and fileutils--4.1 packages).
I know this explained badly, but I'm about to fall asleep at the
keyboard, so I'm making no sense whatsoever please let me know ;-)
Matt
#!/usr/bin/env python
# Autogenerated Sidai-style version wrapper for:
# bin/gls
# in package:
# fileutils
#
import sys
sys.path.append("/our/lib/sidai-vwrapper")
import wrapper
SYSADMIN = "[email protected]"
DEPLOY_DIR = "/.-ark-deploy"
GLOBAL_CONF = "/our/lib/sidai-vwrapper/default-fileutils"
USER_CONF = "~/.wrapperrc"
EXECUTABLE = "bin/ls"
PACKAGE = "fileutils"
try:
wrapper.wrap( sys.argv, EXECUTABLE, PACKAGE,
DEPLOY_DIR, GLOBAL_CONF, USER_CONF )
except wrapper.ExitSuccess, e:
sys.exit( 0 )
except wrapper.ExitFailure, e:
sys.stderr.write( '[wrapper] %s\n' % e )
sys.stderr.write( 'If you did not expect this error, please contact '
+
SYSADMIN + '.\n' )
sys.exit( 99 )