setlocalversion: Fix version when built/synced on a tag

If building on a tag we check to make sure the version in the
Makefile matches the tag we're building at. That would be a
string comparison and not an integer comparison. Change the test
accordingly. Right now we'll just see 3.0.8 or 3.0.8-dirty if the
kernel is built on a tag.

Similarly if we're synced to a tag we may have two references to
the same object, 1 in the local repo and one in the remote. Force
the show-ref to only look at tags so we only ever describe on
ref instead of two.

Change-Id: I694947b434db8f95d4c0b9f6e68702c65a1ee281
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit cf76837260758073496ce6325bcb20e657eb2066)
This commit is contained in:
Stephen Boyd 2012-03-17 23:57:17 -07:00
parent aade712394
commit 0e7e93da37
1 changed files with 3 additions and 3 deletions

View File

@ -51,14 +51,14 @@ scm_version()
# Make sure we're at the tag that matches the Makefile.
# If not place the hash of the tag as well for
# v2.6.30-rc5-g314aef
if [ "x$atag" -ne "x$VERSION" ]; then
if [ "x$atag" != "x$VERSION" ]; then
# If only the short version is requested,
# don't bother running further git commands
if $short; then
echo "+"
return
fi
printf '%s%s' -g "`git show-ref -s --abbrev $atag 2>/dev/null`"
printf '%s%s' -g "`git show-ref -s --abbrev --tags $atag 2>/dev/null`"
fi
else
@ -74,7 +74,7 @@ scm_version()
if atag="`git describe 2>/dev/null`"; then
tag="`git describe --abbrev=0 2>/dev/null`"
commit="`echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'`"
printf '%s%s%s' -g "`git show-ref -s --abbrev $tag 2>/dev/null`" $commit
printf '%s%s%s' -g "`git show-ref -s --abbrev --tags $tag 2>/dev/null`" $commit
# If we don't have a tag at all we print -g{commitish}.
else
printf '%s%s' -g $head