aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 15:55:27 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 16:30:29 +0100
commit5a7f6196e6cada162cdb89e56841ececb1a7a3a5 (patch)
treeeaf6aeb6cf384596290763632fc95d121eaeb244
parentdb4146e84f3310a1e1de6f6d45f2ac35a0b0a604 (diff)
Allow version string to have a release candidate suffix
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rwxr-xr-xmake_a_release.sh14
1 files 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 <<EOF
Usage: ${0##*/} <new_ver> <outdir>
-<new_ver> - mtd utils version to create in X.Y.Z format
+<new_ver> - mtd utils version to create in X.Y.Z[-rcX] format
<outdir> - 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