[Git][ghc/ghc][wip/T25390] configure: Check version number validity
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Fri Oct 18 17:25:18 UTC 2024
Ben Gamari pushed to branch wip/T25390 at Glasgow Haskell Compiler / GHC
Commits:
e184100d by Ben Gamari at 2024-10-18T13:23:56-04:00
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
version=9.12 while RELEASE=YES
version=9.12 while RELEASE=NO
Fixes #25390.
- - - - -
1 changed file:
- m4/fp_setup_project_version.m4
Changes:
=====================================
m4/fp_setup_project_version.m4
=====================================
@@ -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,26 @@ 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 "$RELEASE" = "NO"; then
+ if test "$NumVersionComponents" != "2"; then
+ AC_MSG_ERROR([Version numbers on unstable branches must have two components])
+ else
+ AC_MSG_RESULT([okay unstable version])
+ fi
+ 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
+ if test "$NumVersionComponents" != "3"; then
+ AC_MSG_ERROR([Version numbers on stable branches must have three components])
+ else
+ AC_MSG_RESULT([okay stable version])
+ fi
+ fi
+
# Calculate project version as an integer, using 2 digits for minor version
case $VERSION_MINOR in
?) ProjectVersionInt=${VERSION_MAJOR}0${VERSION_MINOR} ;;
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e184100d7cf1c00d8194a0d8692b3951b1d88660
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e184100d7cf1c00d8194a0d8692b3951b1d88660
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241018/65fb3e95/attachment-0001.html>
More information about the ghc-commits
mailing list