Commit eed36d77 authored by Masahiro Yamada's avatar Masahiro Yamada

setlocalversion: clean up the construction of version output

Concatenate all components in the last line instead of accumulating
them into the 'res' variable.

No functional change is intended. A preparation for the next change.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 534066a9
...@@ -108,19 +108,18 @@ if [ -z "${KERNELVERSION}" ]; then ...@@ -108,19 +108,18 @@ if [ -z "${KERNELVERSION}" ]; then
fi fi
# localversion* files in the build and source directory # localversion* files in the build and source directory
res="$(collect_files localversion*)" file_localversion="$(collect_files localversion*)"
if test ! "$srctree" -ef .; then if test ! "$srctree" -ef .; then
res="$res$(collect_files "$srctree"/localversion*)" file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)"
fi fi
# CONFIG_LOCALVERSION and LOCALVERSION (if set) # version string from CONFIG_LOCALVERSION
config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf) config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
res="${res}${config_localversion}${LOCALVERSION}"
# scm version string if not at a tagged commit # scm version string if not at a tagged commit
if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
# full scm version string # full scm version string
res="$res$(scm_version)" scm_version="$(scm_version)"
elif [ "${LOCALVERSION+set}" != "set" ]; then elif [ "${LOCALVERSION+set}" != "set" ]; then
# If the variable LOCALVERSION is not set, append a plus # If the variable LOCALVERSION is not set, append a plus
# sign if the repository is not in a clean annotated or # sign if the repository is not in a clean annotated or
...@@ -129,7 +128,7 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then ...@@ -129,7 +128,7 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then
# #
# If the variable LOCALVERSION is set (including being set # If the variable LOCALVERSION is set (including being set
# to an empty string), we don't want to append a plus sign. # to an empty string), we don't want to append a plus sign.
res="$res$(scm_version --short)" scm_version="$(scm_version --short)"
fi fi
echo "${KERNELVERSION}${res}" echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment