2004-04-09 00:27:28 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2004-04-09 19:56:23 -04:00
|
|
|
# ----------------------------------------------------------------------------------
|
|
|
|
|
2004-04-10 14:29:46 -04:00
|
|
|
CMD=$1
|
|
|
|
|
2004-07-17 21:22:49 -04:00
|
|
|
[ "$1" = "" ] && echo && echo "You must specify a checkout or update!" && echo && exit 1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 23:27:04 -04:00
|
|
|
HOME_DIR=`pwd`
|
|
|
|
DATE=`date`
|
2004-06-15 23:28:50 -04:00
|
|
|
DIR=m2-build
|
2004-04-09 00:27:28 -04:00
|
|
|
REPO=maven-repo-local
|
2004-09-02 09:24:19 -04:00
|
|
|
FROM=jvanzyl@maven.org
|
|
|
|
#FROM=brett@apache.org
|
2004-05-08 08:45:44 -04:00
|
|
|
#TO=maven2-user@lists.codehaus.org
|
2004-06-03 15:04:44 -04:00
|
|
|
TO=m2-dev@maven.apache.org
|
2004-04-10 14:29:46 -04:00
|
|
|
SCM_LOG=scm.log
|
2004-09-20 01:13:19 -04:00
|
|
|
TIMESTAMP=`date +%Y%m%d.%H%M%S`
|
2004-04-10 23:27:04 -04:00
|
|
|
DEPLOY_DIR=$HOME_DIR/public_html/m2
|
2004-09-18 22:16:57 -04:00
|
|
|
DEPLOY_SITE=http://www.codehaus.org/~maven/m2
|
2004-09-18 21:18:12 -04:00
|
|
|
DIST=m2-${TIMESTAMP}.tar.gz
|
2004-04-09 10:11:57 -04:00
|
|
|
|
2004-09-02 09:14:47 -04:00
|
|
|
export JAVA_HOME=/usr/local/java
|
2004-09-02 09:24:19 -04:00
|
|
|
# Required until classworlds.conf is updated
|
|
|
|
#export M2_HOME=$HOME_DIR/m2
|
|
|
|
export M2_HOME=$HOME/m2
|
2004-09-02 09:14:47 -04:00
|
|
|
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
|
2004-09-18 14:45:50 -04:00
|
|
|
export MESSAGE_DIR=$HOME_DIR/public_html/m2-build-logs
|
|
|
|
export MESSAGE_NAME=m2-build-log-${TIMESTAMP}.txt
|
|
|
|
export MESSAGE=${MESSAGE_DIR}/${MESSAGE_NAME}
|
2004-09-02 09:14:47 -04:00
|
|
|
|
2004-07-28 02:10:48 -04:00
|
|
|
# ----------------------------------------------------------------------------------
|
2004-04-09 10:11:57 -04:00
|
|
|
|
|
|
|
# Wipe out the working directory and the repository and start entirely
|
|
|
|
# from scratch.
|
2004-04-09 00:27:28 -04:00
|
|
|
|
2004-04-09 10:11:57 -04:00
|
|
|
# ----------------------------------------------------------------------------------
|
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
export CVSROOT=:pserver:anoncvs@cvs.apache.org:/home/cvspublic
|
2004-04-09 00:27:28 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
(
|
|
|
|
if [ "$CMD" = "checkout" ]
|
|
|
|
then
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
rm -rf $DIR > /dev/null 2>&1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
mkdir $DIR
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
rm -rf $REPO > /dev/null 2>&1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
mkdir $REPO
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Performing a clean check out of maven-components ..."
|
|
|
|
echo
|
|
|
|
|
|
|
|
(
|
|
|
|
cd $DIR
|
|
|
|
|
2004-04-10 14:42:24 -04:00
|
|
|
cvs co maven-components > $HOME_DIR/$SCM_LOG 2>&1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
echo "true" > $HOME_DIR/build_required
|
|
|
|
)
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
else
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
echo
|
|
|
|
echo "Performing an update of maven-components ..."
|
|
|
|
echo
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
(
|
|
|
|
cd $DIR/maven-components
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
cvs update -dP > $HOME_DIR/$SCM_LOG 2>&1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
grep ^P $HOME_DIR/$SCM_LOG > /dev/null 2>&1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
if [ "$?" = "1" ]
|
|
|
|
then
|
|
|
|
|
|
|
|
echo "false" > $HOME_DIR/build_required
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 14:42:24 -04:00
|
|
|
else
|
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
echo "true" > $HOME_DIR/build_required
|
2004-04-10 14:42:24 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
fi
|
2004-04-09 00:27:28 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
)
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-04-10 15:01:31 -04:00
|
|
|
fi
|
2004-04-10 14:29:46 -04:00
|
|
|
|
|
|
|
BUILD_REQUIRED=`cat $HOME_DIR/build_required`
|
|
|
|
|
|
|
|
if [ "$BUILD_REQUIRED" = "true" ]
|
|
|
|
then
|
|
|
|
|
2004-04-10 14:48:13 -04:00
|
|
|
echo "Updates occured, build required ..."
|
|
|
|
echo
|
|
|
|
grep ^P $HOME_DIR/$SCM_LOG
|
|
|
|
echo
|
|
|
|
|
2004-04-10 14:29:46 -04:00
|
|
|
(
|
2004-07-27 13:37:07 -04:00
|
|
|
cd $DIR/maven-components
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2004-09-02 09:14:47 -04:00
|
|
|
sh m2-bootstrap-all.sh -Dmaven.repo.local="$HOME_DIR/$REPO" -Dmaven.home="$M2_HOME"
|
2004-09-18 21:18:12 -04:00
|
|
|
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
|
2004-04-10 15:19:09 -04:00
|
|
|
)
|
2004-09-18 21:18:12 -04:00
|
|
|
ret=$?; if [ $ret != 0 ]; then exit $ret; fi
|
2004-04-10 18:04:27 -04:00
|
|
|
|
2004-09-18 21:18:12 -04:00
|
|
|
# Only created on success
|
2004-04-10 23:39:14 -04:00
|
|
|
|
2004-04-10 18:04:27 -04:00
|
|
|
echo
|
2004-04-10 23:39:14 -04:00
|
|
|
echo "Creating m2 distribution for public consumption: ${DEPLOY_SITE}/${DIST}"
|
2004-04-10 18:04:27 -04:00
|
|
|
echo
|
2004-08-11 16:38:32 -04:00
|
|
|
|
|
|
|
mkdir -p $DEPLOY_DIR > /dev/null 2>&1
|
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
# Assumes pwd is still $HOME_DIR
|
2004-08-11 16:38:32 -04:00
|
|
|
tar czf $DEPLOY_DIR/$DIST m2
|
2004-04-10 15:19:09 -04:00
|
|
|
|
2004-04-10 14:29:46 -04:00
|
|
|
else
|
|
|
|
|
2004-04-10 14:48:13 -04:00
|
|
|
echo "No updates occured, no build required. Done."
|
2004-04-10 14:29:46 -04:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2004-09-18 14:45:50 -04:00
|
|
|
) >> $MESSAGE 2>&1
|
2004-09-18 21:18:12 -04:00
|
|
|
ret=$?
|
2004-04-09 00:27:28 -04:00
|
|
|
|
2004-04-11 12:31:25 -04:00
|
|
|
BUILD_REQUIRED=`cat $HOME_DIR/build_required`
|
|
|
|
|
|
|
|
# Only send mail to the list if a build was required.
|
|
|
|
|
2004-06-28 00:38:37 -04:00
|
|
|
host=`hostname`
|
|
|
|
|
2004-04-11 12:31:25 -04:00
|
|
|
if [ "$BUILD_REQUIRED" = "true" ]
|
|
|
|
then
|
2004-09-18 21:18:12 -04:00
|
|
|
echo "From: $FROM" > log
|
|
|
|
echo "To: $TO" >> log
|
|
|
|
if [ $ret != 0 ]; then
|
|
|
|
echo "Subject: [maven2 build - FAILED] $DATE" >> log
|
|
|
|
else
|
|
|
|
echo "Subject: [maven2 build - SUCCESS] $DATE" >> log
|
|
|
|
echo "" >> log
|
|
|
|
echo "Distribution:" >> log
|
2004-09-18 22:16:57 -04:00
|
|
|
echo "${DEPLOY_SITE}/${DIST}" >>log
|
2004-09-18 21:18:12 -04:00
|
|
|
fi
|
|
|
|
echo "" >> log
|
|
|
|
echo "Log:" >> log
|
|
|
|
echo "http://www.codehaus.org/~maven/m2-build-logs/${MESSAGE_NAME}" >> log
|
|
|
|
|
2004-08-11 16:38:32 -04:00
|
|
|
/usr/sbin/sendmail -t < log
|
2004-04-11 12:31:25 -04:00
|
|
|
fi
|