diff --git a/jenkins/scripts/baremetal-deploy.sh b/jenkins/scripts/baremetal-deploy.sh index 0421529e3d..b19c7285c7 100755 --- a/jenkins/scripts/baremetal-deploy.sh +++ b/jenkins/scripts/baremetal-deploy.sh @@ -1,9 +1,9 @@ #!/bin/bash -xe -WORKSPACE=`pwd` +WORKSPACE=$(pwd) mkdir -p logs rm -f logs/* -cd `dirname "$0"` +cd $(dirname "$0") echo "Jenkins: resetting hosts..." for host in $HEAD_HOST ${COMPUTE_HOSTS//,/ }; do @@ -33,8 +33,8 @@ cd ~/devstack source stackrc for image_url in ${IMAGE_URLS//,/ }; do # Downloads the image (uec ami+aki style), then extracts it. - IMAGE_FNAME=`echo "$image_url" | python -c "import sys; print sys.stdin.read().split('/')[-1]"` - IMAGE_NAME=`echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]"` + IMAGE_FNAME=$(echo "$image_url" | python -c "import sys; print sys.stdin.read().split('/')[-1]") + IMAGE_NAME=$(echo "$IMAGE_FNAME" | python -c "import sys; print sys.stdin.read().split('.tar.gz')[0].split('.tgz')[0]") if [ ! -f files/$IMAGE_FNAME ]; then wget -c $image_url -O files/$IMAGE_FNAME fi diff --git a/jenkins/scripts/bump-milestone.sh b/jenkins/scripts/bump-milestone.sh index 4f579038d9..fd9832593a 100644 --- a/jenkins/scripts/bump-milestone.sh +++ b/jenkins/scripts/bump-milestone.sh @@ -37,7 +37,7 @@ fi # Normally a branch name will just be a file, but we can have branches # like stable/diablo, so in that case, make the "stable/" directory # if needed: -mkdir -p `dirname $BRANCH` +mkdir -p $(dirname $BRANCH) # Read and update the value for the branch if [ -e "$BRANCH" ]; then diff --git a/jenkins/scripts/common_translation_update.sh b/jenkins/scripts/common_translation_update.sh index 17f10ed8a2..06215236df 100644 --- a/jenkins/scripts/common_translation_update.sh +++ b/jenkins/scripts/common_translation_update.sh @@ -175,10 +175,10 @@ EOF # See if there is an open change in the transifex/translations # topic. If so, get the change id for the existing change for use # in the commit msg. - change_info=`ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set status:open project:$FULL_PROJECT topic:transifex/translations owner:proposal-bot` - previous=`echo "$change_info" | grep "^ number:" | awk '{print $2}'` + change_info=$(ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set status:open project:$FULL_PROJECT topic:transifex/translations owner:proposal-bot) + previous=$(echo "$change_info" | grep "^ number:" | awk '{print $2}') if [ -n "$previous" ]; then - change_id=`echo "$change_info" | grep "^change" | awk '{print $2}'` + change_id=$(echo "$change_info" | grep "^change" | awk '{print $2}') # Read returns a non zero value when it reaches EOF. Because we use a # heredoc here it will always reach EOF and return a nonzero value. # Disable -e temporarily to get around the read. @@ -199,7 +199,7 @@ EOF # run. if [ -n "$previous" ]; then # Use the JSON format since it is very compact and easy to grep - change_info=`ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set --format=JSON $change_id` + change_info=$(ssh -p 29418 proposal-bot@review.openstack.org gerrit query --current-patch-set --format=JSON $change_id) # Check for: # 1) Workflow approval (+1) # 2) no -1/-2 by Jenkins @@ -228,7 +228,7 @@ function send_patch { fi # Don't send a review if nothing has changed. - if [ `git diff --cached |wc -l` -gt 0 ]; then + if [ $(git diff --cached | wc -l) -gt 0 ]; then # Commit and review git commit -F- <&1` + trans=$(msgfmt --statistics -o /dev/null "$i" 2>&1) check="^0 translated messages" if [[ $trans =~ $check ]] ; then # Nothing is translated, remove the file. git rm -f "$i" else if [[ $trans =~ " translated message" ]] ; then - trans_no=`echo $trans|sed -e 's/ translated message.*$//'` + trans_no=$(echo $trans|sed -e 's/ translated message.*$//') else trans_no=0 fi if [[ $trans =~ " untranslated message" ]] ; then - untrans_no=`echo $trans|sed -e 's/^.* \([0-9]*\) untranslated message.*/\1/'` + untrans_no=$(echo $trans|sed -e 's/^.* \([0-9]*\) untranslated message.*/\1/') else untrans_no=0 fi @@ -388,7 +388,7 @@ function cleanup_po_files { function compress_po_files { local directory=$1 - for i in `find $directory -name *.po `; do + for i in $(find $directory -name *.po) ; do msgattrib --translated --no-location --sort-output "$i" \ --output="${i}.tmp" mv "${i}.tmp" "$i" @@ -404,7 +404,7 @@ function compress_po_files { function compress_manual_po_files { local directory=$1 local glossary=$2 - for i in `find $directory -name *.po `; do + for i in $(find $directory -name *.po) ; do if [ "$glossary" -eq "0" ] ; then if [[ $i =~ "/glossary/" ]] ; then continue @@ -425,7 +425,7 @@ function compress_manual_po_files { function compress_non_en_po_files { local directory=$1 - for i in `find $directory -name *.po `; do + for i in $(find $directory -name *.po); do if [[ $i =~ "/locale/en/LC_MESSAGES/" ]] ; then continue fi diff --git a/jenkins/scripts/jenkinsci-upload.sh b/jenkins/scripts/jenkinsci-upload.sh index 485c343ed5..57899cab28 100644 --- a/jenkins/scripts/jenkinsci-upload.sh +++ b/jenkins/scripts/jenkinsci-upload.sh @@ -22,10 +22,10 @@ META_DATA_FILE=$3 PLUGIN_FILE=$4 # Strip project name and extension leaving only the version. -VERSION=`echo ${PLUGIN_FILE} | sed -n "s/${PROJECT}-\(.*\).hpi/\1/p"` +VERSION=$(echo ${PLUGIN_FILE} | sed -n "s/${PROJECT}-\(.*\).hpi/\1/p") # generate pom file with version info -POM_IN_ZIP=`unzip -Z -1 ${PLUGIN_FILE}|grep pom.xml` +POM_IN_ZIP=$(unzip -Z -1 ${PLUGIN_FILE}|grep pom.xml) unzip -o -j ${PLUGIN_FILE} ${POM_IN_ZIP} sed "s/\${{project-version}}/${VERSION}/g" ${META_DATA_FILE} diff --git a/jenkins/scripts/lvm-kexec-reset.sh b/jenkins/scripts/lvm-kexec-reset.sh index 0916b05018..10fb8fa192 100755 --- a/jenkins/scripts/lvm-kexec-reset.sh +++ b/jenkins/scripts/lvm-kexec-reset.sh @@ -2,6 +2,6 @@ lvremove -f /dev/main/last_root lvrename /dev/main/root last_root lvcreate -L20G -s -n root /dev/main/orig_root -APPEND="`cat /proc/cmdline`" +APPEND="$(cat /proc/cmdline)" kexec -l /vmlinuz --initrd=/initrd.img --append="$APPEND" nohup bash -c "sleep 2; kexec -e" /dev/null 2>&1 & diff --git a/jenkins/scripts/mavencentral-upload.sh b/jenkins/scripts/mavencentral-upload.sh index cd162ecf65..8037287dce 100644 --- a/jenkins/scripts/mavencentral-upload.sh +++ b/jenkins/scripts/mavencentral-upload.sh @@ -22,10 +22,10 @@ META_DATA_FILE=$3 PLUGIN_FILE=$4 # Strip project name and extension leaving only the version. -VERSION=`echo ${PLUGIN_FILE} | sed -n "s/${PROJECT}-\(.*\).jar/\1/p"` +VERSION=$(echo ${PLUGIN_FILE} | sed -n "s/${PROJECT}-\(.*\).jar/\1/p") # generate pom file with version info -POM_IN_ZIP=`unzip -Z -1 ${PLUGIN_FILE}|grep pom.xml` +POM_IN_ZIP=$(unzip -Z -1 ${PLUGIN_FILE}|grep pom.xml) unzip -o -j ${PLUGIN_FILE} ${POM_IN_ZIP} sed "s/\${{project-version}}/${VERSION}/g" ${META_DATA_FILE} diff --git a/jenkins/scripts/merge_tags.sh b/jenkins/scripts/merge_tags.sh index 4ae1693477..4dec21972d 100755 --- a/jenkins/scripts/merge_tags.sh +++ b/jenkins/scripts/merge_tags.sh @@ -34,8 +34,8 @@ git review -s git remote update git checkout master git reset --hard origin/master -MASTER_MINOR=`git describe|cut -d. -f-2` -TAG_MINOR=`echo $TAG|cut -d. -f-2` +MASTER_MINOR=$(git describe|cut -d. -f-2) +TAG_MINOR=$(echo $TAG | cut -d. -f-2) # If the tag is for an earlier version than master's, skip if [ "$(echo $(echo -e "$MASTER_MINOR\n$TAG_MINOR"|sort -V))" \ diff --git a/jenkins/scripts/propose_translation_update.sh b/jenkins/scripts/propose_translation_update.sh index 7f206a07ec..8e74e9f4d9 100755 --- a/jenkins/scripts/propose_translation_update.sh +++ b/jenkins/scripts/propose_translation_update.sh @@ -44,7 +44,7 @@ tx pull -f extract_messages_log "$PROJECT" # Update existing translation files with extracted messages. -PO_FILES=`find ${PROJECT}/locale -name "${PROJECT}.po"` +PO_FILES=$(find ${PROJECT}/locale -name "${PROJECT}.po") if [ -n "$PO_FILES" ]; then # Use updated .pot file to update translations python setup.py $QUIET update_catalog \ @@ -55,7 +55,7 @@ fi # add the messages with the default keywords. Therefore use msgmerge # directly. for level in $LEVELS ; do - PO_FILES=`find ${PROJECT}/locale -name "${PROJECT}-log-${level}.po"` + PO_FILES=$(find ${PROJECT}/locale -name "${PROJECT}-log-${level}.po") if [ -n "$PO_FILES" ]; then for f in $PO_FILES ; do echo "Updating $f" diff --git a/jenkins/scripts/propose_translation_update_django_openstack_auth.sh b/jenkins/scripts/propose_translation_update_django_openstack_auth.sh index 82e669ddd0..6e5d802a1d 100755 --- a/jenkins/scripts/propose_translation_update_django_openstack_auth.sh +++ b/jenkins/scripts/propose_translation_update_django_openstack_auth.sh @@ -36,7 +36,7 @@ tx pull -f # Update the .pot file python setup.py extract_messages -PO_FILES=`find openstack_auth/locale -name '*.po'` +PO_FILES=$(find openstack_auth/locale -name '*.po') if [ -n "$PO_FILES" ]; then # Use updated .pot file to update translations python setup.py update_catalog --no-fuzzy-matching --ignore-obsolete=true diff --git a/jenkins/scripts/propose_update.sh b/jenkins/scripts/propose_update.sh index bfe8a9c603..abfbd5c25a 100755 --- a/jenkins/scripts/propose_update.sh +++ b/jenkins/scripts/propose_update.sh @@ -79,7 +79,7 @@ for PROJECT in $PROJECTS; do if git branch -a | grep -q "^ remotes/origin/$ZUUL_REF$" ; then BRANCH=$ZUUL_REF elif echo $ZUUL_REF | grep -q "^stable/" ; then - FALLBACK=`echo $ZUUL_REF | sed s,^stable/,proposed/,` + FALLBACK=$(echo $ZUUL_REF | sed s,^stable/,proposed/,) if git branch -a | grep -q "^ remotes/origin/$FALLBACK$" ; then BRANCH=$FALLBACK fi diff --git a/jenkins/scripts/pypi-tarball-upload.sh b/jenkins/scripts/pypi-tarball-upload.sh index 25372b080e..411aab501d 100755 --- a/jenkins/scripts/pypi-tarball-upload.sh +++ b/jenkins/scripts/pypi-tarball-upload.sh @@ -19,12 +19,12 @@ PROJECT=$1 TARBALL_SITE=$2 -TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'` +TAG=$(echo $ZUUL_REF | sed 's/^refs.tags.//') # Look in the setup.cfg to determine if a package name is specified, but # fall back on the project name if necessary -DISTNAME=`/usr/local/jenkins/slave_scripts/pypi-extract-name.py --tarball \ - || echo $PROJECT` +DISTNAME=$(/usr/local/jenkins/slave_scripts/pypi-extract-name.py --tarball \ + || echo $PROJECT) FILENAME="$DISTNAME-$TAG.tar.gz" rm -rf *tar.gz diff --git a/jenkins/scripts/pypi-wheel-upload.sh b/jenkins/scripts/pypi-wheel-upload.sh index 3ba3ca1589..9d37d72e25 100755 --- a/jenkins/scripts/pypi-wheel-upload.sh +++ b/jenkins/scripts/pypi-wheel-upload.sh @@ -19,14 +19,14 @@ PROJECT=$1 TARBALL_SITE=$2 -TAG=`echo $ZUUL_REF | sed 's/^refs.tags.//'` +TAG=$(echo $ZUUL_REF | sed 's/^refs.tags.//') # Look in the setup.cfg to determine if a package name is specified, but # fall back on the project name if necessary -DISTNAME=`/usr/local/jenkins/slave_scripts/pypi-extract-name.py --wheel \ - || echo $PROJECT` +DISTNAME=$(/usr/local/jenkins/slave_scripts/pypi-extract-name.py --wheel \ + || echo $PROJECT) # Look in the setup.cfg to see if this is a universal wheel or not -WHEELTYPE=`/usr/local/jenkins/slave_scripts/pypi-extract-universal.py` +WHEELTYPE=$(/usr/local/jenkins/slave_scripts/pypi-extract-universal.py) FILENAME="$DISTNAME-$TAG-$WHEELTYPE-none-any.whl" rm -rf *.whl diff --git a/jenkins/scripts/run-docs.sh b/jenkins/scripts/run-docs.sh index a00e34a44f..8bd4104dc8 100755 --- a/jenkins/scripts/run-docs.sh +++ b/jenkins/scripts/run-docs.sh @@ -29,16 +29,16 @@ elif `echo $ZUUL_REFNAME | grep refs/tags/ >/dev/null` ; then # at BUILD_DIR remains. When Jenkins copies this file the root developer # docs are always the latest release with older tags available under the # root in the tagname dir. - TAG=`echo $ZUUL_REFNAME | sed 's/refs.tags.//'` + TAG=$(echo $ZUUL_REFNAME | sed 's/refs.tags.//') if [ ! -z $TAG ] ; then if echo $ZUUL_PROJECT | grep 'python-.*client' ; then # This is a hack to ignore the year.release tags in python-*client # projects. - LATEST=`git tag | sed -n -e '/^2012\..*$/d' -e '/^\([0-9]\+\.\?\)\+$/p' | sort -V | tail -1` + LATEST=$(git tag | sed -n -e '/^2012\..*$/d' -e '/^\([0-9]\+\.\?\)\+$/p' | sort -V | tail -1) else # Take all tags of the form (number.)+, sort them, then take the # largest - LATEST=`git tag | sed -n '/^\([0-9]\+\.\?\)\+$/p' | sort -V | tail -1` + LATEST=$(git tag | sed -n '/^\([0-9]\+\.\?\)\+$/p' | sort -V | tail -1) fi if [ "$TAG" = "$LATEST" ] ; then # Copy the docs into a subdir if this is a tagged build @@ -56,7 +56,7 @@ elif `echo $ZUUL_REFNAME | grep stable/ >/dev/null` ; then # Put stable release changes in dir named after stable release under the # build dir. When Jenkins copies these files they will be accessible under # the developer docs root using the stable release's name. - BRANCH=`echo $ZUUL_REFNAME | sed 's/stable.//'` + BRANCH=$(echo $ZUUL_REFNAME | sed 's/stable.//') if [ ! -z $BRANCH ] ; then # Move the docs into a subdir if this is a stable branch build mkdir doc/build/$BRANCH diff --git a/jenkins/scripts/run-tox.sh b/jenkins/scripts/run-tox.sh index 07a5619b67..8c85433377 100755 --- a/jenkins/scripts/run-tox.sh +++ b/jenkins/scripts/run-tox.sh @@ -117,7 +117,7 @@ export PYTHON=$bin_path/python export NOSE_WITH_XUNIT=1 export NOSE_WITH_HTML_OUTPUT=1 export NOSE_HTML_OUT_FILE='nose_results.html' -export TMPDIR=`/bin/mktemp -d` +export TMPDIR=$(/bin/mktemp -d) trap "rm -rf $TMPDIR" EXIT cat /etc/image-hostname.txt diff --git a/jenkins/scripts/run-xmllint.sh b/jenkins/scripts/run-xmllint.sh index 4edf7d61bd..b881fae530 100755 --- a/jenkins/scripts/run-xmllint.sh +++ b/jenkins/scripts/run-xmllint.sh @@ -1,4 +1,4 @@ #!/bin/bash -xe mkdir -p target/ -/usr/bin/xmllint -noent $1 > target/`basename $1` +/usr/bin/xmllint -noent $1 > target/$(basename $1) diff --git a/jenkins/scripts/upstream_translation_horizon.sh b/jenkins/scripts/upstream_translation_horizon.sh index 75b5b59b83..837807e152 100755 --- a/jenkins/scripts/upstream_translation_horizon.sh +++ b/jenkins/scripts/upstream_translation_horizon.sh @@ -37,7 +37,7 @@ setup_horizon git add ${PROJECT}/locale/en/LC_MESSAGES/* git add openstack_dashboard/locale/en/LC_MESSAGES/* -if [ `git diff --cached | egrep -v "(POT-Creation-Date|^[\+\-]#|^\+{3}|^\-{3})" | egrep -c "^[\-\+]"` -gt 0 ]; then +if [ $(git diff --cached | egrep -v "(POT-Creation-Date|^[\+\-]#|^\+{3}|^\-{3})" | egrep -c "^[\-\+]") -gt 0 ]; then # Push source file changes to transifex tx --debug --traceback push -s fi diff --git a/jenkins/scripts/version-properties.sh b/jenkins/scripts/version-properties.sh index 7dffc05e9d..cbbd0db6e5 100755 --- a/jenkins/scripts/version-properties.sh +++ b/jenkins/scripts/version-properties.sh @@ -5,11 +5,11 @@ # # get version info from scm -SCM_TAG=`git describe --abbrev=0 --tags` || true -SCM_SHA=`git rev-parse --short HEAD` || true +SCM_TAG=$(git describe --abbrev=0 --tags) || true +SCM_SHA=$(git rev-parse --short HEAD) || true # assumes format is like this '0.0.4-2-g135721c' -COMMITS_SINCE_TAG=`git describe | awk '{split($0,a,"-"); print a[2]}'` || true +COMMITS_SINCE_TAG=$(git describe | awk '{split($0,a,"-"); print a[2]}') || true # just use git sha if there is no tag yet. if [[ "${SCM_TAG}" == "" ]]; then