HBASE-1181 src/saveVersion.sh bails on non-standard Bourne shells (e.g. dash)

(K M via Jean-Daniel Cryans)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@740425 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2009-02-03 20:33:49 +00:00
parent 80eae9d2af
commit 46d3e17942
2 changed files with 24 additions and 9 deletions

View File

@ -15,6 +15,8 @@ Release 0.20.0 - Unreleased
sync (temporary until HADOOP-4379 is resolved)
HBASE-1121 Cluster confused about where -ROOT- is
HBASE-1148 Always flush HLog on root or meta region updates
HBASE-1181 src/saveVersion.sh bails on non-standard Bourne shells (e.g. dash)
(K M via Jean-Daniel Cryans)
IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -18,24 +18,37 @@
# This file is used to generate the annotation of package info that
# records the user, url, revision and timestamp.
#
# Copied from hadoop.
# Copied from hadoop core r740386
unset LANG
unset LC_CTYPE
version=$1
if [[ -d .svn ]]; then
revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'`
elif [[ -d .git ]]; then
revision=`git rev-list --max-count=1 HEAD`
url=`git config --get remote.origin.url`
fi
user=`whoami`
date=`date`
cwd=`pwd`
if [ -d .svn ]; then
revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
url=`svn info | sed -n -e 's/URL: \(.*\)/\1/p'`
# Get canonical branch (branches/X, tags/X, or trunk)
branch=`echo $url | sed -n -e 's,.*\(branches/.*\)$,\1,p' \
-e 's,.*\(tags/.*\)$,\1,p' \
-e 's,.*trunk$,trunk,p'`
elif [ -d .git ]; then
revision=`git log -1 --pretty=format:"%H"`
hostname=`hostname`
branch=`git branch | sed -n -e 's/^* //p'`
url="git://${hostname}${cwd}"
else
revision="Unknown"
branch="Unknown"
url="file://$cwd"
fi
mkdir -p build/src/org/apache/hadoop/hbase
cat << EOF | \
sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \
-e "s|URL|$url|" -e "s/REV/$revision/" \
-e "s|BRANCH|$branch|" \
> build/src/org/apache/hadoop/hbase/package-info.java
/*
* Generated by src/saveVersion.sh