HADOOP-13088. fix shellprofiles in hadoop-tools to allow replacement

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

Branch: refs/heads/HADOOP-12930
Commit: b3a7b75df008f231e518e54d1aebe57b5d13926a
Parents: ec7e8c3
Author: Allen Wittenauer <a...@apache.org>
Authored: Wed May 4 12:44:47 2016 -0700
Committer: Allen Wittenauer <a...@apache.org>
Committed: Wed May 4 20:43:21 2016 -0700

----------------------------------------------------------------------
 .../main/shellprofile.d/hadoop-archive-logs.sh  | 14 ++++++---
 .../src/main/shellprofile.d/hadoop-archives.sh  | 33 +++++++++++++++-----
 .../src/main/shellprofile.d/hadoop-distcp.sh    | 33 +++++++++++++++-----
 .../src/main/shellprofile.d/hadoop-extras.sh    | 14 ++++++---
 4 files changed, 71 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b3a7b75d/hadoop-tools/hadoop-archive-logs/src/main/shellprofile.d/hadoop-archive-logs.sh
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-archive-logs/src/main/shellprofile.d/hadoop-archive-logs.sh
 
b/hadoop-tools/hadoop-archive-logs/src/main/shellprofile.d/hadoop-archive-logs.sh
index d37411e..ae7b6c6 100755
--- 
a/hadoop-tools/hadoop-archive-logs/src/main/shellprofile.d/hadoop-archive-logs.sh
+++ 
b/hadoop-tools/hadoop-archive-logs/src/main/shellprofile.d/hadoop-archive-logs.sh
@@ -15,14 +15,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [[ "${HADOOP_SHELL_EXECNAME}" = mapred ]]; then
-  hadoop_add_subcommand "archive-logs" "combine aggregated logs into hadoop 
archives"
-fi
+if ! declare -f mapred_subcommand_archive-logs >/dev/null 2>/dev/null; then
+
+  if [[ "${HADOOP_SHELL_EXECNAME}" = mapred ]]; then
+    hadoop_add_subcommand "archive-logs" "combine aggregated logs into hadoop 
archives"
+  fi
+
+  # this can't be indented otherwise shelldocs won't get it
 
 ## @description  archive-logs command for mapred
 ## @audience     public
 ## @stability    stable
-## @replaceable  no
+## @replaceable  yes
 function mapred_subcommand_archive-logs
 {
   # shellcheck disable=SC2034
@@ -31,3 +35,5 @@ function mapred_subcommand_archive-logs
   hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS"
   HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}"
 }
+
+fi

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b3a7b75d/hadoop-tools/hadoop-archives/src/main/shellprofile.d/hadoop-archives.sh
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-archives/src/main/shellprofile.d/hadoop-archives.sh 
b/hadoop-tools/hadoop-archives/src/main/shellprofile.d/hadoop-archives.sh
index b85ff25..f74fe5b 100755
--- a/hadoop-tools/hadoop-archives/src/main/shellprofile.d/hadoop-archives.sh
+++ b/hadoop-tools/hadoop-archives/src/main/shellprofile.d/hadoop-archives.sh
@@ -15,15 +15,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [[ "${HADOOP_SHELL_EXECNAME}" = hadoop
-   || "${HADOOP_SHELL_EXECNAME}" = mapred ]]; then
-  hadoop_add_subcommand "archive" "create a Hadoop archive"
-fi
+if ! declare -f hadoop_subcommand_archive >/dev/null 2>/dev/null; then
+
+  if [[ "${HADOOP_SHELL_EXECNAME}" = hadoop ]]; then
+    hadoop_add_subcommand "archive" "create a Hadoop archive"
+  fi
+
+  # this can't be indented otherwise shelldocs won't get it
 
 ## @description  archive command for hadoop (and mapred)
 ## @audience     public
 ## @stability    stable
-## @replaceable  no
+## @replaceable  yes
 function hadoop_subcommand_archive
 {
   # shellcheck disable=SC2034
@@ -31,11 +34,25 @@ function hadoop_subcommand_archive
   hadoop_add_to_classpath_tools hadoop-archives
 }
 
-## @description  archive-logs command for mapred (calls hadoop version)
+fi
+
+if ! declare -f mapred_subcommand_archive >/dev/null 2>/dev/null; then
+
+  if [[ "${HADOOP_SHELL_EXECNAME}" = mapred ]]; then
+    hadoop_add_subcommand "archive" "create a Hadoop archive"
+  fi
+
+  # this can't be indented otherwise shelldocs won't get it
+
+## @description  archive command for mapred (calls hadoop version)
 ## @audience     public
 ## @stability    stable
