summaryrefslogtreecommitdiff
path: root/scripts/setlocalversion
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2020-11-15 21:52:06 +0200
committerMichael Bestas <mkbestas@lineageos.org>2020-11-15 21:52:18 +0200
commit6107aa6dc24cc8c196bb18e5b5ec81f8f1a275a8 (patch)
treeef508ed8340c5d6b615c713d1569d851964091f2 /scripts/setlocalversion
parent298504ed68065a61d0fc1d7969af19ecf2136ac9 (diff)
parent34b1d1174c2c7054c01cfa39d274421d80649386 (diff)
Merge branch 'android-4.4-p' of https://android.googlesource.com/kernel/common into lineage-17.1-caf-msm8998
This brings LA.UM.8.2.r1-07400-sdm660.0 up to date with https://android.googlesource.com/kernel/common/ android-4.4-p at commit: 34b1d1174c2c7 UPSTREAM: arm64: kaslr: Fix up the kernel image alignment Conflicts: scripts/setlocalversion Change-Id: Id2981587a6e92eb10cfdc9b6d13cd4bd2abb5670
Diffstat (limited to 'scripts/setlocalversion')
-rwxr-xr-xscripts/setlocalversion20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 1bbde3a91099..5d1925caa9e6 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -44,7 +44,7 @@ scm_version()
# Check for git and a git repo.
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
- head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+ head=$(git rev-parse --verify HEAD 2>/dev/null); then
# 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.
@@ -72,12 +72,24 @@ scm_version()
# If we are past a tagged commit (like
# "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
+ #
+ # Ensure the abbreviated sha1 has exactly 12
+ # hex characters, to make the output
+ # independent of git version, local
+ # core.abbrev settings and/or total number of
+ # objects in the current repository - passing
+ # --abbrev=12 ensures a minimum of 12, and the
+ # awk substr() then picks the 'g' and first 12
+ # hex chars.
+ if atag="$(git describe --abbrev=12 2>/dev/null)"; then
tag="`git describe --abbrev=0 2>/dev/null`"
- commit="`echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'`"
+ commit="echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),substr($(NF),0,13))}'"
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}.
+
+ # If we don't have a tag at all we print -g{commitish},
+ # again using exactly 12 hex chars.
else
+ head="$(echo $head | cut -c1-12)"
printf '%s%s' -g $head
fi
fi