| #!/bin/sh |
| # |
| # ptpbuild wrapper script |
| # |
| # Usage: ptpbuild [-t tag] [-d build_dir] [build_args] |
| # |
| # where |
| # |
| # tag is the CVS tag used to check out the releng project (default HEAD) |
| # build_dir is the location that the build will take place |
| # build_args are any arguments you want to pass to the build script |
| # |
| # set up anything environment specific that needs to be done before |
| # launching the build script in the releng project |
| |
| LANG=en_US |
| TAG=HEAD |
| CDT_TAG=HEAD |
| VERBOSE=false |
| |
| # main staging directory |
| BUILD_DIR=/opt/public/download-staging.priv/tools/ptp/releng |
| |
| args=`getopt vc:d:t: $*` |
| |
| if [ $? != 0 ]; then |
| echo "usage: ptpbuild [-v] [-t tag] [-c cdt_tag] [-d build_dir] [build_args]" |
| exit 1 |
| fi |
| |
| set -- $args |
| for i |
| do |
| case "$i" |
| in |
| -v) VERBOSE=true; shift;; |
| -c) CDT_TAG="$2"; shift; shift;; |
| -d) BUILD_DIR="$2"; shift; shift;; |
| -t) TAG="$2"; shift; shift;; |
| --) shift; break;; |
| esac |
| done |
| |
| BUILD_LOG=$BUILD_DIR/ptpbuild_${TAG}_`date +%Y%m%d%H%M`.log |
| |
| touch $BUILD_LOG |
| chmod a+r $BUILD_LOG |
| |
| do_build() { |
| # create the releng staging directory and go there |
| mkdir -p $1 && cd $1 |
| |
| # remove the old build |
| rm -fr org.eclipse.ptp_${2} |
| |
| # Check out the releng project |
| cvs -d /cvsroot/tools co -r $2 -d org.eclipse.ptp_${2} org.eclipse.ptp/releng/org.eclipse.ptp.releng |
| |
| # run the main script |
| cd org.eclipse.ptp_${2} |
| sh build.sh $3 |
| } |
| |
| if [ $VERBOSE = true ]; then |
| do_build $BUILD_DIR $TAG "$*" 2>&1 | tee $BUILD_LOG |
| else |
| do_build $BUILD_DIR $TAG "$*" > $BUILD_LOG 2>&1 |
| fi |
| |
| if grep -q 'BUILD FAILED' $BUILD_LOG; then |
| echo "BUILD FAILED. See $BUILD_LOG for details." |
| fi |
| |
| exit 0 |