Author: nigel
Date: Wed Jan  9 15:50:55 2008
New Revision: 610615

URL: http://svn.apache.org/viewvc?rev=610615&view=rev
Log:
fix a bug in hudson patch build script

Modified:
    lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh

Modified: lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh
URL: 
http://svn.apache.org/viewvc/lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh?rev=610615&r1=610614&r2=610615&view=diff
==============================================================================
--- lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh (original)
+++ lucene/hadoop/nightly/hudsonBuildHadoopPatch.sh Wed Jan  9 15:50:55 2008
@@ -33,25 +33,23 @@
     cd $baseDir/workspace/
     $SVN co http://svn.apache.org/repos/asf/lucene/hadoop/trunk
   fi
-  echo ""
-  echo ""
-  return ?
+  return $?
 }
 
 ###############################################################################
 setup () {
   ### Download latest patch file (ignoring .htm and .html)
-  $WGET -q -O $baseDir/current/jira 
http://issues.apache.org/jira/browse/$defect
-  if [[ `$GREP -c 'Patch Available' $baseDir/current/jira` == 0 ]] ; then
+  $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
     echo "$defect is not \"Patch Available\".  Exiting."
     cleanupAndExit 0
   fi
-  relativePatchURL=`$GREP -o '"/jira/secure/attachment/[0-9]*/[^"]*' 
$baseDir/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]*/[^"]*' 
$baseDir/patches/current/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/current/patch $patchURL
+  $WGET -q -O $baseDir/patches/current/patch $patchURL
 
   ### Retrieve Subversion revision number
   cd $baseDir/workspace/trunk
@@ -74,8 +72,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/current/currentJavacWarnings
-  cp $baseDir/workspace/trunk/build/test/findbugs/*.xml 
$baseDir/current/currentFindbugsWarnings.xml
+  $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
 }
 
 ###############################################################################
@@ -90,7 +88,7 @@
   echo "======================================================================"
   echo ""
   echo ""
-  authorTags=`$GREP -c -i '@author' $baseDir/current/patch`
+  authorTags=`$GREP -c -i '@author' $baseDir/patches/current/patch`
   echo "There appear to be $authorTags @author tags in the patch."
   if [[ $authorTags != 0 ]] ; then
     JIRA_COMMENT="$JIRA_COMMENT
@@ -116,7 +114,7 @@
   echo "======================================================================"
   echo ""
   echo ""
-  $PATCH -E -p0 < $baseDir/current/patch
+  $PATCH -E -p0 < $baseDir/patches/current/patch
   if [[ $? != 0 ]] ; then
     echo "PATCH APPLICATION FAILED"
     JIRA_COMMENT="$JIRA_COMMENT
@@ -168,12 +166,12 @@
   echo "======================================================================"
   echo ""
   echo ""
-  $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum} 
-Djavac.args="-Xlint -Xmaxwarns 1000" -DHadoopPatchProcess= tar &> 
$baseDir/current/patchJavacWarnings
+  $ANT_HOME/bin/ant -Dversion=${revisionNum}_${defect}_PATCH-${patchNum} 
-Djavac.args="-Xlint -Xmaxwarns 1000" -DHadoopPatchProcess= tar &> 
$baseDir/patches/current/patchJavacWarnings
 
   ### Compare current and patch javac warning numbers
   if [[ -f $baseDir/javacWarnings ]] ; then
-    currentJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning' 
$baseDir/current/currentJavacWarnings | awk '{total += $2} END {print total}'`
-    patchJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning' 
$baseDir/current/patchJavacWarnings | awk '{total += $2} END {print total}'`
+    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}'`
     echo ""
     echo ""
     echo "There appear to be $currentJavacWarnings javac compiler warnings 
before the patch and $patchJavacWarnings javac compiler warnings after applying 
the patch."
@@ -245,17 +243,17 @@
   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"
-  cp $baseDir/workspace/trunk/build/test/findbugs/*.xml 
$baseDir/current/patchFindbugsWarnings.xml
+  cp $baseDir/workspace/trunk/build/test/findbugs/*.xml 
$baseDir/patches/current/patchFindbugsWarnings.xml
   $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/1999" \
-    $baseDir/current/currentFindbugsWarnings.xml \
-    $baseDir/current/currentFindbugsWarnings.xml
+    $baseDir/patches/current/currentFindbugsWarnings.xml \
+    $baseDir/patches/current/currentFindbugsWarnings.xml
   $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
-    $baseDir/current/patchFindbugsWarnings.xml \
-    $baseDir/current/patchFindbugsWarnings.xml
-  $FINDBUGS_HOME/bin/computeBugHistory -output 
$baseDir/current/findbugsMerge.xml \
-    $baseDir/current/currentFindbugsWarnings.xml \
-    $baseDir/current/patchFindbugsWarnings.xml
-  findbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" 
$baseDir/current/findbugsMerge.xml \
+    $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}'`
   $FINDBUGS_HOME/bin/convertXmlToText -html \
     $baseDir/workspace/trunk/build/test/findbugs/newPatchFindbugsWarnings.xml \
@@ -364,12 +362,12 @@
 cleanupAndExit () {
   local result=$1
   if [ ! -z "$defect" ] ; then
-    if [ -e $baseDir/$defect ] ; then
-      rm -rf $baseDir/$defect
+    if [ -e $baseDir/patches/$defect ] ; then
+      rm -rf $baseDir/patches/$defect
     fi
   fi
-  if [ -h $baseDir/current ] ; then
-    rm -f $baseDir/current
+  if [ -h $baseDir/patches/current ] ; then
+    rm -f $baseDir/patches/current
   fi
   echo ""
   echo ""
@@ -395,16 +393,24 @@
 This message is automatically generated."
 
 ### Retrieve the defect number
-if [ ! -e $baseDir/current/defectNum ] ; then
+if [ ! -e $baseDir/patches/current/defectNum ] ; then
   echo "Could not determine the patch to test.  Exiting."
   cleanupAndExit 0
 fi
-export defect=`cat $baseDir/current/defectNum`
+export defect=`cat $baseDir/patches/current/defectNum`
 if [ -z "$defect" ] ; then
   echo "Could not determine the patch to test.  Exiting."
   cleanupAndExit 0
 fi
 
+checkout
+RESULT=$?
+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
+  exit 100
+fi
 setup
 checkAuthor
 RESULT=$?


Reply via email to