Merge "Misc. install_rally.sh improvements"

This commit is contained in:
Jenkins 2016-02-12 20:36:35 +00:00 committed by Gerrit Code Review
commit 115e66cf24

View File

@ -21,6 +21,7 @@ VERBOSE=""
ASKCONFIRMATION=1
RECREATEDEST="ask"
USEVIRTUALENV="yes"
DEVELOPMENT_MODE="false"
# ansi colors for formatting heredoc
ESC=$(printf "\e")
@ -702,15 +703,14 @@ BASEDIR=$(dirname "$(readlink -e "$0")")
if [ -d "$BASEDIR"/.git ]
then
SOURCEDIR=$BASEDIR
pushd $BASEDIR > /dev/null
if find . -name '*.py[co]' -exec rm -f {} +
then
echo "Wiped python compiled files."
else
echo "Warning! Unable to wipe python compiled files"
fi
popd > /dev/null
(
cd "$BASEDIR"
if find . -name '*.py[co]' -exec rm -f {} +; then
echo "Wiped python compiled files."
else
echo "Warning! Unable to wipe python compiled files"
fi
)
else
if [ "$USEVIRTUALENV" = 'yes' ]
then
@ -721,11 +721,10 @@ else
if ! [ -d "$SOURCEDIR"/.git ]
then
echo "Downloading Rally from subversion repository $RALLY_GIT_URL ..."
echo "Downloading Rally from git repository $RALLY_GIT_URL ..."
CURRENT_ACTION="downloading-src"
git clone "$RALLY_GIT_URL" -b "$RALLY_GIT_BRANCH" "$SOURCEDIR"
if ! [ -d $SOURCEDIR/.git ]
then
if ! [ -d "$SOURCEDIR"/.git ]; then
abort $EX_CANTCREAT "Unable to download git repository"
fi
CURRENT_ACTION="src-downloaded"
@ -737,19 +736,18 @@ install_db_connector
# Install rally
cd "$SOURCEDIR"
# Get latest available pip and reset shell cache
pip install -i $BASE_PIP_URL -U 'pip!=8'
pip install -i "$BASE_PIP_URL" -U 'pip!=8'
hash -r
# Install dependencies
pip install -i $BASE_PIP_URL pbr 'tox<=1.6.1'
pip install -i "$BASE_PIP_URL" pbr 'tox<=1.6.1'
# Uninstall possible previous version
pip uninstall -y rally || true
# Install rally
if [ $DEVELOPMENT_MODE ]
then
pip install -i $BASE_PIP_URL -e .
if [ "$DEVELOPMENT_MODE" = "true" ]; then
pip install -i "$BASE_PIP_URL" -e .
else
pip install -i $BASE_PIP_URL .
pip install -i "$BASE_PIP_URL" .
fi
cd "$ORIG_WD"
@ -765,16 +763,14 @@ __EOF__
setup_rally_configuration "$SOURCEDIR"
if ! [ $DEVELOPMENT_MODE ]
then
if ! [ "$DEVELOPMENT_MODE" = "true" ]; then
SAMPLESDIR=$VENVDIR/samples
mkdir -p $SAMPLESDIR
cp -r $SOURCEDIR/samples/* $SAMPLESDIR/
else
SAMPLESDIR=$SOURCEDIR/samples
mkdir -p "$SAMPLESDIR"
cp -r "$SOURCEDIR"/samples/* "$SAMPLESDIR"/
fi
mkdir -p $VENVDIR/etc/bash_completion.d
install $SOURCEDIR/etc/rally.bash_completion $VENVDIR/etc/bash_completion.d/
mkdir -p "$VENVDIR"/etc/bash_completion.d
install "$SOURCEDIR"/etc/rally.bash_completion \
"$VENVDIR"/etc/bash_completion.d/
cat <<__EOF__
$GREEN==============================
@ -801,15 +797,13 @@ __EOF__
else
setup_rally_configuration "$SOURCEDIR"
if ! [ $DEVELOPMENT_MODE ]
then
if ! [ "$DEVELOPMENT_MODE" = "true" ]; then
SAMPLESDIR=/usr/share/rally/samples
mkdir -p $SAMPLESDIR
cp -r $SOURCEDIR/samples/* $SAMPLESDIR/
else
SAMPLESDIR=$SOURCEDIR/samples
mkdir -p "$SAMPLESDIR"
cp -r "$SOURCEDIR"/samples/* "$SAMPLESDIR"/
fi
ln -s /usr/local/etc/bash_completion.d/rally.bash_completion /etc/bash_completion.d/ 2> /dev/null || true
ln -s /usr/local/etc/bash_completion.d/rally.bash_completion \
/etc/bash_completion.d/ 2> /dev/null || true
if [ -f "${DBFILE}" ]; then
chmod 777 "$DBFILE"
fi