I don't know if there are any build from scratch scripts out there, I am sure there is because of the nightly build process. I wanted a script that pulls everything from scratch and does a full build so I can test that occasionally for myself.

Attached (hopefully) is a shell script. I've only tested it in cygwin but it should work fine in any sh compatible *nix. (The script is very simple and anyone with minimal shell experience can easily tweak this)

When you run this script it will create a subdirectory called "buildtc5" and use that as a starting point for pulling everything from cvs and use the "download" task to put everything in buildtc5/includes as well as the checkout task to pull the rest of the source dependences. The only prerequisites to running the script are
- JAVA_HOME must be defined and you need jdk1.4
- ANT_HOME must be defined
- cvs must be in your PATH


WARNING: This script uses the anonymous cvs to pull everything and tries to append to $HOME/.cvspass the anonymous userid password combo.


Summary: to build tc5 from source - plop the attachment in some empty directory - run it and wait - to clean up - "rm -fr buildtc5"


-Tim


#!/bin/sh
########################################
# This works with jdk 1.4 only
# Before running - you need the following environment variables
#
# JAVA_HOME - Uor java installation
# ANT_HOME - Where ANT is located
#
# Ant might also need the Netcomponents.jar or whatever
# jar is needed to allow the ftp (or get?) task to work.
#
# If you have a proxy server then I have no clue.
########################################
cygwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
esac


# Check for JAVA_HOME
if [ "Z" = "Z$JAVA_HOME" ] ;
then
   echo "Where is JAVA_HOME!"
   exit 1
fi

# Check for ANT_HOME
if [ "Z" = "Z$ANT_HOME" ] ;
then
   echo "Where is ANT_HOME!"
   exit 1
fi


# Check for ANT_HOME
if [ "Z" = "Z$ANT_HOME" ] ;
then
   echo "Where is ANT_HOME!"
   exit 1
fi

############################################
# Woo hoo - The environment looks right
############################################
echo "Using ANT_HOME=$ANT_HOME"
echo "Using JAVA_HOME=$JAVA_HOME"
echo "Putting everything in `pwd`/buildtc5"
echo "Downloaded dependencies go into `pwd`/buildtc5/includes"


mkdir -p buildtc5/includes
if [ 0 != $? ];
then
        echo "making subdirs failed!"
        exit 1
fi

BASE_PATH=`pwd`/buildtc5/includes
if $cygwin; then
  BASE_PATH=`cygpath --path --windows "$BASE_PATH"`
fi


cd buildtc5

echo "Getting jakarta-tomcat-5"

############################################################
# Sad attempt to automagically log you into CVS so
# you can use cvs
############################################################
grep 'pserver:[EMAIL PROTECTED]' $HOME/.cvspass >>/dev/null

if [ 0 != $? ];
then
  echo "Altering  $HOME/.cvspass so you are logged in!"
  echo ':pserver:[EMAIL PROTECTED]:/home/cvspublic Ay=0=h<Z' >> $HOME/.cvspass
fi

cvs -q -d :pserver:[EMAIL PROTECTED]:/home/cvspublic co jakarta-tomcat-5

if [ 0 != $? ];
then
  echo "Checkout failed. Hopefully there is a reason above."
  exit 1
fi


cd jakarta-tomcat-5

###############################################################
# Create build.properties so we have the correct base path
###############################################################
echo "base.path=$BASE_PATH" > build.properties

$ANT_HOME/bin/ant download checkout deploy

if [ 0 != $? ];
then
  echo "Dammit! Build failed. Hopefully there is a reason above."
  exit 1
fi

echo "All done! Hopefully all is well."

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to