-## @replaceable  no
+## @replaceable  yes
 function mapred_subcommand_archive
 {
-  hadoop_subcommand_archive
+  # shellcheck disable=SC2034
+  HADOOP_CLASSNAME=org.apache.hadoop.tools.HadoopArchives
+  hadoop_add_to_classpath_tools hadoop-archives
 }
+
+fi

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b3a7b75d/hadoop-tools/hadoop-distcp/src/main/shellprofile.d/hadoop-distcp.sh
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-distcp/src/main/shellprofile.d/hadoop-distcp.sh 
b/hadoop-tools/hadoop-distcp/src/main/shellprofile.d/hadoop-distcp.sh
index 6cb13fc..0178c54 100755
--- a/hadoop-tools/hadoop-distcp/src/main/shellprofile.d/hadoop-distcp.sh
+++ b/hadoop-tools/hadoop-distcp/src/main/shellprofile.d/hadoop-distcp.sh
@@ -15,15 +15,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [[ "${HADOOP_SHELL_EXECNAME}" = hadoop
-   || "${HADOOP_SHELL_EXECNAME}" = mapred ]]; then
-  hadoop_add_subcommand "distcp" "copy file or directories recursively"
-fi
+if ! declare -f hadoop_subcommand_distcp >/dev/null 2>/dev/null; then
+
+  if [[ "${HADOOP_SHELL_EXECNAME}" = hadoop ]]; then
+    hadoop_add_subcommand "distcp" "copy file or directories recursively"
+  fi
+
+  # this can't be indented otherwise shelldocs won't get it
 
 ## @description  distcp command for hadoop
 ## @audience     public
 ## @stability    stable
-## @replaceable  no
+## @replaceable  yes
 function hadoop_subcommand_distcp
 {
   # shellcheck disable=SC2034
@@ -33,11 +36,27 @@ function hadoop_subcommand_distcp
   HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}"
 }
 
+fi
+
+if ! declare -f mapred_subcommand_distcp >/dev/null 2>/dev/null; then
+
+  if [[ "${HADOOP_SHELL_EXECNAME}" = mapred ]]; then
+    hadoop_add_subcommand "distcp" "copy file or directories recursively"
+  fi
+
+  # this can't be indented otherwise shelldocs won't get it
+
 ## @description  distcp command for mapred (calls hadoop)
 ## @audience     public
 ## @stability    stable
-## @replaceable  no
+## @replaceable  yes
 function mapred_subcommand_distcp
 {
-  hadoop_subcommand_distcp
+  # shellcheck disable=SC2034
+  HADOOP_CLASSNAME=org.apache.hadoop.tools.DistCp
+  hadoop_add_to_classpath_tools hadoop-distcp
+  hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS"
+  HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}"
 }
+
+fi

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b3a7b75d/hadoop-tools/hadoop-extras/src/main/shellprofile.d/hadoop-extras.sh
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-extras/src/main/shellprofile.d/hadoop-extras.sh 
b/hadoop-tools/hadoop-extras/src/main/shellprofile.d/hadoop-extras.sh
index e599334..829d406 100755
--- a/hadoop-tools/hadoop-extras/src/main/shellprofile.d/hadoop-extras.sh
+++ b/hadoop-tools/hadoop-extras/src/main/shellprofile.d/hadoop-extras.sh
@@ -15,14 +15,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-if [[ "${HADOOP_SHELL_EXECNAME}" = hadoop ]]; then
-  hadoop_add_subcommand "distch" "distributed metadata changer"
-fi
+if ! declare -f hadoop_subcommand_distch >/dev/null 2>/dev/null; then
+
+  if [[ "${HADOOP_SHELL_EXECNAME}" = hadoop ]]; then
+    hadoop_add_subcommand "distch" "distributed metadata changer"
+  fi
+
+  # this can't be indented otherwise shelldocs won't get it
 
 ## @description  distch command for hadoop
 ## @audience     public
 ## @stability    stable
-## @replaceable  no
+## @replaceable  yes
 function hadoop_subcommand_distch
 {
   # shellcheck disable=SC2034
@@ -31,3 +35,5 @@ function hadoop_subcommand_distch
   hadoop_debug "Appending HADOOP_CLIENT_OPTS onto HADOOP_OPTS"
   HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_CLIENT_OPTS}"
 }
+
+fi


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to