mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
setlocalversion: Prevent tags from overflowing version string
Some post Linus tags are very long and they exceed the character limit on the version string. This leads to compile errors like 3.0.8-insert-your-reallllly-long-tag-name-here-13-g4b4e960-dirty exceeds 64 characters Instead of putting the pretty printed name of the closest post Linus tag, place the tag's object hash in the version string. This should allow developers to easily run a git show on the first hash to see what tag the build is based on. The version will look like: 3.0.8-gb080168-00006-g41f3bb3-dirty meaning the kernel is based on v3.0.8 at the tag b080168 with 6 patches applied on top of that tag resulting in a commit with the hash 41f3bb3 plus a dirty tree. Running "git show b080168" should show the closest tag the tree was based on. Change-Id: I8a26532f76aadf31654cb420ab789e90bd2fe828 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> (cherry picked from commit cd7c0ee4d018b96fa540a29aa31452c3455f6e20) Conflicts: scripts/setlocalversion
This commit is contained in:
parent
890bcc7532
commit
aade712394
1 changed files with 19 additions and 4 deletions
|
@ -47,7 +47,20 @@ scm_version()
|
|||
|
||||
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
|
||||
# it, because this version is defined in the top level Makefile.
|
||||
if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
|
||||
if atag="`git describe --exact-match --abbrev=0 2>/dev/null`"; then
|
||||
# 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 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`"
|
||||
fi
|
||||
else
|
||||
|
||||
# If only the short version is requested, don't bother
|
||||
# running further git commands
|
||||
|
@ -56,10 +69,12 @@ scm_version()
|
|||
return
|
||||
fi
|
||||
# If we are past a tagged commit (like
|
||||
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
||||
# "v2.6.30-rc5-302-g72357d5"), we pretty print it and
|
||||
# include the hash of any new tag on top.
|
||||
if atag="`git describe 2>/dev/null`"; then
|
||||
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
||||
|
||||
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
|
||||
# If we don't have a tag at all we print -g{commitish}.
|
||||
else
|
||||
printf '%s%s' -g $head
|
||||
|
|
Loading…
Reference in a new issue