]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tools: git-version-bump, accept X.Y-devel version on master branch
authorKarel Zak <kzak@redhat.com>
Thu, 26 Feb 2026 09:39:08 +0000 (10:39 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 26 Feb 2026 10:50:56 +0000 (11:50 +0100)
Allow "X.Y-devel" as a valid version format, restricted to the master
branch only. Release versions (X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN) still
require a stable/vX.Y branch.

Signed-off-by: Karel Zak <kzak@redhat.com>
tools/git-version-bump

index 5cd75eff55e20718c8adee7d3b8b9a5b22e037e8..c8949e87eb0e97ae06dbe57f9047b33af068abb4 100755 (executable)
@@ -20,10 +20,12 @@ $(basename "$0") - update util-linux versions and release dates
 Usage: $(basename "$0") [OPTIONS] <new-version>
 
 This script updates NEWS file and release dates in configure.ac and meson.build
-for a new util-linux release. It must be run from a stable/vX.Y branch.
+for a new util-linux release. It must be run from a stable/vX.Y branch, or from
+the master branch for devel versions.
 
 Arguments:
-  <new-version>    Version in format X.Y, X.Y.Z, X.Y-rcN, or X.Y.Z-rcN
+  <new-version>    Version in format X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN,
+                   or X.Y-devel (master branch only)
 
 Options:
   -h, --help       Show this help message
@@ -34,23 +36,32 @@ EOF
 function validate_version() {
        local version="$1"
 
-       # Valid formats: X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN
-       if [[ ! "$version" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then
+       # Valid formats: X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN, X.Y-devel
+       if [[ ! "$version" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-rc[0-9]+|-devel)?$ ]]; then
                echo "Error: Invalid version format '$version'" >&2
-               echo "Valid formats: X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN" >&2
+               echo "Valid formats: X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN, X.Y-devel" >&2
                return 1
        fi
        return 0
 }
 
 function validate_branch() {
+       local version="$1"
        local current_branch
        current_branch=$(git branch --show-current)
 
-       if [[ ! "$current_branch" =~ ^stable/v[0-9]+\.[0-9]+$ ]]; then
-               echo "Error: This script must be run from a stable/vX.Y branch" >&2
-               echo "Current branch: $current_branch" >&2
-               return 1
+       if [[ "$version" == *-devel ]]; then
+               if [[ "$current_branch" != "master" ]]; then
+                       echo "Error: Devel versions can only be used on the master branch" >&2
+                       echo "Current branch: $current_branch" >&2
+                       return 1
+               fi
+       else
+               if [[ ! "$current_branch" =~ ^stable/v[0-9]+\.[0-9]+$ ]]; then
+                       echo "Error: This script must be run from a stable/vX.Y branch" >&2
+                       echo "Current branch: $current_branch" >&2
+                       return 1
+               fi
        fi
        return 0
 }
@@ -87,7 +98,7 @@ git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {
 validate_version "$VERSION" || exit 1
 
 # Validate branch
-validate_branch || exit 1
+validate_branch "$VERSION" || exit 1
 
 function bump_news_version {
        local version="$1"