mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 09:19:17 +01:00
change svnrev.sh to find the real last rev-nr
This commit is contained in:
parent
0b0d6d5753
commit
f8cd80b183
44
svnrev.sh
44
svnrev.sh
@ -1,22 +1,38 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
#
|
#
|
||||||
a=$(svnversion -n . 2> /dev/null)
|
rev_new_raw=$(svnversion -n . 2>/dev/null | tr '\n' ' ' | tr -d '\r')
|
||||||
[ -n "$a" ] || a=$(SubWCRev . 2> /dev/null| tr -d '\n' | sed 's/[^0-9]*[0-9]*[^0-9]*\([0-9]*\).*/\1/')
|
[ -n "$rev_new_raw" ] || rev_new_raw=$(SubWCRev . 2>/dev/null | tr '\n' ' ' | tr -d '\r')
|
||||||
|
|
||||||
[ -f ./source/svnrev.c ] || touch ./source/svnrev.c
|
|
||||||
|
|
||||||
b=$(cat ./source/svnrev.c | tr -d '\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
|
rev_new_raw=$(echo $rev_new_raw | sed 's/[^0-9]*\([0-9]*\)\(.*\)/\1 \2/')
|
||||||
|
rev_new=0
|
||||||
|
a=$(echo $rev_new_raw | sed 's/\([0-9]*\).*/\1/')
|
||||||
|
let "a+=0"
|
||||||
|
#find max rev
|
||||||
|
while [ "$a" ]; do
|
||||||
|
[ "$a" -gt "$rev_new" ] && rev_new=$a
|
||||||
|
rev_new_raw=$(echo -n $rev_new_raw | sed 's/[0-9]*[^0-9]*\([0-9]*\)\(.*\)/\1 \2/')
|
||||||
|
a=$(echo $rev_new_raw | sed 's/\([0-9]*\).*/\1/')
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$a" != "$b" ] || [ ! -n "$a" ]; then
|
rev_old=$(cat ./source/svnrev.c 2>/dev/null | tr -d '\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
|
||||||
[ -n "$a" ] || a='unknow'
|
|
||||||
echo '#define SVN_REV "'$a'"' > ./source/svnrev.c
|
if [ "$rev_new" != "$rev_old" ] || [ ! -f ./source/svnrev.c ]; then
|
||||||
echo '' >> ./source/svnrev.c
|
|
||||||
echo 'const char *GetRev()' >> ./source/svnrev.c
|
cat <<EOF > ./source/svnrev.c
|
||||||
echo '{ ' >> ./source/svnrev.c
|
#define SVN_REV "$rev_new"
|
||||||
echo ' return SVN_REV;' >> ./source/svnrev.c
|
|
||||||
echo '}' >> ./source/svnrev.c
|
const char *GetRev()
|
||||||
echo '' >> ./source/svnrev.c
|
{
|
||||||
echo "Changed Rev $b to $a" >&2
|
return SVN_REV;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ -n "$rev_new" ]; then
|
||||||
|
echo "Changed Rev $rev_old to $rev_new" >&2
|
||||||
|
else
|
||||||
|
echo "svnrev.c created" >&2
|
||||||
|
fi
|
||||||
echo >&2
|
echo >&2
|
||||||
fi
|
fi
|
||||||
echo $a
|
echo $a
|
||||||
|
Loading…
Reference in New Issue
Block a user