hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject [hadoop] branch trunk updated: HADOOP-16334. Fix yetus-wrapper not working when HADOOP_YETUS_VERSION >= 0.9.0
Date Thu, 30 May 2019 06:12:34 GMT
This is an automated email from the ASF dual-hosted git repository.

aajisaka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d23e8e9  HADOOP-16334. Fix yetus-wrapper not working when HADOOP_YETUS_VERSION >=
0.9.0
d23e8e9 is described below

commit d23e8e9232f030fcdeff91b9e8a625516244dc72
Author: Wanqiang Ji <wanqiang.ji@gmail.com>
AuthorDate: Tue May 28 22:20:31 2019 +0800

    HADOOP-16334. Fix yetus-wrapper not working when HADOOP_YETUS_VERSION >= 0.9.0
    
    This closes #864
    
    Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
---
 dev-support/bin/yetus-wrapper | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/dev-support/bin/yetus-wrapper b/dev-support/bin/yetus-wrapper
index ae05d42..692216e 100755
--- a/dev-support/bin/yetus-wrapper
+++ b/dev-support/bin/yetus-wrapper
@@ -68,6 +68,10 @@ function yetus_abs
   return 1
 }
 
+function version_ge()
+{
+  test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1";
+}
 
 WANTED="$1"
 shift
@@ -77,11 +81,17 @@ HADOOP_YETUS_VERSION=${HADOOP_YETUS_VERSION:-0.8.0}
 BIN=$(yetus_abs "${BASH_SOURCE-$0}")
 BINDIR=$(dirname "${BIN}")
 
+## HADOOP_YETUS_VERSION >= 0.9.0 the tarball named with apache-yetus prefix
+if version_ge "${HADOOP_YETUS_VERSION}" "0.9.0"; then
+  YETUS_PREFIX=apache-yetus
+else
+  YETUS_PREFIX=yetus
+fi
+
 ###
 ###  if YETUS_HOME is set, then try to use it
 ###
-if [[ -n "${YETUS_HOME}"
-   && -x "${YETUS_HOME}/bin/${WANTED}" ]]; then
+if [[ -n "${YETUS_HOME}" && -x "${YETUS_HOME}/bin/${WANTED}" ]]; then
   exec "${YETUS_HOME}/bin/${WANTED}" "${ARGV[@]}"
 fi
 
@@ -105,8 +115,8 @@ HADOOP_PATCHPROCESS=${mytmpdir}
 ##
 ## if we've already DL'd it, then short cut
 ##
-if [[ -x "${HADOOP_PATCHPROCESS}/yetus-${HADOOP_YETUS_VERSION}/bin/${WANTED}" ]]; then
-  exec "${HADOOP_PATCHPROCESS}/yetus-${HADOOP_YETUS_VERSION}/bin/${WANTED}" "${ARGV[@]}"
+if [[ -x "${HADOOP_PATCHPROCESS}/${YETUS_PREFIX}-${HADOOP_YETUS_VERSION}/bin/${WANTED}" ]];
then
+  exec "${HADOOP_PATCHPROCESS}/${YETUS_PREFIX}-${HADOOP_YETUS_VERSION}/bin/${WANTED}" "${ARGV[@]}"
 fi
 
 ##
@@ -114,7 +124,7 @@ fi
 ##
 
 BASEURL="https://archive.apache.org/dist/yetus/${HADOOP_YETUS_VERSION}/"
-TARBALL="yetus-${HADOOP_YETUS_VERSION}-bin.tar"
+TARBALL="${YETUS_PREFIX}-${HADOOP_YETUS_VERSION}-bin.tar"
 
 GPGBIN=$(command -v gpg)
 CURLBIN=$(command -v curl)
@@ -166,9 +176,9 @@ if ! (gunzip -c "${TARBALL}.gz" | tar xpf -); then
   exit 1
 fi
 
-if [[ -x "${HADOOP_PATCHPROCESS}/yetus-${HADOOP_YETUS_VERSION}/bin/${WANTED}" ]]; then
+if [[ -x "${HADOOP_PATCHPROCESS}/${YETUS_PREFIX}-${HADOOP_YETUS_VERSION}/bin/${WANTED}" ]];
then
   popd >/dev/null
-  exec "${HADOOP_PATCHPROCESS}/yetus-${HADOOP_YETUS_VERSION}/bin/${WANTED}" "${ARGV[@]}"
+  exec "${HADOOP_PATCHPROCESS}/${YETUS_PREFIX}-${HADOOP_YETUS_VERSION}/bin/${WANTED}" "${ARGV[@]}"
 fi
 
 ##


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


Mime
View raw message