diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-17 18:42:45 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-22 13:41:18 +0200 |
commit | 9dc2cc5fa436375b2fa9d1e0c7e3934fc50d801e (patch) | |
tree | bf9355f3bf6ceec46f89901ba0d2efe3fee961bd | |
parent | 2cb64e48fcd664067f4bd87e8f46fad694c3c979 (diff) |
Add automated release script from mtd-utils
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
-rw-r--r-- | configure.ac | 4 | ||||
-rwxr-xr-x | make_a_release.sh | 59 |
2 files changed, 62 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index bdcf2a9..dbdbf75 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,8 @@ AC_PREREQ([2.60]) -AC_INIT([init], 0.2, [david.oberhollenzer@tele2.at], init) +m4_define([RELEASE], 0.2) + +AC_INIT([init], [RELEASE], [david.oberhollenzer@tele2.at], init) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz]) AM_SILENT_RULES([yes]) diff --git a/make_a_release.sh b/make_a_release.sh new file mode 100755 index 0000000..dca2ec3 --- /dev/null +++ b/make_a_release.sh @@ -0,0 +1,59 @@ +#!/bin/sh -uef + +# A small helper script taken from mtd-utils to generate a release tar ball. + +fatal() { + printf "Error: %s\n" "$1" >&2 + exit 1 +} + +usage() { + cat <<EOF +Usage: ${0##*/} <new_ver> <outdir> + +<new_ver> - mtd utils version to create in X.Y[.Z[-rcX]] format +<outdir> - the output directory where to store the tarball +EOF + exit 0 +} + +[ $# -eq 0 ] && usage +[ $# -eq 2 ] || fatal "Insufficient or too many argumetns" + +new_ver="$1" +outdir="$2" + +release_name="init-$new_ver" +tag_name="v$new_ver" + +# Make sure the input is sane and the makefile contains sensible version +VER_REGEX="[0-9]\+.[0-9]\+\(.[0-9]\+\)\?\(-rc[0-9]\+\)\?" + +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" + +# Make sure the tag does not exist +[ -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\], $VER_REGEX)/m4_define([RELEASE], $new_ver)/" configure.ac + +# And commit the change +git commit -m "Release $release_name" configure.ac + +# Create new tag +echo "Signing tag $tag_name" +git tag -m "$release_name" "$tag_name" + +# Prepare tarball +./autogen.sh +./configure +make distcheck +mkdir -p "$outdir" +mv "$release_name.tar.xz" "$outdir" |