- export CVS_RSH
[build.git] / build.sh
1 #!/bin/bash
2 #
3 # PlanetLab release build script. Intended to be used by scripts and
4 # crontabs to build nightly releases (default). Can also be invoked
5 # manually to build a tagged release (-r) in the current directory.
6 #
7 # $Id: build.sh,v 1.3 2004/05/26 18:44:50 mlh-pl_rpm Exp $
8 #
9
10 # Set defaults
11 CVSROOT=pup-pl_rpm@cvs.planet-lab.org:/cvs
12 CVS_RSH=ssh
13 MODULE=rpm
14 TAG=HEAD
15
16 # Export certain variables
17 export CVS_RSH
18
19 # Get options
20 while getopts "d:r:" opt ; do
21     case $opt in
22         d)
23             CVSROOT=$OPTARG
24             ;;
25         r)
26             TAG=$OPTARG
27             ;;
28         *)
29             echo "usage: `basename $0` [-d $CVSROOT] [-r $TAG]"
30             exit 1
31             ;;
32     esac
33 done
34
35 # Create a unique build base
36 BASE=${TAG/HEAD/`date +%Y.%m.%d`}
37 i=
38 while ! mkdir ${BASE}${i} 2>/dev/null ; do
39     [ -z ${i} ] && BASE=${BASE}.
40     i=$((${i}+1))
41     if [ $i -gt 100 ] ; then
42         echo "$0: Failed to create release directory `pwd`/${BASE}${i}"
43         exit 1
44     fi
45 done
46 BASE=${BASE}${i}
47
48 # Redirect both stdout and stderr to log file
49 exec &>${BASE}/log
50
51 # Build
52 cvs -d ${CVSROOT} export -r ${TAG} -d ${BASE} ${MODULE}
53 make -C ${BASE}