#!/bin/bash
#
# This script should make a fine start on getting a new release out of the
# door.
#
# Start this script in the directory you want to release.
# The directory name should be `coda-<version>'.
#
RELEASE=/coda/project/releases
SRPMDIR=/usr/src/redhat/SRPMS
RPMDIR=/usr/src/redhat/RPMS/i386
# stop processing on any errors
set -e
release=1
if [ x$1 = x--snapshot ] ; then
snapshot=1
release=0.`date +"%Y%m%d"`
shift;
fi
# verify the release version
curdir=`basename $PWD`
if [ `echo $curdir | cut -d- -f1` != coda ] ; then
echo $curdir does not look like \"coda-version\"
exit 0
fi
version=`echo $curdir | cut -d- -f2`
fversion=$version
if [ x$snapshot = x1 ] ; then
fversion=$version-$release
fi
reldir=$RELEASE/$version
reltar=$reldir/coda-$fversion.tgz
# create the source tar archive
function create-releasetar () {
# tag the release
reltag=c`echo $version | sed 's/\./_/g'`
if [ x$snapshot = x1 ] ; then
ok=n
else
# check for leftover files
/home/jaharkes/bin/prepare
echo -n "May I tag coda version $version as $reltag? [A/n/y] "
read ok
fi
if [ x$ok = xy -o x$ok = xY ]
then
echo "Tagging source tree (as $USER@sparta.odyssey.cs.cmu.edu)"
cvs tag -F $reltag
elif [ x$ok != xn -a x$ok != xN ]
then
echo Allright, aborting release
exit 0
fi
# setup the release area
if [ ! -d $reldir ]
then
mkdir $reldir
mkdir -p $RELEASE/objs/linux/$version/SRPMS
mkdir -p $RELEASE/objs/linux/$version/i386
mkdir -p $RELEASE/objs/linux/$version/sparc
ln -s ../objs/linux/$version $reldir/linux
fi
# create the sourcetar
ssh root@localhost rm -rf /usr/tmp/coda-$fversion
mkdir -p /usr/tmp/coda-$fversion
echo Copying $curdir to /usr/tmp/coda-$fversion
( tar -cf - . ) | ( cd /usr/tmp/coda-$fversion ; tar -xf - )
echo Setting file ownership
ssh root@localhost chown -R root.root /usr/tmp/coda-$fversion
echo Creating $reltar
( cd /usr/tmp ; tar -czf $reltar coda-$fversion )
echo Cleaning up /usr/tmp/coda-$fversion
ssh root@localhost rm -rf /usr/tmp/coda-$fversion
}
# create the linux-i386 rpm's
function build-linux-i386 () {
if [ x$snapshot = x1 ] ; then
snaparg=--snapshot
fi
echo "Building linux-i386 rpms (as root@$HOSTNAME)"
ssh root@localhost cp $reltar /usr/src/redhat/SOURCES
ssh root@localhost $PWD/tools/build-coda-rpm.pl --version=$version --rel=$release --debug $snaparg < tools/coda.spec.in
ssh root@localhost rpm -ba -v --clean /usr/src/redhat/SPECS/coda-debug-$version-$release.spec
# populate the linux-i386 release area
echo "Copying rpms to $reldir/linux/i386"
cp $SRPMDIR/coda-debug-$version-$release.src.rpm $reldir/linux/SRPMS
cp $RPMDIR/coda-debug-backup-$version-$release.i386.rpm $reldir/linux/i386
cp $RPMDIR/coda-debug-client-$version-$release.i386.rpm $reldir/linux/i386
cp $RPMDIR/coda-debug-server-$version-$release.i386.rpm $reldir/linux/i386
cp $RPMDIR/coda-debug-source-$version-$release.i386.rpm $reldir/linux/i386
}
# create the linux-sparc rpm's
function build-linux-sparc () {
echo "Building linux-sparc rpms (as root@ios)"
scp $reldir/linux/SRPMS/coda-debug-$version-$release.src.rpm root@ios:/usr/src/redhat/SRPMS
ssh root@ios rpm --rebuild -v /usr/src/redhat/SRPMS/coda-debug-$version-$release.src.rpm
# populate the linux-sparc release area
echo "Copying rpms to $reldir/linux/sparc"
scp root@ios:$RPMDIR/coda-debug-backup-$version-$release.sparc.rpm $reldir/linux/sparc
scp root@ios:$RPMDIR/coda-debug-client-$version-$release.sparc.rpm $reldir/linux/sparc
scp root@ios:$RPMDIR/coda-debug-server-$version-$release.sparc.rpm $reldir/linux/sparc
scp root@ios:$RPMDIR/coda-debug-source-$version-$release.sparc.rpm $reldir/linux/sparc
}
#
# this is it..
#
echo $reltar
if [ ! -f $reltar ]
then
create-releasetar
fi
if [ ! -f $reldir/linux/SRPMS/coda-debug-$version-$release.src.rpm ]
then
build-linux-i386
fi
if [ ! -f $reldir/linux/sparc/coda-debug-source-$version-$release.sparc.rpm ]
then
build-linux-sparc
fi
syntax highlighted by Code2HTML, v. 0.9.1