setlocalversion (5d8dfaa71d87f742c53309b95cb6a8b274119027) setlocalversion (7d153696e5db1e37387c2f7ec06ffc8d4aac70a4)
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

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

106if $scm_only; then
107 if test ! -e .scmversion; then
108 res=$(scm_version)
109 echo "$res" >.scmversion
110 fi
111 exit
112fi
113
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

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

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