setlocalversion (ec31f868ec674edfcf653cc7c82b365c6f570cd9) setlocalversion (eed36d77517786e4b3a9f17c6a66c6df2fc99442)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# This scripts adds local version information from the version
5# control systems git, mercurial (hg) and subversion (svn).
6#
7# If something goes wrong, send a mail the kernel build mailinglist
8# (see MAINTAINERS) and CC Nico Schottelius

--- 94 unchanged lines hidden (view full) ---

103fi
104
105if [ -z "${KERNELVERSION}" ]; then
106 echo "KERNELVERSION is not set" >&2
107 exit 1
108fi
109
110# localversion* files in the build and source directory
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# This scripts adds local version information from the version
5# control systems git, mercurial (hg) and subversion (svn).
6#
7# If something goes wrong, send a mail the kernel build mailinglist
8# (see MAINTAINERS) and CC Nico Schottelius

--- 94 unchanged lines hidden (view full) ---

103fi
104
105if [ -z "${KERNELVERSION}" ]; then
106 echo "KERNELVERSION is not set" >&2
107 exit 1
108fi
109
110# localversion* files in the build and source directory
111res="$(collect_files localversion*)"
111file_localversion="$(collect_files localversion*)"
112if test ! "$srctree" -ef .; then
112if test ! "$srctree" -ef .; then
113 res="$res$(collect_files "$srctree"/localversion*)"
113 file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)"
114fi
115
114fi
115
116# CONFIG_LOCALVERSION and LOCALVERSION (if set)
116# version string from CONFIG_LOCALVERSION
117config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
117config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
118res="${res}${config_localversion}${LOCALVERSION}"
119
120# scm version string if not at a tagged commit
121if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
122 # full scm version string
118
119# scm version string if not at a tagged commit
120if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
121 # full scm version string
123 res="$res$(scm_version)"
122 scm_version="$(scm_version)"
124elif [ "${LOCALVERSION+set}" != "set" ]; then
125 # If the variable LOCALVERSION is not set, append a plus
126 # sign if the repository is not in a clean annotated or
127 # signed tagged state (as git describe only looks at signed
128 # or annotated tags - git tag -a/-s).
129 #
130 # If the variable LOCALVERSION is set (including being set
131 # to an empty string), we don't want to append a plus sign.
123elif [ "${LOCALVERSION+set}" != "set" ]; then
124 # If the variable LOCALVERSION is not set, append a plus
125 # sign if the repository is not in a clean annotated or
126 # signed tagged state (as git describe only looks at signed
127 # or annotated tags - git tag -a/-s).
128 #
129 # If the variable LOCALVERSION is set (including being set
130 # to an empty string), we don't want to append a plus sign.
132 res="$res$(scm_version --short)"
131 scm_version="$(scm_version --short)"
133fi
134
132fi
133
135echo "${KERNELVERSION}${res}"
134echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"