History

scripts/setlocalversion: fix a bug when LOCALVERSION is empty

The commit 042da426f8eb ("scripts/setlocalversion: simplify the short version part") reduces indentation. Unfortunately, it also changes behavior in a subtle way - if the user has empty "LOCALVERSION" variable, the plus sign is appended to the kernel version. It wasn't appended before. This patch reverts to the old behavior - we append the plus sign only if the LOCALVERSION variable is not set.

Mikulas Patocka committed 5 years ago

Commit 5df99be1 parent e73f0f01 file · +8 −5Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/setlocalversion+8−5
@@ -131,11 +131,14 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" · 130 unmodified lines
131131 if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
132132 # full scm version string
133133 res="$res$(scm_version)"
134−elif [ -z "${LOCALVERSION}" ]; then
135− # append a plus sign if the repository is not in a clean
136− # annotated or signed tagged state (as git describe only
137− # looks at signed or annotated tags - git tag -a/-s) and
138− # LOCALVERSION= is not specified
134+elif [ "${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.
139142 scm=$(scm_version --short)
140143 res="$res${scm:++}"
141144 fi