From 5a7f6196e6cada162cdb89e56841ececb1a7a3a5 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 17 Nov 2016 15:55:27 +0100 Subject: Allow version string to have a release candidate suffix Signed-off-by: David Oberhollenzer --- make_a_release.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/make_a_release.sh b/make_a_release.sh index 1cf0f67..b4476fc 100755 --- a/make_a_release.sh +++ b/make_a_release.sh @@ -12,7 +12,7 @@ usage() { cat < - - mtd utils version to create in X.Y.Z format + - mtd utils version to create in X.Y.Z[-rcX] format - the output directory where to store the tarball with the gpg signature EOF @@ -29,11 +29,13 @@ release_name="mtd-utils-$new_ver" tag_name="v$new_ver" # Make sure the input is sane and the makefile contains sensible version -echo "$new_ver" | egrep -q -x '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+' || - fatal "please, provide new version in X.Y.Z format" +VER_REGEX="\([0-9]\+.[0-9]\+.[0-9]\+\)\(-rc[0-9]\+\)\?" -egrep -q -x "m4_define\(\[RELEASE\], [0-9]+\.[0-9]+\.[0-9]+\)" configure.ac || - fatal "configure.ac does not contain \"m4_define([RELEASE], X.Y.Z)\"" +echo "$new_ver" | grep -q -x "$VER_REGEX" || + fatal "please, provide new version in X.Y.Z[-rcX] format" + +grep -q -x "m4_define(\[RELEASE\], $VER_REGEX)" configure.ac || + fatal "configure.ac does not contain a valid version string" # Make sure the git index is up-to-date [ -z "$(git status --porcelain)" ] || fatal "Git index is not up-to-date" @@ -42,7 +44,7 @@ egrep -q -x "m4_define\(\[RELEASE\], [0-9]+\.[0-9]+\.[0-9]+\)" configure.ac || [ -z "$(git tag -l "$tag_name")" ] || fatal "Tag $tag_name already exists" # Change the version in the configure.ac -sed -i -e "s/^m4_define(\[RELEASE\], [0-9]\+.[0-9]\+.[0-9]\+)/m4_define([RELEASE], $new_ver)/" configure.ac +sed -i -e "s/^m4_define(\[RELEASE\], $VER_REGEX)/m4_define([RELEASE], $new_ver)/" configure.ac # And commit the change git commit -s -m "Release $release_name" configure.ac -- cgit v1.2.3