You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by to...@apache.org on 2011/08/11 18:49:59 UTC
svn commit: r1156673 - in /hadoop/common/trunk:
dev-support/smart-apply-patch.sh dev-support/test-patch.properties
dev-support/test-patch.sh hadoop-common/CHANGES.txt
hadoop-common/dev-support/test-patch.properties
Author: tomwhite
Date: Thu Aug 11 16:49:59 2011
New Revision: 1156673
URL: http://svn.apache.org/viewvc?rev=1156673&view=rev
Log:
HADOOP-7533. Allow test-patch to be run from any subproject directory.
Added:
hadoop/common/trunk/hadoop-common/dev-support/test-patch.properties (with props)
Modified:
hadoop/common/trunk/dev-support/smart-apply-patch.sh
hadoop/common/trunk/dev-support/test-patch.properties
hadoop/common/trunk/dev-support/test-patch.sh
hadoop/common/trunk/hadoop-common/CHANGES.txt
Modified: hadoop/common/trunk/dev-support/smart-apply-patch.sh
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/dev-support/smart-apply-patch.sh?rev=1156673&r1=1156672&r2=1156673&view=diff
==============================================================================
--- hadoop/common/trunk/dev-support/smart-apply-patch.sh (original)
+++ hadoop/common/trunk/dev-support/smart-apply-patch.sh Thu Aug 11 16:49:59 2011
@@ -53,16 +53,22 @@ if ! grep -qv '^a/\|^b/' $TMP ; then
sed -i -e 's,^[ab]/,,' $TMP
fi
-# if all of the lines start with common/, hdfs/, or mapreduce/, this is
+PREFIX_DIRS=$(cut -d '/' -f 1 $TMP | sort | uniq)
+
+# if we are at the project root then nothing more to do
+if [[ -d hadoop-common ]]; then
+ echo Looks like this is being run at project root
+
+# if all of the lines start with hadoop-common/, hdfs/, or mapreduce/, this is
# relative to the hadoop root instead of the subproject root, so we need
# to chop off another layer
-PREFIX_DIRS=$(cut -d '/' -f 1 $TMP | sort | uniq)
-if [[ "$PREFIX_DIRS" =~ ^(hdfs|common|mapreduce)$ ]]; then
+elif [[ "$PREFIX_DIRS" =~ ^(hdfs|hadoop-common|mapreduce)$ ]]; then
echo Looks like this is relative to project root. Increasing PLEVEL
PLEVEL=$[$PLEVEL + 1]
-elif ! echo "$PREFIX_DIRS" | grep -vxq 'common\|hdfs\|mapreduce' ; then
- echo Looks like this is a cross-subproject patch. Not supported!
+
+elif ! echo "$PREFIX_DIRS" | grep -vxq 'hadoop-common\|hdfs\|mapreduce' ; then
+ echo Looks like this is a cross-subproject patch. Try applying from the project root
exit 1
fi
Modified: hadoop/common/trunk/dev-support/test-patch.properties
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/dev-support/test-patch.properties?rev=1156673&r1=1156672&r2=1156673&view=diff
==============================================================================
--- hadoop/common/trunk/dev-support/test-patch.properties (original)
+++ hadoop/common/trunk/dev-support/test-patch.properties Thu Aug 11 16:49:59 2011
@@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# The number of acceptable warning for *all* modules
+# Please update the per-module test-patch.properties if you update this file.
+
OK_RELEASEAUDIT_WARNINGS=0
OK_FINDBUGS_WARNINGS=0
OK_JAVADOC_WARNINGS=6
Modified: hadoop/common/trunk/dev-support/test-patch.sh
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/dev-support/test-patch.sh?rev=1156673&r1=1156672&r2=1156673&view=diff
==============================================================================
--- hadoop/common/trunk/dev-support/test-patch.sh (original)
+++ hadoop/common/trunk/dev-support/test-patch.sh Thu Aug 11 16:49:59 2011
@@ -19,7 +19,6 @@ ulimit -n 1024
### SVN_REVISION and BUILD_URL are set by Hudson if it is run by patch process
### Read variables from properties file
bindir=$(dirname $0)
-. $bindir/test-patch.properties
# Defaults
if [ -z "$MAVEN_HOME" ]; then
@@ -232,6 +231,7 @@ setup () {
cleanupAndExit 0
fi
fi
+ . $BASEDIR/dev-support/test-patch.properties
### exit if warnings are NOT defined in the properties file
if [ -z "$OK_FINDBUGS_WARNINGS" ] || [[ -z "$OK_JAVADOC_WARNINGS" ]] || [[ -z $OK_RELEASEAUDIT_WARNINGS ]]; then
echo "Please define the following properties in test-patch.properties file"
@@ -367,8 +367,12 @@ checkJavadocWarnings () {
echo ""
echo ""
echo "$MVN clean compile javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1"
- (cd hadoop-project; mvn install)
- (cd hadoop-annotations; mvn install)
+ if [ -d hadoop-project ]; then
+ (cd hadoop-project; $MVN install)
+ fi
+ if [ -d hadoop-annotations ]; then
+ (cd hadoop-annotations; $MVN install)
+ fi
$MVN clean compile javadoc:javadoc -DskipTests -Pdocs -D${PROJECT_NAME}PatchProcess > $PATCH_DIR/patchJavadocWarnings.txt 2>&1
javadocWarnings=`$GREP '\[WARNING\]' $PATCH_DIR/patchJavadocWarnings.txt | $AWK '/Javadoc Warnings/,EOF' | $GREP warning | $AWK 'BEGIN {total = 0} {total += 1} END {print total}'`
echo ""
@@ -525,18 +529,29 @@ checkFindbugsWarnings () {
-1 findbugs. The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
return 1
fi
-JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/target/newPatchFindbugsWarnings.html
+
+ findbugsWarnings=0
+ for file in $(find $BASEDIR -name findbugsXml.xml)
+ do
+ relative_file=${file#$BASEDIR/} # strip leading $BASEDIR prefix
+ if [ ! $relative_file == "target/findbugsXml.xml" ]; then
+ module_suffix=${relative_file%/target/findbugsXml.xml} # strip trailing path
+ fi
+
+ cp $file $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
+ $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
+ $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
+ $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml
+ newFindbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings${module_suffix}.xml \
+ $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml | $AWK '{print $1}'`
+ echo "Found $newFindbugsWarnings Findbugs warnings ($file)"
+ findbugsWarnings=$((findbugsWarnings+newFindbugsWarnings))
+ $FINDBUGS_HOME/bin/convertXmlToText -html \
+ $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.xml \
+ $PATCH_DIR/newPatchFindbugsWarnings${module_suffix}.html
+ JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/target/newPatchFindbugsWarnings${module_suffix}.html
$JIRA_COMMENT_FOOTER"
-
- cp $BASEDIR/hadoop-common/target/findbugsXml.xml $PATCH_DIR/patchFindbugsWarnings.xml
- $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
- $PATCH_DIR/patchFindbugsWarnings.xml \
- $PATCH_DIR/patchFindbugsWarnings.xml
- findbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings.xml \
- $PATCH_DIR/newPatchFindbugsWarnings.xml | $AWK '{print $1}'`
- $FINDBUGS_HOME/bin/convertXmlToText -html \
- $PATCH_DIR/newPatchFindbugsWarnings.xml \
- $PATCH_DIR/newPatchFindbugsWarnings.html
+ done
### if current warnings greater than OK_FINDBUGS_WARNINGS
if [[ $findbugsWarnings > $OK_FINDBUGS_WARNINGS ]] ; then
Modified: hadoop/common/trunk/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common/CHANGES.txt?rev=1156673&r1=1156672&r2=1156673&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common/CHANGES.txt Thu Aug 11 16:49:59 2011
@@ -472,6 +472,9 @@ Trunk (unreleased changes)
HADOOP-7528. Maven build fails in Windows. (Alejandro Abdelnur via
tomwhite)
+ HADOOP-7533. Allow test-patch to be run from any subproject directory.
+ (tomwhite)
+
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES
Added: hadoop/common/trunk/hadoop-common/dev-support/test-patch.properties
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common/dev-support/test-patch.properties?rev=1156673&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-common/dev-support/test-patch.properties (added)
+++ hadoop/common/trunk/hadoop-common/dev-support/test-patch.properties Thu Aug 11 16:49:59 2011
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# The number of acceptable warning for this module
+# Please update the root test-patch.properties if you update this file.
+
+OK_RELEASEAUDIT_WARNINGS=0
+OK_FINDBUGS_WARNINGS=0
+OK_JAVADOC_WARNINGS=6
Propchange: hadoop/common/trunk/hadoop-common/dev-support/test-patch.properties
------------------------------------------------------------------------------
svn:eol-style = native