Author: nigel
Date: Mon Jan 21 15:08:49 2008
New Revision: 614042
URL: http://svn.apache.org/viewvc?rev=614042&view=rev
Log:
updated hudson scripts for new hudson.zones build server
Modified:
lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh
lucene/hadoop/nightly/hudsonPatchQueueAdmin.sh
lucene/hadoop/nightly/processHadoopPatchEmail.sh
Modified: lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh
URL:
http://svn.apache.org/viewvc/lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh?rev=614042&r1=614041&r2=614042&view=diff
==============================================================================
--- lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh (original)
+++ lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh Mon Jan 21 15:08:49 2008
@@ -2,16 +2,25 @@
#set -x
-### Setup some variables. BUILD_ID is set by Hudson
-baseDir=/export/home/hudson/hudson/jobs/Hadoop-Patch
-SVN=/usr/local/bin/svn
+### The directory of the patch to test. Must be
+### writable by this process.
+PATCH_DIR=$1
+### The directory containing supporting files that need to
+### be copied to the build directory.
+SUPPORT_DIR=$2
+### The complete URL to trigger a build.
+TRIGGER_BUILD_URL=$3
+
+### Setup some variables.
+### JOB_NAME, SVN_REVISION, BUILD_ID, BUILD_NUMBER, and WORKSPACE are set by
Hudson
+SVN=/opt/subversion-current/bin/svn
GREP=/usr/local/bin/grep
WGET=/usr/sfw/bin/wget
PATCH=/usr/local/bin/patch
PS=/usr/ucb/ps
-JIRA=/export/home/hudson/tools/jira_cli/src/cli/jira
-FINDBUGS_HOME=$HUDSON_HOME/../tools/findbugs/latest
-FORREST_HOME=$HUDSON_HOME/../tools/forrest/latest
+JIRA=/export/home/nigel/tools/jira_cli/src/cli/jira
+FINDBUGS_HOME=/export/home/nigel/tools/findbugs/latest
+FORREST_HOME=/export/home/nigel/tools/forrest/latest
###############################################################################
checkout () {
@@ -24,14 +33,14 @@
echo "======================================================================"
echo ""
echo ""
- if [[ -d $baseDir/workspace/trunk ]] ; then
- cd $baseDir/workspace/trunk
+ if [[ -d $WORKSPACE/trunk ]] ; then
+ cd $WORKSPACE/trunk
$SVN revert -R .
rm -rf `$SVN status`
$SVN update
else
- cd $baseDir/workspace/
- $SVN co http://svn.apache.org/repos/asf/lucene/hadoop/trunk
+ cd $WORKSPACE
+ $SVN co http://svn.apache.org/repos/asf/hadoop/core/trunk
fi
return $?
}
@@ -39,28 +48,25 @@
###############################################################################
setup () {
### Download latest patch file (ignoring .htm and .html)
- $WGET -q -O $baseDir/patches/current/jira
http://issues.apache.org/jira/browse/$defect
- if [[ `$GREP -c 'Patch Available' $baseDir/patches/current/jira` == 0 ]] ;
then
+ $WGET -q -O $PATCH_DIR/jira http://issues.apache.org/jira/browse/$defect
+ if [[ `$GREP -c 'Patch Available' $PATCH_DIR/jira` == 0 ]] ; then
echo "$defect is not \"Patch Available\". Exiting."
cleanupAndExit 0
fi
- relativePatchURL=`$GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*'
$baseDir/patches/current/jira | $GREP -v -e 'htm[l]*$' | sort | tail -1 | $GREP
-o '/jira/secure/attachment/[0-9]*/[^"]*'`
+ relativePatchURL=`$GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*'
$PATCH_DIR/jira | $GREP -v -e 'htm[l]*$' | sort | tail -1 | $GREP -o
'/jira/secure/attachment/[0-9]*/[^"]*'`
patchURL="http://issues.apache.org${relativePatchURL}"
patchNum=`echo $patchURL | $GREP -o '[0-9]*/' | $GREP -o '[0-9]*'`
echo "$defect patch is being downloaded at `date` from"
echo "$patchURL"
- $WGET -q -O $baseDir/patches/current/patch $patchURL
+ $WGET -q -O $PATCH_DIR/patch $patchURL
- ### Retrieve Subversion revision number
- cd $baseDir/workspace/trunk
- revisionNum=`svn log --limit 1 -q . | $GREP -o "^r[0-9]*"`
JIRA_COMMENT="Here are the results of testing the latest attachment
$patchURL
-against trunk revision $revisionNum."
+against trunk revision ${SVN_REVISION}."
### Copy in any supporting files needed by this process
- cp -r $baseDir/lib/* ./lib
- #PENDING: cp -f $baseDir/bin/checkstyle* ./src/test
+ cp -r $SUPPORT_DIR/lib/* ./lib
+ #PENDING: cp -f $SUPPORT_DIR/etc/checkstyle* ./src/test
echo ""
echo ""
@@ -72,8 +78,8 @@
echo "======================================================================"
echo ""
echo ""
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-Dfindbugs.home=$FINDBUGS_HOME -Djavac.args="-Xlint -Xmaxwarns 1000"
-DHadoopPatchProcess= clean tar findbugs &>
$baseDir/patches/current/currentJavacWarnings
- cp $baseDir/workspace/trunk/build/test/findbugs/*.xml
$baseDir/patches/current/currentFindbugsWarnings.xml
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-Dfindbugs.home=$FINDBUGS_HOME -Djavac.args="-Xlint -Xmaxwarns 1000"
-DHadoopPatchProcess= clean tar findbugs &> $PATCH_DIR/currentJavacWarnings
+ cp $WORKSPACE/trunk/build/test/findbugs/*.xml
$PATCH_DIR/currentFindbugsWarnings.xml
}
###############################################################################
@@ -88,7 +94,7 @@
echo "======================================================================"
echo ""
echo ""
- authorTags=`$GREP -c -i '@author' $baseDir/patches/current/patch`
+ authorTags=`$GREP -c -i '@author' $PATCH_DIR/patch`
echo "There appear to be $authorTags @author tags in the patch."
if [[ $authorTags != 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
@@ -114,7 +120,7 @@
echo "======================================================================"
echo ""
echo ""
- $PATCH -E -p0 < $baseDir/patches/current/patch
+ $PATCH -E -p0 < $PATCH_DIR/patch
if [[ $? != 0 ]] ; then
echo "PATCH APPLICATION FAILED"
JIRA_COMMENT="$JIRA_COMMENT
@@ -137,8 +143,8 @@
echo "======================================================================"
echo ""
echo ""
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= clean javadoc
- javadocWarnings=`$GREP -c '\[javadoc\] [0-9]* warning'
$baseDir/builds/$BUILD_ID/log`
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= clean javadoc
+ javadocWarnings=`$GREP -c '\[javadoc\] [0-9]* warning'
$WORKSPACE/../builds/$BUILD_ID/log`
echo ""
echo ""
echo "There appear to be $javadocWarnings javadoc warnings generated by the
patched build."
@@ -166,12 +172,12 @@
echo "======================================================================"
echo ""
echo ""
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-Djavac.args="-Xlint -Xmaxwarns 1000" -DHadoopPatchProcess= tar &>
$baseDir/patches/current/patchJavacWarnings
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-Djavac.args="-Xlint -Xmaxwarns 1000" -DHadoopPatchProcess= tar &>
$PATCH_DIR/patchJavacWarnings
### Compare current and patch javac warning numbers
- if [[ -f $baseDir/javacWarnings ]] ; then
- currentJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning'
$baseDir/patches/current/currentJavacWarnings | awk '{total += $2} END {print
total}'`
- patchJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning'
$baseDir/patches/current/patchJavacWarnings | awk '{total += $2} END {print
total}'`
+ if [[ -f $PATCH_DIR/patchJavacWarnings ]] ; then
+ currentJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning'
$PATCH_DIR/currentJavacWarnings | awk '{total += $2} END {print total}'`
+ patchJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning'
$PATCH_DIR/patchJavacWarnings | awk '{total += $2} END {print total}'`
echo ""
echo ""
echo "There appear to be $currentJavacWarnings javac compiler warnings
before the patch and $patchJavacWarnings javac compiler warnings after applying
the patch."
@@ -205,8 +211,8 @@
echo "THIS IS NOT IMPLEMENTED YET"
echo ""
echo ""
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= checkstyle
- JIRA_COMMENT_FOOTER="Checkstyle results:
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/$BUILD_NUMBER/artifact/trunk/build/test/checkstyle-errors.html
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= checkstyle
+ JIRA_COMMENT_FOOTER="Checkstyle results:
http://hudson.zones.apache.org/hudson/job/$JOB_NAME/$BUILD_NUMBER/artifact/trunk/build/test/checkstyle-errors.html
$JIRA_COMMENT_FOOTER"
### TODO: calculate actual patchStyleErrors
# patchStyleErrors=0
@@ -234,30 +240,30 @@
echo "======================================================================"
echo ""
echo ""
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-Dfindbugs.home=$FINDBUGS_HOME -DHadoopPatchProcess= findbugs
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-Dfindbugs.home=$FINDBUGS_HOME -DHadoopPatchProcess= findbugs
if [ $? != 0 ] ; then
JIRA_COMMENT="$JIRA_COMMENT
findbugs -1. The patch appears to cause Findbugs to fail."
return 1
fi
-JIRA_COMMENT_FOOTER="Findbugs warnings:
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/$BUILD_NUMBER/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
+JIRA_COMMENT_FOOTER="Findbugs warnings:
http://hudson.zones.apache.org/hudson/job/$JOB_NAME/$BUILD_NUMBER/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
$JIRA_COMMENT_FOOTER"
- cp $baseDir/workspace/trunk/build/test/findbugs/*.xml
$baseDir/patches/current/patchFindbugsWarnings.xml
+ cp $WORKSPACE/trunk/build/test/findbugs/*.xml
$PATCH_DIR/patchFindbugsWarnings.xml
$FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/1999" \
- $baseDir/patches/current/currentFindbugsWarnings.xml \
- $baseDir/patches/current/currentFindbugsWarnings.xml
+ $PATCH_DIR/currentFindbugsWarnings.xml \
+ $PATCH_DIR/currentFindbugsWarnings.xml
$FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
- $baseDir/patches/current/patchFindbugsWarnings.xml \
- $baseDir/patches/current/patchFindbugsWarnings.xml
- $FINDBUGS_HOME/bin/computeBugHistory -output
$baseDir/patches/current/findbugsMerge.xml \
- $baseDir/patches/current/currentFindbugsWarnings.xml \
- $baseDir/patches/current/patchFindbugsWarnings.xml
- findbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000"
$baseDir/patches/current/findbugsMerge.xml \
- $baseDir/workspace/trunk/build/test/findbugs/newPatchFindbugsWarnings.xml
| /usr/bin/nawk '{print $1}'`
+ $PATCH_DIR/patchFindbugsWarnings.xml \
+ $PATCH_DIR/patchFindbugsWarnings.xml
+ $FINDBUGS_HOME/bin/computeBugHistory -output $PATCH_DIR/findbugsMerge.xml \
+ $PATCH_DIR/currentFindbugsWarnings.xml \
+ $PATCH_DIR/patchFindbugsWarnings.xml
+ findbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000"
$PATCH_DIR/findbugsMerge.xml \
+ $WORKSPACE/trunk/build/test/findbugs/newPatchFindbugsWarnings.xml |
/usr/bin/nawk '{print $1}'`
$FINDBUGS_HOME/bin/convertXmlToText -html \
- $baseDir/workspace/trunk/build/test/findbugs/newPatchFindbugsWarnings.xml \
- $baseDir/workspace/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
+ $WORKSPACE/trunk/build/test/findbugs/newPatchFindbugsWarnings.xml \
+ $WORKSPACE/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
if [[ $findbugsWarnings != 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
@@ -285,7 +291,7 @@
### Kill any rogue build processes from the last attempt
$PS -auxwww | $GREP HadoopPatchProcess | /usr/bin/nawk '{print $2}' |
/usr/bin/xargs -t -I {} /usr/bin/kill -9 {} > /dev/null
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes
-Dcompile.c++=yes -Dforrest.home=$FORREST_HOME create-c++-configure docs tar
test-core
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes
-Dcompile.c++=yes -Dforrest.home=$FORREST_HOME create-c++-configure docs tar
test-core
if [[ $? != 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
@@ -313,7 +319,7 @@
### Kill any rogue build processes from the last attempt
$PS -auxwww | $GREP HadoopPatchProcess | /usr/bin/nawk '{print $2}' |
/usr/bin/xargs -t -I {} /usr/bin/kill -9 {} > /dev/null
- $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes
test-contrib
+ $ANT_HOME/bin/ant -Dversion=${SVN_REVISION}_${defect}_PATCH-${patchNum}
-DHadoopPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes
test-contrib
if [[ $? != 0 ]] ; then
JIRA_COMMENT="$JIRA_COMMENT
@@ -361,8 +367,8 @@
### Cleanup files
cleanupAndExit () {
local result=$1
- if [ -e $baseDir/patches/current ] ; then
- rm -rf $baseDir/patches/current
+ if [ -e $PATCH_DIR ] ; then
+ rm -rf $PATCH_DIR
fi
echo ""
echo ""
@@ -381,18 +387,17 @@
###############################################################################
export patchNum=""
-export revisionNum=""
export JIRA_COMMENT=""
-export JIRA_COMMENT_FOOTER="Console output:
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/$BUILD_NUMBER/console
+export JIRA_COMMENT_FOOTER="Console output:
http://hudson.zones.apache.org/hudson/job/$JOB_NAME/$BUILD_NUMBER/console
This message is automatically generated."
### Retrieve the defect number
-if [ ! -e $baseDir/patches/current/defectNum ] ; then
+if [ ! -e $PATCH_DIR/defectNum ] ; then
echo "Could not determine the patch to test. Exiting."
cleanupAndExit 0
fi
-export defect=`cat $baseDir/patches/current/defectNum`
+export defect=`cat $PATCH_DIR/defectNum`
if [ -z "$defect" ] ; then
echo "Could not determine the patch to test. Exiting."
cleanupAndExit 0
@@ -403,7 +408,7 @@
if [[ $? != 0 ]] ; then
### Resubmit build. The 'token' is a secret.
token=`cat ~hudson/private/hudsonBuildToken`
- /usr/sfw/bin/wget -q -O $baseDir/patches/current/build
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/build?token=$token
+ $WGET -q -O $PATCH_DIR/build $TRIGGER_BUILD_URL
exit 100
fi
setup
@@ -426,7 +431,7 @@
(( RESULT = RESULT + $? ))
runContribTests
(( RESULT = RESULT + $? ))
-JIRA_COMMENT_FOOTER="Test results:
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/$BUILD_NUMBER/testReport/
+JIRA_COMMENT_FOOTER="Test results:
http://hudson.zones.apache.org/hudson/job/$JOB_NAME/$BUILD_NUMBER/testReport/
$JIRA_COMMENT_FOOTER"
submitJiraComment $RESULT
Modified: lucene/hadoop/nightly/hudsonPatchQueueAdmin.sh
URL:
http://svn.apache.org/viewvc/lucene/hadoop/nightly/hudsonPatchQueueAdmin.sh?rev=614042&r1=614041&r2=614042&view=diff
==============================================================================
--- lucene/hadoop/nightly/hudsonPatchQueueAdmin.sh (original)
+++ lucene/hadoop/nightly/hudsonPatchQueueAdmin.sh Mon Jan 21 15:08:49 2008
@@ -2,52 +2,60 @@
#set -x
-LOG=HadoopPatchQueue.txt
-CURRENT_DIR=../patches/current
-START_PWD=`pwd`
+### The Jira project name. Examples: HADOOP or RIVER or LUCENE
+PROJECT=$1
+### The directory to accumulate the patch queue. Must be
+### writable by this process.
+QUEUE_DIR=$2
+### The complete URL to trigger a build.
+TRIGGER_BUILD_URL=$3
+
+QUEUE_HTML_FILE=`pwd`/${PROJECT}_PatchQueue.html
+CURRENT_DIR=${QUEUE_DIR}/current
CURRENT_PATCH=`cat $CURRENT_DIR/defectNum`
+### If there is no current patch being tested,
+### look for the next one in the queue.
if [[ $CURRENT_PATCH == "" ]] ; then
- cd ../patches
- CURRENT_PATCH=`ls -1dtr HADOOP* | head -1`
+ cd $QUEUE_DIR
+ CURRENT_PATCH=`ls -1dtr ${PROJECT}* | head -1`
+ ### If there is another patch in the queue, start testing it.
if [[ $CURRENT_PATCH != "" ]] ; then
rm -rf $CURRENT_DIR
mv $CURRENT_PATCH $CURRENT_DIR
- ### Start build. The 'token' is a secret.
+ ### Start build.
echo "$CURRENT_PATCH patch submitted for testing at `date`"
- token=`cat ~hudson/private/hudsonBuildToken`
- /usr/sfw/bin/wget -q -O $CURRENT_DIR/build
http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/build?token=$token
+ /usr/sfw/bin/wget -q -O $CURRENT_DIR/build $TRIGGER_BUILD_URL
chmod -R g+w $CURRENT_DIR
else
- CURRENT_PATCH="<none>"
+ CURRENT_PATCH="none"
+ CURRENT_PATCH_TIME="-"
fi
- cd $START_PWD
+fi
+if [[ -z $CURRENT_PATCH_TIME ]] ; then
+ CURRENT_PATCH_TIME=`ls -dtl ${CURRENT_DIR}* | awk '{print $5" "$6" "$7"
GMT"}'`
fi
-cd ../patches
-QUEUE=`ls -1dtr HADOOP*`
-cd $START_PWD
+cd $QUEUE_DIR
+QUEUE=`ls -1dtrl ${PROJECT}* | awk '{print "<tr><td><a
href=\"http://issues.apache.org/jira/browse/"$8"\">"$8"</a></td><td>"$5" "$6"
"$7" GMT</td></tr>"}'`
if [[ $QUEUE == "" ]] ; then
- QUEUE="<empty>"
+ QUEUE="<tr><td>empty</td><td>-</td></tr>"
fi
-echo "" > $LOG
-echo `date` >>$LOG
-echo "" >> $LOG
-echo "===================================" >> $LOG
-echo "CURRENTLY RUNNING OR WAITING TO RUN" >> $LOG
-echo "===================================" >> $LOG
-echo "" >> $LOG
-echo "$CURRENT_PATCH" >> $LOG
-echo "" >> $LOG
-
-echo "" >> $LOG
-echo "==================" >> $LOG
-echo "HADOOP PATCH QUEUE" >> $LOG
-echo "==================" >> $LOG
-echo "" >> $LOG
-echo " Head of Queue" >> $LOG
-echo "$QUEUE" >> $LOG
-echo " Tail of Queue" >> $LOG
-echo "" >> $LOG
+echo "<html>" > $QUEUE_HTML_FILE
+echo "<title>Patch Queue for $PROJECT</title>" >> $QUEUE_HTML_FILE
+echo "<h1>Patch Queue for $PROJECT</h1>" >> $QUEUE_HTML_FILE
+echo "<hr>" >> $QUEUE_HTML_FILE
+echo "<h2>Currently Running (or Waiting To Run)</h2>" >> $QUEUE_HTML_FILE
+echo "<table cellspacing=10><tr align=left><th>Issue</th><th>Date Submitted to
Run</th></tr>" >> $QUEUE_HTML_FILE
+echo "<tr><td><a
href=\"http://issues.apache.org/jira/browse/${CURRENT_PATCH}\">$CURRENT_PATCH</a></td><td>$CURRENT_PATCH_TIME</td></tr>"
>> $QUEUE_HTML_FILE
+echo "</table>" >> $QUEUE_HTML_FILE
+echo "<hr>" >> $QUEUE_HTML_FILE
+echo "<h2>Waiting in the Queue</h2>" >> $QUEUE_HTML_FILE
+echo "<table cellspacing=10><tr align=left><th>Issue</th><th>Date
Submitted</th></tr>" >> $QUEUE_HTML_FILE
+echo "$QUEUE" >> $QUEUE_HTML_FILE
+echo "</table>" >> $QUEUE_HTML_FILE
+echo "<hr>" >> $QUEUE_HTML_FILE
+echo "This file last updated at: `date`" >>$QUEUE_HTML_FILE
+echo "</html>" >> $QUEUE_HTML_FILE
Modified: lucene/hadoop/nightly/processHadoopPatchEmail.sh
URL:
http://svn.apache.org/viewvc/lucene/hadoop/nightly/processHadoopPatchEmail.sh?rev=614042&r1=614041&r2=614042&view=diff
==============================================================================
--- lucene/hadoop/nightly/processHadoopPatchEmail.sh (original)
+++ lucene/hadoop/nightly/processHadoopPatchEmail.sh Mon Jan 21 15:08:49 2008
@@ -2,36 +2,39 @@
#set -x
-baseDir=/export/home/hudson/hudson/jobs/Hadoop-Patch/patches
-LOG=$baseDir/log.txt
+### The Jira project name. Examples: HADOOP or RIVER or LUCENE
+PROJECT=$1
+### The directory to accumulate the patch queue. Must be
+### writable by this process.
+QUEUE_DIR=$2
+
+LOG=$QUEUE_DIR/log.txt
### Scan email
while read line
do
- ### Look for first occurance of issue number
- if [[ `echo $line | /usr/local/bin/grep -c "HADOOP-"` == 1 ]] ; then
- if [[ -z $defect ]] ; then
- defect=`expr "$line" : '.*\(HADOOP-[0-9]*\)'`
- fi
- fi
### Check to see if this issue was just made "Patch Available"
if [[ `echo $line | /usr/local/bin/grep -c "Status: Patch Available"` == 1
]] ; then
patch=true
+ fi
+ ### Look for issue number
+ if [[ `echo $line | /usr/local/bin/grep -c "Key: $PROJECT-"` == 1 ]] ; then
+ defect=`expr "$line" : '.*\($PROJECT-[0-9]*\)'`
break
fi
done
### If this email indicates a new patch, start a build
-if [[ -n $patch && ! -d $baseDir/$defect ]] ; then
+if [[ -n $patch && ! -d $QUEUE_DIR/$defect ]] ; then
echo "$defect is being processed at `date`" >> $LOG
- mkdir $baseDir/$defect
+ mkdir $QUEUE_DIR/$defect
### Write the defect number to a file so buildTest.sh
### knows which patch to test.
- echo $defect > $baseDir/$defect/defectNum
+ echo $defect > $QUEUE_DIR/$defect/defectNum
### Since this script is run by the 'daemon' user by sendmail,
### make sure everything it creates is group writable
- chmod -R g+w $baseDir/$defect
+ chmod -R g+w $QUEUE_DIR/$defect
fi
exit 0