From 0e7e93da374d6ee8e06463ba0c5e10a51b3d5bee Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sat, 17 Mar 2012 23:57:17 -0700 Subject: [PATCH] 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 (cherry picked from commit cf76837260758073496ce6325bcb20e657eb2066) --- scripts/setlocalversion | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 0ec77f52b836..857ea4fccb88 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -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