mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
ANDROID: scripts/setlocalversion: allow running in a subdir
Getting the scmversion using scripts/setlocalversion currently only
works when run at the root of a git or mecurial project. This was
introduced in commit 8558f59edf ("setlocalversion: Ignote SCMs above
the linux source tree") so that if one is building within a subdir of
a git tree that isn't the kernel git project, then the vermagic wouldn't
include that git sha1.
For Android purposes, this isn't a concern. So let's bring back this
functionality so that we can use scripts/setlocalversion to capture the SCM
version of external modules that reside within subdirectories of an SCM
project.
Bug: 180027765
Link: https://lore.kernel.org/lkml/20201125010541.309848-2-willmcvicker@google.com
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: If12ea75c6be0c0167f29f69b7cf13d1d85b7331c
This commit is contained in:
parent
e146d4c5bd
commit
8c7a2fec34
|
|
@ -64,8 +64,7 @@ scm_version()
|
|||
fi
|
||||
|
||||
# Check for git and a git repo.
|
||||
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
|
||||
head=$(git rev-parse --verify HEAD 2>/dev/null); then
|
||||
if head=$(git rev-parse --verify HEAD 2>/dev/null); then
|
||||
|
||||
if [ -n "$android_release" ] && [ -n "$kmi_generation" ]; then
|
||||
printf '%s' "-$android_release-$kmi_generation"
|
||||
|
|
@ -126,7 +125,7 @@ scm_version()
|
|||
fi
|
||||
|
||||
# Check for mercurial and a mercurial repo.
|
||||
if test -d .hg && hgid=$(hg id 2>/dev/null); then
|
||||
if hgid=$(hg id 2>/dev/null); then
|
||||
# Do we have an tagged version? If so, latesttagdistance == 1
|
||||
if [ "$(hg log -r . --template '{latesttagdistance}')" = "1" ]; then
|
||||
id=$(hg log -r . --template '{latesttag}')
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user