From 308936cd356fa2c559fbc2b2e3273403437e5fe7 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Sun, 31 Oct 2010 21:52:48 +0000 Subject: fix make VERSION=x.y to work again git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28427 a1c6a512-1295-4272-9138-f99709370657 --- tools/version.sh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'tools') diff --git a/tools/version.sh b/tools/version.sh index 2e75004901..484a33189c 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -90,24 +90,27 @@ bzrversion() { # if [ -n "$1" ]; then TOP=$1; else TOP=..; fi -# If the VERSIONFILE exisits we use that -VERSIONFILE=docs/VERSION -if [ -r $TOP/$VERSIONFILE ]; then VER=`cat $TOP/$VERSIONFILE`; -else - # Ok, we need to derive it from the Version Control system - if [ -d "$TOP/.git" ]; then - VER=`gitversion $TOP` - elif [ -d "$TOP/.bzr" ]; then - VER=`bzrversion $TOP` +# setting VERSION var on commandline has precedence +if [ -z $VERSION ]; then + # If the VERSIONFILE exisits we use that + VERSIONFILE=docs/VERSION + if [ -r $TOP/$VERSIONFILE ]; then VER=`cat $TOP/$VERSIONFILE`; else - VER=`svnversion_safe $TOP`; - if [ "$VER" = "unknown" ]; then - # try getting it from a subdir to test if perhaps they are symlinked - # from the root - VER=`svnversion_safe $TOP/tools`; - fi + # Ok, we need to derive it from the Version Control system + if [ -d "$TOP/.git" ]; then + VER=`gitversion $TOP` + elif [ -d "$TOP/.bzr" ]; then + VER=`bzrversion $TOP` + else + VER=`svnversion_safe $TOP`; + if [ "$VER" = "unknown" ]; then + # try getting it from a subdir to test if perhaps they are symlinked + # from the root + VER=`svnversion_safe $TOP/tools`; + fi + fi fi -fi VERSION=$VER-`date -u +%y%m%d` +fi echo $VERSION -- cgit v1.2.3