diff options
| author | Wolfram Sang <wsa@kernel.org> | 2023-04-24 12:50:20 +0200 |
|---|---|---|
| committer | Wolfram Sang <wsa@kernel.org> | 2023-04-24 12:50:20 +0200 |
| commit | 38c87827ffd3c7e1dd61eee9a7dea13d487dc2ed (patch) | |
| tree | e6bd1c3ae56823874a736c1512409c123c9a4219 /scripts/setlocalversion | |
| parent | 9496fffcb28f39e0352779a0199b6e61861c9221 (diff) | |
| parent | d663d93bb47e7ab45602b227701022d8aa16040a (diff) | |
Merge branch 'i2c/for-current' into i2c/for-mergewindow
This should have been in 6.3, but sadly I missed it.
Diffstat (limited to 'scripts/setlocalversion')
| -rwxr-xr-x | scripts/setlocalversion | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index e54839a42d4b..3d3babac8298 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -11,10 +11,16 @@ # usage() { - echo "Usage: $0 [srctree]" >&2 + echo "Usage: $0 [--no-local] [srctree]" >&2 exit 1 } +no_local=false +if test "$1" = "--no-local"; then + no_local=true + shift +fi + srctree=. if test $# -gt 0; then srctree=$1 @@ -26,14 +32,22 @@ fi scm_version() { - local short + local short=false + local no_dirty=false local tag - short=false + + while [ $# -gt 0 ]; + do + case "$1" in + --short) + short=true;; + --no-dirty) + no_dirty=true;; + esac + shift + done cd "$srctree" - if test "$1" = "--short"; then - short=true - fi if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then return @@ -75,6 +89,10 @@ scm_version() printf '%s%s' -g "$(echo $head | cut -c1-12)" fi + if ${no_dirty}; then + return + fi + # Check for uncommitted changes. # This script must avoid any write attempt to the source tree, which # might be read-only. @@ -110,11 +128,6 @@ collect_files() echo "$res" } -if ! test -e include/config/auto.conf; then - echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 - exit 1 -fi - if [ -z "${KERNELVERSION}" ]; then echo "KERNELVERSION is not set" >&2 exit 1 @@ -126,6 +139,16 @@ if test ! "$srctree" -ef .; then file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)" fi +if ${no_local}; then + echo "${KERNELVERSION}$(scm_version --no-dirty)" + exit 0 +fi + +if ! test -e include/config/auto.conf; then + echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 + exit 1 +fi + # version string from CONFIG_LOCALVERSION config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf) |
