Skip to content
Snippets Groups Projects
Commit c02add17 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

configure: Check version number validity

Here we verify the previously informal invariant that stable release
version numbers must have three components, preventing costly failed
releases.

Specifically, the check fails in the following scenarios:

 * `version=9.13` while `RELEASE=YES` since this would imply a
   release made from an unstable branch
 * `version=9.13.0` since unstable versions should only have two
   components
 * `version=9.12` since this has the wrong number of version components
   for a stable branch

Fixes #25390.
parent 2807f91b
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,9 @@
# ---------------------
AC_DEFUN([FP_SETUP_PROJECT_VERSION],
[
# number of version number components
NumVersionComponents="$(( $(echo "$PACKAGE_VERSION" | tr -cd . | wc -c) + 1 ))"
if test "$RELEASE" = "NO"; then
AC_MSG_CHECKING([for GHC version date])
if test -f VERSION_DATE; then
......@@ -62,6 +65,22 @@ AC_DEFUN([FP_SETUP_PROJECT_VERSION],
VERSION_MINOR=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
ProjectPatchLevel=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
# Verify that the version number has three components if a release version
# (that is, even minor version number).
AC_MSG_CHECKING([package version validity])
StableRelease="$(( ($VERSION_MINOR & 1) == 0))"
if test "$StableRelease" = "1" -a "$NumVersionComponents" != "3"; then
AC_MSG_ERROR([Stable (even) version numbers must have three components])
elif test "$StableRelease" = "0" -a "$NumVersionComponents" != "2"; then
AC_MSG_ERROR([Unstable (odd) version numbers must have two components])
elif test "$RELEASE" = "YES" -a "$StableRelease" = "0"; then
AC_MSG_ERROR([RELEASE=YES despite having an unstable odd minor version number])
elif test "$StableRelease" = "1"; then
AC_MSG_RESULT([okay stable branch version])
else
AC_MSG_RESULT([okay unstable branch version])
fi
# Calculate project version as an integer, using 2 digits for minor version
case $VERSION_MINOR in
?) ProjectVersionInt=${VERSION_MAJOR}0${VERSION_MINOR} ;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment