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 aw...@apache.org on 2015/07/30 03:49:06 UTC

hadoop git commit: HADOOP-12243. Rewrite grep -o's to be POSIX compliant (Kengo Seki via aw)

Repository: hadoop
Updated Branches:
  refs/heads/HADOOP-12111 42d0c0fac -> bddc16c61


HADOOP-12243. Rewrite grep -o's to be POSIX compliant (Kengo Seki via aw)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bddc16c6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bddc16c6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bddc16c6

Branch: refs/heads/HADOOP-12111
Commit: bddc16c6174807012b3e9d95624d60f78b6ba6c6
Parents: 42d0c0f
Author: Allen Wittenauer <aw...@apache.org>
Authored: Wed Jul 29 18:48:57 2015 -0700
Committer: Allen Wittenauer <aw...@apache.org>
Committed: Wed Jul 29 18:48:57 2015 -0700

----------------------------------------------------------------------
 dev-support/smart-apply-patch.sh | 8 +++++---
 dev-support/test-patch.sh        | 7 +++++--
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bddc16c6/dev-support/smart-apply-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/smart-apply-patch.sh b/dev-support/smart-apply-patch.sh
index 96bda92..00e3a0a 100755
--- a/dev-support/smart-apply-patch.sh
+++ b/dev-support/smart-apply-patch.sh
@@ -266,7 +266,9 @@ function locate_patch
           fi
         fi
 
-        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]*/[^"]*')
+        #shellcheck disable=SC2016
+        relativePatchURL=$(${AWK} 'match($0,"\"/jira/secure/attachment/[0-9]*/[^\"]*"){print substr($0,RSTART+1,RLENGTH-1)}' "${PATCH_DIR}/jira" |
+          ${GREP} -v -e 'htm[l]*$' | sort | tail -1)
         PATCHURL="http://issues.apache.org${relativePatchURL}"
         if [[ ! ${PATCHURL} =~ \.patch$ ]]; then
           notSureIfPatch=true
@@ -355,7 +357,7 @@ function verify_zero
       return 0
     fi
 
-    dir=$(dirname ${filename} 2>/dev/null)
+    dir=$(dirname "${filename}" 2>/dev/null)
     if [[ -n ${dir} && -d ${dir} ]]; then
       return 0
     fi
@@ -540,4 +542,4 @@ if [[ ${DRYRUNMODE} == false ]]; then
   apply
 fi
 
-cleanup_and_exit ${RESULT}
\ No newline at end of file
+cleanup_and_exit ${RESULT}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bddc16c6/dev-support/test-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh
index 1c9be9c..c516beb 100755
--- a/dev-support/test-patch.sh
+++ b/dev-support/test-patch.sh
@@ -1621,12 +1621,15 @@ function locate_patch
           fi
         fi
 
-        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]*/[^"]*')
+        #shellcheck disable=SC2016
+        relativePatchURL=$(${AWK} 'match($0,"\"/jira/secure/attachment/[0-9]*/[^\"]*"){print substr($0,RSTART+1,RLENGTH-1)}' "${PATCH_DIR}/jira" |
+          ${GREP} -v -e 'htm[l]*$' | sort | tail -1)
         PATCHURL="http://issues.apache.org${relativePatchURL}"
         if [[ ! ${PATCHURL} =~ \.patch$ ]]; then
           notSureIfPatch=true
         fi
-        patchNum=$(echo "${PATCHURL}" | ${GREP} -o '[0-9]*/' | ${GREP} -o '[0-9]*')
+        #shellcheck disable=SC2016
+        patchNum=$(echo "${PATCHURL}" | ${AWK} 'match($0,"[0-9]*/"){print substr($0,RSTART,RLENGTH-1)}')
         echo "${ISSUE} patch is being downloaded at $(date) from"
       fi
     fi