X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tools%2Fsetlocalversion;h=e11f54f55ab0e5db943c2b6e879962aaf848ae97;hb=957dc024742829870e0489ad81e587b3f16cbc66;hp=9bbdafdb6dcb79f8f6b6f0763df3c7bdb078e18d;hpb=b8aa57b5d4d69e8f0810a5e632c0ce41c0f46ee0;p=u-boot diff --git a/tools/setlocalversion b/tools/setlocalversion index 9bbdafdb6d..e11f54f55a 100755 --- a/tools/setlocalversion +++ b/tools/setlocalversion @@ -13,7 +13,8 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then # Do we have an untagged version? if git name-rev --tags HEAD | \ grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then - git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' + (git describe || git describe --tags || git describe --all --long) \ + 2>/dev/null | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' fi # Are there uncommitted changes? @@ -22,4 +23,18 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then | read dummy; then printf '%s' -dirty fi + + # Is this git on svn? + if git config --get svn-remote.svn.url >/dev/null; then + printf -- '-svn%s' "`git svn find-rev $head`" + fi fi + +# Check for svn and a svn repo. +if rev=`svn info 2>/dev/null` ; then + rev=`echo "${rev}" | grep '^Revision' | awk '{print $NF}'` + printf -- '-svn%s' $rev +fi + +# Check for any localversion-* files +printf '%s' "`cat localversion-* 2>/dev/null`"