2004-04-09 00:27:28 -04:00
#!/bin/sh
2004-04-09 19:56:23 -04:00
# ----------------------------------------------------------------------------------
2005-07-20 20:52:22 -04:00
. $HOME /.profile
2005-07-27 21:17:38 -04:00
cd $HOME
2005-07-20 20:52:22 -04:00
2004-04-10 14:29:46 -04:00
CMD = $1
2005-12-20 22:53:20 -05:00
if [ " $1 " = "" ] ; then
echo
echo "You must specify a checkout or update!"
echo
exit 1
fi
2004-04-10 14:29:46 -04:00
2005-12-20 22:47:08 -05:00
BRANCH = " branches/ ${ 2 } "
2005-12-20 22:53:20 -05:00
if [ " $2 " = "" ] ; then
BRANCH = "trunk"
fi
2005-12-20 22:47:08 -05: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
2005-07-27 21:17:38 -04:00
if [ " $CMD " = "checkout" ] ; then
echo " From: $FROM " > running_log
echo " To: $TO " >> running_log
2005-12-20 22:47:08 -05:00
echo " Subject: [maven2 build $BRANCH - SKIPPED - $CMD ] $DATE " >>running_log
2005-07-27 21:17:38 -04:00
echo "" >> running_log
echo "ci.sh already running... exiting" >>running_log
echo " $RUNNING " >>running_log
/usr/sbin/sendmail -t < running_log
fi
2005-06-03 01:59:46 -04:00
exit 1
fi
2005-12-20 22:47:08 -05:00
DIR = $HOME /m2-build/$BRANCH
mkdir -p $DIR
REPO = $DIR /maven-repo-local
SCM_LOG = $DIR /scm.log
BUILD_REQUIRED_FILE = $DIR /build_required
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
2005-12-20 22:47:08 -05:00
DEPLOY_DIR = $WWW /builds/$BRANCH
DEPLOY_SITE = http://maven.zones.apache.org/~maven/builds/$BRANCH
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-12-20 22:47:08 -05:00
MESSAGE_DIR = $WWW /logs/$BRANCH
2005-07-20 10:33:41 -04:00
MESSAGE_NAME = m2-build-log-${ TIMESTAMP } .txt
2005-12-20 22:47:08 -05:00
MESSAGE_SITE = http://maven.zones.apache.org/~maven/logs/$BRANCH
2005-07-20 10:33:41 -04:00
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
2005-12-20 22:47:08 -05:00
if [ -f $BUILD_REQUIRED_FILE ] ; then
BUILD_REQUIRED = ` cat $BUILD_REQUIRED_FILE `
2005-04-13 07:28:50 -04:00
fi
2005-07-27 21:17:38 -04:00
if [ ! -d $DIR /maven-components ] ; then
CMD = "checkout"
fi
2005-12-20 22:47:08 -05:00
if [ ! -d $DIR /plugins ] ; then
CMD = "checkout"
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-12-20 22:47:08 -05:00
$SVN co http://svn.apache.org/repos/asf/maven/components/$BRANCH maven-components > $SCM_LOG 2>& 1
$SVN co http://svn.apache.org/repos/asf/maven/plugins/trunk plugins > $SCM_LOG 2>& 1
2004-04-10 14:29:46 -04:00
2005-12-20 22:47:08 -05:00
echo "true" > $BUILD_REQUIRED_FILE
2004-04-10 15:01:31 -04:00
)
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-12-20 22:47:08 -05:00
$SVN update > $SCM_LOG 2>& 1
2005-12-04 20:43:27 -05:00
cd $DIR /plugins
2005-12-20 22:47:08 -05:00
$SVN update >> $SCM_LOG 2>& 1
2004-04-10 14:29:46 -04:00
2005-12-20 22:47:08 -05:00
grep "^[PUAD] " $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-12-20 22:47:08 -05:00
echo $BUILD_REQUIRED > $BUILD_REQUIRED_FILE
2004-04-10 14:29:46 -04:00
2004-04-10 14:42:24 -04:00
else
2005-12-20 22:47:08 -05:00
echo "true" > $BUILD_REQUIRED_FILE
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
2005-12-20 22:47:08 -05:00
BUILD_REQUIRED = ` cat $BUILD_REQUIRED_FILE `
2004-04-10 14:29:46 -04:00
if [ " $BUILD_REQUIRED " = "true" ]
then
2004-04-10 14:48:13 -04:00
echo "Updates occured, build required ..."
echo
2005-12-20 22:47:08 -05:00
grep "^[PUAD] " $SCM_LOG
2004-04-10 14:48:13 -04:00
echo
2005-12-20 22:47:08 -05:00
version = ` cat $DIR /maven-components/pom.xml | tr '\n' ' ' | sed 's#<parent>.*</parent>##g' | sed 's#<dependencies>.*</dependencies>##g' | sed 's#<build>.*</build>##g' | sed 's#^.*<version>##g' | sed 's#</version>.*$##g' `
M2_HOME = $DIR /maven-$version
export M2_HOME
PATH = $JAVA_HOME /bin:$M2_HOME /bin:$PATH
export PATH
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-11-16 07:13:19 -05:00
sh bootstrap.sh --prefix= $DIR --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
2005-11-16 07:13:19 -05:00
echo " Creating Maven 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
2005-11-16 07:13:19 -05:00
cp $DIR /maven-components/maven-core/target/*.tar.gz $DEPLOY_DIR /$DIST
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
2005-12-20 22:47:08 -05:00
BUILD_REQUIRED = ` cat $BUILD_REQUIRED_FILE `
2004-04-11 12:31:25 -04:00
# 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-12-20 22:47:08 -05:00
echo " Subject: [maven2 build $BRANCH - FAILED - $CMD ] $DATE " >> log
2004-09-18 21:18:12 -04:00
else
2005-12-20 22:47:08 -05:00
echo " Subject: [maven2 build $BRANCH - 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-12-20 22:47:08 -05:00
rm $BUILD_REQUIRED_FILE
2004-09-18 21:18:12 -04:00
fi
echo "" >> log
echo "Log:" >> log
2005-12-20 22:47:08 -05:00
echo " ${ MESSAGE_SITE } / ${ 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
2005-12-20 22:47:08 -05:00