2006-01-05 02:42:03 +07:00
|
|
|
#!/bin/sh
|
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2009-05-16 19:00:56 +07:00
|
|
|
#
|
|
|
|
# This scripts adds local version information from the version
|
|
|
|
# control systems git, mercurial (hg) and subversion (svn).
|
|
|
|
#
|
|
|
|
# If something goes wrong, send a mail the kernel build mailinglist
|
|
|
|
# (see MAINTAINERS) and CC Nico Schottelius
|
|
|
|
# <nico-linuxsetlocalversion -at- schottelius.org>.
|
|
|
|
#
|
|
|
|
#
|
2005-07-31 15:57:49 +07:00
|
|
|
|
2006-01-05 02:42:03 +07:00
|
|
|
usage() {
|
2010-07-15 15:36:37 +07:00
|
|
|
echo "Usage: $0 [--save-scmversion] [srctree]" >&2
|
2006-01-05 02:42:03 +07:00
|
|
|
exit 1
|
2005-07-31 15:57:49 +07:00
|
|
|
}
|
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
scm_only=false
|
|
|
|
srctree=.
|
2010-07-15 15:36:37 +07:00
|
|
|
if test "$1" = "--save-scmversion"; then
|
2010-06-17 20:14:58 +07:00
|
|
|
scm_only=true
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
if test $# -gt 0; then
|
|
|
|
srctree=$1
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
if test $# -gt 0 -o ! -d "$srctree"; then
|
|
|
|
usage
|
|
|
|
fi
|
2005-07-31 15:57:49 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
scm_version()
|
|
|
|
{
|
2010-07-18 15:26:40 +07:00
|
|
|
local short
|
|
|
|
short=false
|
2009-05-16 19:00:56 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
cd "$srctree"
|
|
|
|
if test -e .scmversion; then
|
2010-07-18 15:26:40 +07:00
|
|
|
cat .scmversion
|
2010-06-17 20:14:58 +07:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
if test "$1" = "--short"; then
|
|
|
|
short=true
|
|
|
|
fi
|
2009-05-16 19:00:56 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# Check for git and a git repo.
|
2013-12-02 22:34:29 +07:00
|
|
|
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
|
scripts/setlocalversion: make git describe output more reliable
When building for an embedded target using Yocto, we're sometimes
observing that the version string that gets built into vmlinux (and
thus what uname -a reports) differs from the path under /lib/modules/
where modules get installed in the rootfs, but only in the length of
the -gabc123def suffix. Hence modprobe always fails.
The problem is that Yocto has the concept of "sstate" (shared state),
which allows different developers/buildbots/etc. to share build
artifacts, based on a hash of all the metadata that went into building
that artifact - and that metadata includes all dependencies (e.g. the
compiler used etc.). That normally works quite well; usually a clean
build (without using any sstate cache) done by one developer ends up
being binary identical to a build done on another host. However, one
thing that can cause two developers to end up with different builds
[and thus make one's vmlinux package incompatible with the other's
kernel-dev package], which is not captured by the metadata hashing, is
this `git describe`: The output of that can be affected by
(1) git version: before 2.11 git defaulted to a minimum of 7, since
2.11 (git.git commit e6c587) the default is dynamic based on the
number of objects in the repo
(2) hence even if both run the same git version, the output can differ
based on how many remotes are being tracked (or just lots of local
development branches or plain old garbage)
(3) and of course somebody could have a core.abbrev config setting in
~/.gitconfig
So in order to avoid `uname -a` output relying on such random details
of the build environment which are rather hard to ensure are
consistent between developers and buildbots, make sure the abbreviated
sha1 always consists of exactly 12 hex characters. That is consistent
with the current rule for -stable patches, and is almost always enough
to identify the head commit unambigously - in the few cases where it
does not, the v5.4.3-00021- prefix would certainly nail it down.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-17 13:56:11 +07:00
|
|
|
head=$(git rev-parse --verify HEAD 2>/dev/null); then
|
2010-06-17 20:14:58 +07:00
|
|
|
|
|
|
|
# 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.
|
2019-10-23 08:54:27 +07:00
|
|
|
if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
|
2010-06-17 20:14:58 +07:00
|
|
|
|
|
|
|
# If only the short version is requested, don't bother
|
|
|
|
# running further git commands
|
|
|
|
if $short; then
|
|
|
|
echo "+"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
# If we are past a tagged commit (like
|
|
|
|
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
scripts/setlocalversion: make git describe output more reliable
When building for an embedded target using Yocto, we're sometimes
observing that the version string that gets built into vmlinux (and
thus what uname -a reports) differs from the path under /lib/modules/
where modules get installed in the rootfs, but only in the length of
the -gabc123def suffix. Hence modprobe always fails.
The problem is that Yocto has the concept of "sstate" (shared state),
which allows different developers/buildbots/etc. to share build
artifacts, based on a hash of all the metadata that went into building
that artifact - and that metadata includes all dependencies (e.g. the
compiler used etc.). That normally works quite well; usually a clean
build (without using any sstate cache) done by one developer ends up
being binary identical to a build done on another host. However, one
thing that can cause two developers to end up with different builds
[and thus make one's vmlinux package incompatible with the other's
kernel-dev package], which is not captured by the metadata hashing, is
this `git describe`: The output of that can be affected by
(1) git version: before 2.11 git defaulted to a minimum of 7, since
2.11 (git.git commit e6c587) the default is dynamic based on the
number of objects in the repo
(2) hence even if both run the same git version, the output can differ
based on how many remotes are being tracked (or just lots of local
development branches or plain old garbage)
(3) and of course somebody could have a core.abbrev config setting in
~/.gitconfig
So in order to avoid `uname -a` output relying on such random details
of the build environment which are rather hard to ensure are
consistent between developers and buildbots, make sure the abbreviated
sha1 always consists of exactly 12 hex characters. That is consistent
with the current rule for -stable patches, and is almost always enough
to identify the head commit unambigously - in the few cases where it
does not, the v5.4.3-00021- prefix would certainly nail it down.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-17 13:56:11 +07:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),substr($(NF),0,13))}'
|
2010-06-17 20:14:58 +07:00
|
|
|
|
scripts/setlocalversion: make git describe output more reliable
When building for an embedded target using Yocto, we're sometimes
observing that the version string that gets built into vmlinux (and
thus what uname -a reports) differs from the path under /lib/modules/
where modules get installed in the rootfs, but only in the length of
the -gabc123def suffix. Hence modprobe always fails.
The problem is that Yocto has the concept of "sstate" (shared state),
which allows different developers/buildbots/etc. to share build
artifacts, based on a hash of all the metadata that went into building
that artifact - and that metadata includes all dependencies (e.g. the
compiler used etc.). That normally works quite well; usually a clean
build (without using any sstate cache) done by one developer ends up
being binary identical to a build done on another host. However, one
thing that can cause two developers to end up with different builds
[and thus make one's vmlinux package incompatible with the other's
kernel-dev package], which is not captured by the metadata hashing, is
this `git describe`: The output of that can be affected by
(1) git version: before 2.11 git defaulted to a minimum of 7, since
2.11 (git.git commit e6c587) the default is dynamic based on the
number of objects in the repo
(2) hence even if both run the same git version, the output can differ
based on how many remotes are being tracked (or just lots of local
development branches or plain old garbage)
(3) and of course somebody could have a core.abbrev config setting in
~/.gitconfig
So in order to avoid `uname -a` output relying on such random details
of the build environment which are rather hard to ensure are
consistent between developers and buildbots, make sure the abbreviated
sha1 always consists of exactly 12 hex characters. That is consistent
with the current rule for -stable patches, and is almost always enough
to identify the head commit unambigously - in the few cases where it
does not, the v5.4.3-00021- prefix would certainly nail it down.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-17 13:56:11 +07:00
|
|
|
# If we don't have a tag at all we print -g{commitish},
|
|
|
|
# again using exactly 12 hex chars.
|
2010-06-17 20:14:58 +07:00
|
|
|
else
|
scripts/setlocalversion: make git describe output more reliable
When building for an embedded target using Yocto, we're sometimes
observing that the version string that gets built into vmlinux (and
thus what uname -a reports) differs from the path under /lib/modules/
where modules get installed in the rootfs, but only in the length of
the -gabc123def suffix. Hence modprobe always fails.
The problem is that Yocto has the concept of "sstate" (shared state),
which allows different developers/buildbots/etc. to share build
artifacts, based on a hash of all the metadata that went into building
that artifact - and that metadata includes all dependencies (e.g. the
compiler used etc.). That normally works quite well; usually a clean
build (without using any sstate cache) done by one developer ends up
being binary identical to a build done on another host. However, one
thing that can cause two developers to end up with different builds
[and thus make one's vmlinux package incompatible with the other's
kernel-dev package], which is not captured by the metadata hashing, is
this `git describe`: The output of that can be affected by
(1) git version: before 2.11 git defaulted to a minimum of 7, since
2.11 (git.git commit e6c587) the default is dynamic based on the
number of objects in the repo
(2) hence even if both run the same git version, the output can differ
based on how many remotes are being tracked (or just lots of local
development branches or plain old garbage)
(3) and of course somebody could have a core.abbrev config setting in
~/.gitconfig
So in order to avoid `uname -a` output relying on such random details
of the build environment which are rather hard to ensure are
consistent between developers and buildbots, make sure the abbreviated
sha1 always consists of exactly 12 hex characters. That is consistent
with the current rule for -stable patches, and is almost always enough
to identify the head commit unambigously - in the few cases where it
does not, the v5.4.3-00021- prefix would certainly nail it down.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-09-17 13:56:11 +07:00
|
|
|
head="$(echo $head | cut -c1-12)"
|
2010-06-17 20:14:58 +07:00
|
|
|
printf '%s%s' -g $head
|
|
|
|
fi
|
|
|
|
fi
|
2009-05-16 19:00:56 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# Is this git on svn?
|
|
|
|
if git config --get svn-remote.svn.url >/dev/null; then
|
2019-10-23 08:54:27 +07:00
|
|
|
printf -- '-svn%s' "$(git svn find-rev $head)"
|
2009-05-16 19:00:56 +07:00
|
|
|
fi
|
2005-07-31 15:57:49 +07:00
|
|
|
|
scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
git-diff-index does not refresh the index for you, so using it for a
"-dirty" check can give misleading results. Commit 6147b1cf19651
("scripts/setlocalversion: git: Make -dirty check more robust") tried to
fix this by switching to git-status, but it overlooked the fact that
git-status also writes to the .git directory of the source tree, which
is definitely not kosher for an out-of-tree (O=) build. That is getting
reverted.
Fortunately, git-status now supports avoiding writing to the index via
the --no-optional-locks flag, as of git 2.14. It still calculates an
up-to-date index, but it avoids writing it out to the .git directory.
So, let's retry the solution from commit 6147b1cf19651 using this new
flag first, and if it fails, we assume this is an older version of git
and just use the old git-diff-index method.
It's hairy to get the 'grep -vq' (inverted matching) correct by stashing
the output of git-status (you have to be careful about the difference
betwen "empty stdin" and "blank line on stdin"), so just pipe the output
directly to grep and use a regex that's good enough for both the
git-status and git-diff-index version.
Cc: Christian Kujau <lists@nerdbynature.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Genki Sky <sky@genki.is>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-11-15 09:11:18 +07:00
|
|
|
# Check for uncommitted changes.
|
|
|
|
# First, with git-status, but --no-optional-locks is only
|
|
|
|
# supported in git >= 2.14, so fall back to git-diff-index if
|
|
|
|
# it fails. Note that git-diff-index does not refresh the
|
|
|
|
# index, so it may give misleading results. See
|
|
|
|
# git-update-index(1), git-diff-index(1), and git-status(1).
|
|
|
|
if {
|
|
|
|
git --no-optional-locks status -uno --porcelain 2>/dev/null ||
|
|
|
|
git diff-index --name-only HEAD
|
|
|
|
} | grep -qvE '^(.. )?scripts/package'; then
|
2010-06-17 20:14:58 +07:00
|
|
|
printf '%s' -dirty
|
|
|
|
fi
|
2009-06-12 14:59:52 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# All done with git
|
|
|
|
return
|
2006-01-05 02:42:03 +07:00
|
|
|
fi
|
2007-11-29 04:55:44 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# Check for mercurial and a mercurial repo.
|
2019-10-23 08:54:27 +07:00
|
|
|
if test -d .hg && hgid=$(hg id 2>/dev/null); then
|
2011-01-12 12:53:52 +07:00
|
|
|
# Do we have an tagged version? If so, latesttagdistance == 1
|
2019-10-23 08:54:27 +07:00
|
|
|
if [ "$(hg log -r . --template '{latesttagdistance}')" = "1" ]; then
|
|
|
|
id=$(hg log -r . --template '{latesttag}')
|
2010-06-17 20:14:58 +07:00
|
|
|
printf '%s%s' -hg "$id"
|
2011-01-12 12:53:52 +07:00
|
|
|
else
|
2019-10-23 08:54:27 +07:00
|
|
|
tag=$(printf '%s' "$hgid" | cut -d' ' -f2)
|
2011-01-12 12:53:52 +07:00
|
|
|
if [ -z "$tag" -o "$tag" = tip ]; then
|
2019-10-23 08:54:27 +07:00
|
|
|
id=$(printf '%s' "$hgid" | sed 's/[+ ].*//')
|
2011-01-12 12:53:52 +07:00
|
|
|
printf '%s%s' -hg "$id"
|
|
|
|
fi
|
2010-06-17 20:14:58 +07:00
|
|
|
fi
|
2007-11-29 04:55:44 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# Are there uncommitted changes?
|
|
|
|
# These are represented by + after the changeset id.
|
|
|
|
case "$hgid" in
|
|
|
|
*+|*+\ *) printf '%s' -dirty ;;
|
|
|
|
esac
|
2007-11-29 04:55:44 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# All done with mercurial
|
|
|
|
return
|
2007-11-29 04:55:44 +07:00
|
|
|
fi
|
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# Check for svn and a svn repo.
|
2019-10-23 08:54:27 +07:00
|
|
|
if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
|
|
|
|
rev=$(echo $rev | awk '{print $NF}')
|
2010-06-17 20:14:58 +07:00
|
|
|
printf -- '-svn%s' "$rev"
|
2007-11-29 04:55:44 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# All done with svn
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
collect_files()
|
|
|
|
{
|
2019-10-01 19:17:24 +07:00
|
|
|
local file res=
|
2010-06-17 20:14:58 +07:00
|
|
|
|
|
|
|
for file; do
|
|
|
|
case "$file" in
|
|
|
|
*\~*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if test -e "$file"; then
|
|
|
|
res="$res$(cat "$file")"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "$res"
|
|
|
|
}
|
|
|
|
|
|
|
|
if $scm_only; then
|
2010-07-15 15:36:37 +07:00
|
|
|
if test ! -e .scmversion; then
|
|
|
|
res=$(scm_version)
|
|
|
|
echo "$res" >.scmversion
|
|
|
|
fi
|
2007-11-29 04:55:44 +07:00
|
|
|
exit
|
2006-01-05 02:42:03 +07:00
|
|
|
fi
|
2008-02-03 13:13:26 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
if test -e include/config/auto.conf; then
|
2010-07-18 15:26:40 +07:00
|
|
|
. include/config/auto.conf
|
2010-06-17 20:14:58 +07:00
|
|
|
else
|
2016-06-07 02:00:38 +07:00
|
|
|
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
2010-06-17 20:14:58 +07:00
|
|
|
exit 1
|
|
|
|
fi
|
2008-02-03 13:13:26 +07:00
|
|
|
|
2010-06-17 20:14:58 +07:00
|
|
|
# localversion* files in the build and source directory
|
|
|
|
res="$(collect_files localversion*)"
|
|
|
|
if test ! "$srctree" -ef .; then
|
|
|
|
res="$res$(collect_files "$srctree"/localversion*)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# CONFIG_LOCALVERSION and LOCALVERSION (if set)
|
|
|
|
res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
|
|
|
|
|
|
|
|
# scm version string if not at a tagged commit
|
|
|
|
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
|
|
|
|
# full scm version string
|
|
|
|
res="$res$(scm_version)"
|
|
|
|
else
|
2010-09-06 16:57:19 +07:00
|
|
|
# append a plus sign if the repository is not in a clean
|
|
|
|
# annotated or signed tagged state (as git describe only
|
|
|
|
# looks at signed or annotated tags - git tag -a/-s) and
|
|
|
|
# LOCALVERSION= is not specified
|
2010-06-17 20:14:58 +07:00
|
|
|
if test "${LOCALVERSION+set}" != "set"; then
|
|
|
|
scm=$(scm_version --short)
|
|
|
|
res="$res${scm:++}"
|
|
|
|
fi
|
2008-02-03 13:13:26 +07:00
|
|
|
fi
|
2010-06-17 20:14:58 +07:00
|
|
|
|
|
|
|
echo "$res"
|