summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-09-11 05:10:42 +0000
committerJens Arnold <amiconn@rockbox.org>2007-09-11 05:10:42 +0000
commit03cf6669b16f904c7a1e5a4ddabef7bd1769f8a5 (patch)
tree9e25710f25d02d4e7f75fbf265b40b9153acd3d9 /tools
parent61aa70c4831d10f1ff7a5a2ab773b8723de08d13 (diff)
downloadrockbox-03cf6669b16f904c7a1e5a4ddabef7bd1769f8a5.tar.gz
rockbox-03cf6669b16f904c7a1e5a4ddabef7bd1769f8a5.tar.bz2
rockbox-03cf6669b16f904c7a1e5a4ddabef7bd1769f8a5.zip
FS#7748 by Catalin Patulea - Fix svnversion.sh for localization and failure corner-cases.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14668 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/svnversion.sh32
1 files changed, 19 insertions, 13 deletions
diff --git a/tools/svnversion.sh b/tools/svnversion.sh
index f30d4193eb..1744e98c6e 100755
--- a/tools/svnversion.sh
+++ b/tools/svnversion.sh
@@ -10,25 +10,31 @@
# Usage: svnversion.sh [source-root]
+# Prints the revision "rXYZ" of the first argument, as reported by svnversion.
+# Prints "unknown" if svnversion fails or says "exported".
+svnversion_safe() {
+ # LANG=C forces svnversion to not localize "exported".
+ if OUTPUT=`LANG=C svnversion "$@"`; then
+ if [ "$OUTPUT" = "exported" ]; then
+ echo "unknown"
+ else
+ echo "r$OUTPUT"
+ fi
+ else
+ echo "unknown"
+ fi
+}
+
VERSIONFILE=docs/VERSION
if [ -n "$1" ]; then TOP=$1; else TOP=..; fi
if [ -r $TOP/$VERSIONFILE ]; then SVNVER=`cat $TOP/$VERSIONFILE`;
-else if [ `which svnversion 2>/dev/null` ]; then
- SVNALT=`svnversion $1`;
- if [ "$SVNALT" = "exported" ]; then
+else
+ SVNVER=`svnversion_safe $TOP`;
+ if [ "$SVNVER" = "unknown" ]; then
# try getting it from a subdir to test if perhaps they are symlinked
# from the root
- SVNALT=`svnversion $1/tools`
- if [ "$SVNALT" != exported ]; then
- # yeah, it is there so we use this
- SVNVER="r$SVNALT"
- else
- SVNALT="unknown";
- fi
- else
- SVNVER="r$SVNALT";
+ SVNVER=`svnversion_safe $TOP/tools`;
fi
-else SVNVER="unknown"; fi
fi
VERSION=$SVNVER-`date -u +%y%m%d`
echo $VERSION