Merge -r 1166912:1166913 from trunk to branch-0.23 to fix HADOOP-7598.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1166914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2df748af75
commit
d3960b01f7
|
@ -39,40 +39,68 @@ fi
|
||||||
# Come up with a list of changed files into $TMP
|
# Come up with a list of changed files into $TMP
|
||||||
TMP=/tmp/tmp.paths.$$
|
TMP=/tmp/tmp.paths.$$
|
||||||
TOCLEAN="$TOCLEAN $TMP"
|
TOCLEAN="$TOCLEAN $TMP"
|
||||||
grep '^+++\|^---' $PATCH_FILE | cut -c '5-' | grep -v /dev/null | sort | uniq > $TMP
|
|
||||||
|
|
||||||
# Assume p0 to start
|
if $PATCH -p0 -E --dry-run < $PATCH_FILE 2>&1 > $TMP; then
|
||||||
PLEVEL=0
|
PLEVEL=0
|
||||||
|
#if the patch applied at P0 there is the possability that all we are doing
|
||||||
|
# is adding new files and they would apply anywhere. So try to guess the
|
||||||
|
# correct place to put those files.
|
||||||
|
|
||||||
# if all of the lines start with a/ or b/, then this is a git patch that
|
TMP2=/tmp/tmp.paths.2.$$
|
||||||
# was generated without --no-prefix
|
TOCLEAN="$TOCLEAN $TMP2"
|
||||||
if ! grep -qv '^a/\|^b/' $TMP ; then
|
|
||||||
echo Looks like this is a git patch. Stripping a/ and b/ prefixes
|
|
||||||
echo and incrementing PLEVEL
|
|
||||||
PLEVEL=$[$PLEVEL + 1]
|
|
||||||
sed -i -e 's,^[ab]/,,' $TMP
|
|
||||||
fi
|
|
||||||
|
|
||||||
PREFIX_DIRS=$(cut -d '/' -f 1 $TMP | sort | uniq)
|
grep '^patching file ' $TMP | awk '{print $3}' | grep -v /dev/null | sort | uniq > $TMP2
|
||||||
|
|
||||||
# if we are at the project root then nothing more to do
|
#first off check that all of the files do not exist
|
||||||
if [[ -d hadoop-common-project ]]; then
|
FOUND_ANY=0
|
||||||
echo Looks like this is being run at project root
|
for CHECK_FILE in $(cat $TMP2)
|
||||||
|
do
|
||||||
|
if [[ -f $CHECK_FILE ]]; then
|
||||||
|
FOUND_ANY=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# if all of the lines start with hadoop-common/, hadoop-hdfs/, or hadoop-mapreduce/, this is
|
if [[ "$FOUND_ANY" = "0" ]]; then
|
||||||
# relative to the hadoop root instead of the subproject root, so we need
|
#all of the files are new files so we have to guess where the correct place to put it is.
|
||||||
# to chop off another layer
|
|
||||||
elif [[ "$PREFIX_DIRS" =~ ^(hadoop-common-project|hadoop-hdfs-project|hadoop-mapreduce-project)$ ]]; then
|
|
||||||
|
|
||||||
echo Looks like this is relative to project root. Increasing PLEVEL
|
# if all of the lines start with a/ or b/, then this is a git patch that
|
||||||
PLEVEL=$[$PLEVEL + 1]
|
# was generated without --no-prefix
|
||||||
|
if ! grep -qv '^a/\|^b/' $TMP2 ; then
|
||||||
|
echo Looks like this is a git patch. Stripping a/ and b/ prefixes
|
||||||
|
echo and incrementing PLEVEL
|
||||||
|
PLEVEL=$[$PLEVEL + 1]
|
||||||
|
sed -i -e 's,^[ab]/,,' $TMP2
|
||||||
|
fi
|
||||||
|
|
||||||
elif ! echo "$PREFIX_DIRS" | grep -vxq 'hadoop-common-project\|hadoop-hdfs-project\|hadoop-mapreduce-project' ; then
|
PREFIX_DIRS_AND_FILES=$(cut -d '/' -f 1 | sort | uniq)
|
||||||
echo Looks like this is a cross-subproject patch. Try applying from the project root
|
|
||||||
exit 1
|
# if we are at the project root then nothing more to do
|
||||||
|
if [[ -d hadoop-common-project ]]; then
|
||||||
|
echo Looks like this is being run at project root
|
||||||
|
|
||||||
|
# if all of the lines start with hadoop-common/, hadoop-hdfs/, or hadoop-mapreduce/, this is
|
||||||
|
# relative to the hadoop root instead of the subproject root, so we need
|
||||||
|
# to chop off another layer
|
||||||
|
elif [[ "$PREFIX_DIRS_AND_FILES" =~ ^(hadoop-common-project|hadoop-hdfs-project|hadoop-mapreduce-project)$ ]]; then
|
||||||
|
|
||||||
|
echo Looks like this is relative to project root. Increasing PLEVEL
|
||||||
|
PLEVEL=$[$PLEVEL + 1]
|
||||||
|
|
||||||
|
elif ! echo "$PREFIX_DIRS_AND_FILES" | grep -vxq 'hadoop-common-project\|hadoop-hdfs-project\|hadoop-mapreduce-project' ; then
|
||||||
|
echo Looks like this is a cross-subproject patch. Try applying from the project root
|
||||||
|
cleanup 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif $PATCH -p1 -E --dry-run < $PATCH_FILE 2>&1 > /dev/null; then
|
||||||
|
PLEVEL=1
|
||||||
|
elif $PATCH -p2 -E --dry-run < $PATCH_FILE 2>&1 > /dev/null; then
|
||||||
|
PLEVEL=2
|
||||||
|
else
|
||||||
|
echo "The patch does not appear to apply with p0 to p2";
|
||||||
|
cleanup 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Going to apply patch with: $PATCH -p$PLEVEL
|
echo Going to apply patch with: $PATCH -p$PLEVEL
|
||||||
$PATCH -p$PLEVEL -E < $PATCH_FILE
|
$PATCH -p$PLEVEL -E < $PATCH_FILE
|
||||||
|
|
||||||
cleanup 0
|
cleanup $?
|
||||||
|
|
|
@ -562,6 +562,9 @@ Release 0.23.0 - Unreleased
|
||||||
HADOOP-7606. Upgrade Jackson to version 1.7.1 to match the version required
|
HADOOP-7606. Upgrade Jackson to version 1.7.1 to match the version required
|
||||||
by Jersey (Alejandro Abdelnur via atm)
|
by Jersey (Alejandro Abdelnur via atm)
|
||||||
|
|
||||||
|
HADOOP-7598. Fix smart-apply-patch.sh to handle patching from a sub
|
||||||
|
directory correctly. (Robert Evans via acmurthy)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
Loading…
Reference in New Issue