Make bump-versions.sh work

This also makes it behave when called from from any directory.
This commit is contained in:
Christian Marie 2015-07-06 17:05:45 +10:00
parent e3c3ba2aeb
commit 1efe9f1a2a
2 changed files with 9 additions and 4 deletions

View file

@ -16,7 +16,8 @@
set -o nounset set -o nounset
set -o errexit set -o errexit
. lib/common.sh DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
. "${DIR}/scripts/lib/common.sh"
usage () { usage () {
echo " bump-versions.sh <POSITION> [-d|--dry-run]" echo " bump-versions.sh <POSITION> [-d|--dry-run]"
@ -54,8 +55,11 @@ while [ "${1:-unset}" != "unset" ] ; do
done done
if $DRY_RUN ; then if $DRY_RUN ; then
bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}") echo "Would have bumped position ${POSITION} on these packages:"
( cd "$ROOT" && bumper --dry-run -"$POSITION" $(join , "${SOURCES[@]}") )
else else
bumper -"$POSITION" $(join , "${SOURCES[@]}") ( cd "$ROOT" && bumper -"$POSITION" $(join , "${SOURCES[@]}") )
fi fi
# Trailing newline, bumper does not ship with its own.
echo

View file

@ -11,6 +11,7 @@
DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )) DIR=$( dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
ROOT=$( dirname $DIR )
DRY_RUN=false DRY_RUN=false
POSITION="none" POSITION="none"
SOURCES_TXT="$( dirname $DIR)/sources.txt" SOURCES_TXT="$( dirname $DIR)/sources.txt"
@ -22,7 +23,7 @@ readarray -t SOURCES < "$SOURCES_TXT"
join () { local IFS="$1"; shift; echo "$*"; } join () { local IFS="$1"; shift; echo "$*"; }
versions_equal () { versions_equal () {
local NUM=$(find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l) local NUM=$(cd "$ROOT" && find . -name 'servant*.cabal' | xargs grep "^version:" | awk '{ print $2 }' | uniq -c | wc -l)
if [ 1 -eq $NUM ] ; then if [ 1 -eq $NUM ] ; then
return 0 return 0
else else