Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 168 lines (137 sloc) 4.41 KB
#!/bin/sh
########################################################################
#
# getpackage
#
# Used when inside a work directory. Figures out the correct version of
# a package for the underlying base release and checks it out from CVS.
# It may make modifications to lib/ or other directories to make ready
# for the release tools (but I hope not).
#
# getpackage is NOT a wrapper over cvs.
#
# Usage:
# 1. cd to your work directory
# 2. getpackage <packageName>
#
# Options
# -h get the HEAD of CVS
# -r TAG get the specificed tag
#
# Assumes:
# o cvs in path
########################################################################
#-----------------------------------------------------------------------
#++ Sanity check: are we in a test release?
if [ ! -r rtConfig ]; then
echo Use from a work directory made by mkworkdir
exit 2
fi
#-----------------------------------------------------------------------
#++ vars
source rtConfig
getHead=0
getTag=0
getAll=0
listAll=0
tagName=""
#-----------------------------------------------------------------------
#++ process options
set -- `getopt alhr: $*`
if [ $? = 0 ]; then
while [ $1 != -- ]
do
case $1 in
-h) getHead=1; getTag=0;;
-r) getTag=1; getHead=0; tagName=$2; shift;;
-a) getAll=1;;
-l) listAll=1;;
esac
shift
done
shift
fi
#-----------------------------------------------------------------------
#++ check for correct number of arguments
#
# having trouble with [, so test is awkward:
if [ $getAll -eq 1 -o $listAll -eq 1 ]; then
if [ "$#" -ne 0 ]; then
echo "Usage: getpackage [-h | -r <tagName>] <PackageName>"
echo " or: getpackage [-a | -l ]"
exit 2
fi
elif [ "$#" -ne 1 ]; then
echo "Usage: getpackage [-h | -r <tagName>] <PackageName>"
echo " or: getpackage [-a | -l ]"
exit 2
else
packageName=$1
fi
#-----------------------------------------------------------------------
#++ Sanity check the release
if [ -z "$RTROOT" ]; then
echo "No RTROOT set"
exit 2
fi
baserel=$RTROOT/dist/releases/$baserelname
if [ ! -r "$baserel" ]; then
echo "No such release: " $baserel
exit 2
fi
packageVersionsFile="$baserel/PackageVersions"
if [ ! -r $packageVersionsFile ]; then
echo Release $baserel lacks a PackageVersions file
exit 2
fi
#-----------------------------------------------------------------------
#++ Easy cases first: -l and -a
if [ $listAll -eq 1 ] ; then
echo "Available packages in release $baserel:"
cat $packageVersionsFile
exit 0
fi
if [ $getAll -eq 1 ] ; then
for pkg in `awk '{print $1 }' $packageVersionsFile` ; do
echo getting $pkg
$0 $pkg
done
exit 0
fi
#-----------------------------------------------------------------------
#++ Makesure the package is not already checked out
if [ -r $packageName ]; then
echo $packageName already exists
exit 2
fi
#-----------------------------------------------------------------------
#++ Get package version from release
#-----------------------------------------------------------------------
if [ ! -r "$baserel/$packageName" ]; then
echo Package $packageName not in the release
exit 2
fi
packageVer=`grep $packageName $packageVersionsFile | awk '{print $2}'`
if [ -z "$packageVer" ]; then
echo No version information for $packageName in $packageVersionsFile
exit 2
fi
#-----------------------------------------------------------------------
#++ Get package if HEAD or TAG
if [ $getTag -eq 1 ]; then
echo overriding release version $packageVer with tag $tagName
cvs co -r $tagName $packageName
elif [ $getHead -eq 1 ]; then
echo echo overriding release version $packageVer with HEAD of CVS
cvs co -r HEAD $packageName
else
cvs co -r $packageVer $packageName
fi
#-----------------------------------------------------------------------
#++ Tune up the release area. The tmp directory per pkg is for putting temp
# files made during build, e.g., .o files, lexx output. The source
# dir is read only (parallel builds on multiple architectures).
# The per pkg dir under lib is to hold "compiled" python code and the like.
mkdir tmp/$RTARCH/$packageName
mkdir lib/$RTARCH/$packageName
exit 0
Something went wrong with that request. Please try again.