@@ -44,8 +44,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 we are at a tagged commit (like "v2.6.30-rc6"), we ignore
# it, because this version is defined in the top level Makefile.
@@ -102,7 +101,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}')
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 8558f59edf93 ("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. However, the proper solution to that is to just set this config in your defconfig: # CONFIG_LOCALVERSION_AUTO is not set which is already the default in many defconfigs: $ grep -r "CONFIG_LOCALVERSION_AUTO is not set" arch/* | wc -l 89 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. Signed-off-by: Will McVicker <willmcvicker@google.com> --- scripts/setlocalversion | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)