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
|
|
|
|
2005-07-20 10:33:41 -04:00
|
|
|
FROM=continuum@maven.zones.apache.org
|
2005-06-03 01:59:46 -04:00
|
|
|
TO=dev@maven.apache.org
|
2004-04-10 23:27:04 -04:00
|
|
|
DATE=`date`
|
2005-06-03 01:59:46 -04:00
|
|
|
|
|
|
|
PID=$$
|
|
|
|
RUNNING=`ps -ef | grep ci.sh | grep -v 'sh -c' | grep -v grep | grep -v $PID`
|
|
|
|
if [ ! -z "$RUNNING" ]; then
|
|
|
|
echo "From: $FROM" > running_log
|
|
|
|
echo "To: $TO" >> running_log
|
2005-06-07 01:18:41 -04:00
|
|
|
echo "Subject: [maven2 build - SKIPPED - $CMD] $DATE" >>running_log
|
2005-06-03 01:59:46 -04:00
|
|
|
echo "" >> running_log
|
|
|
|
echo "ci.sh already running... exiting" >>running_log
|
|
|
|
echo "$RUNNING" >>running_log
|
|
|
|
/usr/sbin/sendmail -t < running_log
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
HOME_DIR=`pwd`
|
2004-06-15 23:28:50 -04:00
|
|
|
DIR=m2-build
|
2005-07-20 11:04:26 -04:00
|
|
|
REPO=$HOME_DIR/maven-repo-local
|
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`
|
2005-07-20 10:33:41 -04:00
|
|
|
WWW=$HOME/public_html
|
|
|
|
DEPLOY_DIR=$WWW/builds
|
|
|
|
DEPLOY_SITE=http://maven.zones.apache.org/~maven/builds
|
2004-09-18 21:18:12 -04:00
|
|
|
DIST=m2-${TIMESTAMP}.tar.gz
|
2005-07-20 10:33:41 -04:00
|
|
|
SVN=svn
|
2004-04-09 10:11:57 -04:00
|
|
|
|
2005-07-20 10:33:41 -04:00
|
|
|
M2_HOME=$HOME/m2
|
|
|
|
export M2_HOME
|
|
|
|
PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
|
2005-07-20 10:44:44 -04:00
|
|
|
export PATH
|
|
|
|
|
2005-07-20 10:33:41 -04:00
|
|
|
MESSAGE_DIR=$WWW/logs
|
|
|
|
MESSAGE_NAME=m2-build-log-${TIMESTAMP}.txt
|
|
|
|
MESSAGE=${MESSAGE_DIR}/${MESSAGE_NAME}
|
|
|
|
|
|
|
|
mkdir -p $DEPLOY_DIR
|
|
|
|
mkdir -p $MESSAGE_DIR
|
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
|
|
|
# ----------------------------------------------------------------------------------
|
|
|
|
|
2005-04-13 07:28:50 -04:00
|
|
|
BUILD_REQUIRED=false
|
|
|
|
if [ -f $HOME_DIR/build_required ]; then
|
|
|
|
BUILD_REQUIRED=`cat $HOME_DIR/build_required`
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
|
2005-04-21 13:28:26 -04:00
|
|
|
$SVN co http://svn.apache.org/repos/asf/maven/components/trunk 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
|
|
|
|
2005-04-21 13:28:26 -04:00
|
|
|
$SVN update > $HOME_DIR/$SCM_LOG 2>&1
|
2004-04-10 14:29:46 -04:00
|
|
|
|
2005-04-21 09:35:28 -04:00
|
|
|
grep "^[PUAD] " $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
|
|
|
|
|
2005-04-13 07:28:50 -04:00
|
|
|
echo $BUILD_REQUIRED > $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
|
2005-04-21 09:35:28 -04:00
|
|
|
grep "^[PUAD] " $HOME_DIR/$SCM_LOG
|
2004-04-10 14:48:13 -04:00
|
|
|
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
|
|
|
|
2005-07-20 11:04:26 -04:00
|
|
|
sh m2-bootstrap-all.sh -Dmaven.repo.local="$REPO" -Dmaven.home="$M2_HOME" --update-snapshots
|
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
|
2005-07-20 11:04:26 -04:00
|
|
|
gtar 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
|
2005-06-03 01:42:14 -04:00
|
|
|
echo "Subject: [maven2 build - FAILED - $CMD] $DATE" >> log
|
2004-09-18 21:18:12 -04:00
|
|
|
else
|
2005-06-03 01:42:14 -04:00
|
|
|
echo "Subject: [maven2 build - SUCCESS - $CMD] $DATE" >> log
|
2004-09-18 21:18:12 -04:00
|
|
|
echo "" >> log
|
|
|
|
echo "Distribution:" >> log
|
2004-09-18 22:16:57 -04:00
|
|
|
echo "${DEPLOY_SITE}/${DIST}" >>log
|
2005-04-13 07:28:50 -04:00
|
|
|
rm $HOME_DIR/build_required
|
2004-09-18 21:18:12 -04:00
|
|
|
fi
|
|
|
|
echo "" >> log
|
|
|
|
echo "Log:" >> log
|
2005-07-20 10:33:41 -04:00
|
|
|
echo "http://maven.zones.apache.org/~maven/logs/${MESSAGE_NAME}" >> log
|
2004-09-18 21:18:12 -04:00
|
|
|
|
2004-08-11 16:38:32 -04:00
|
|
|
/usr/sbin/sendmail -t < log
|
2004-04-11 12:31:25 -04:00
|
|
|
fi
|