Commit 02adfdd7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmlog: add test run mode, fix changelog format

parent 56ef0780
...@@ -13,12 +13,13 @@ load_mod spec rpm git etersoft ...@@ -13,12 +13,13 @@ load_mod spec rpm git etersoft
if [ "$1" = "-h" ]; then if [ "$1" = "-h" ]; then
echog "rpmlog - update changelog" echog "rpmlog - update changelog"
echog "Usage: rpmlog [-r|-s] [SPEC] [TAG]" echog "Usage: rpmlog [-r|-s] [-l|-t] [SPEC] [TAG]"
echog "Options:" echog "Options:"
# echog " -v - increment version" # echog " -v - increment version"
echog " -r - increment release" echog " -r - increment release"
echog " -s - increment subrelease" echog " -s - increment subrelease"
echog " -l - add changelog from git log (since last release tag or TAG)" echog " -l - add changelog from git log (since last release tag or TAG)"
echog " -t - test run (without change files and repo)"
exit 0 exit 0
fi fi
...@@ -36,6 +37,12 @@ if [ "$1" = "-l" ] ; then ...@@ -36,6 +37,12 @@ if [ "$1" = "-l" ] ; then
shift shift
fi fi
TESTRUN=
if [ "$1" = "-t" ] ; then
TESTRUN=$1
shift
fi
if [ -n "${1/*.spec/}" ] || [ -z "$1" ] ; then if [ -n "${1/*.spec/}" ] || [ -z "$1" ] ; then
SPECNAME=$(get_gear_spec) SPECNAME=$(get_gear_spec)
echo "Using autodetected spec $SPECNAME..." echo "Using autodetected spec $SPECNAME..."
...@@ -54,7 +61,7 @@ if [ ! -r "$SPECNAME" ] ; then ...@@ -54,7 +61,7 @@ if [ ! -r "$SPECNAME" ] ; then
fatal "Spec $SPECNAME does not found" fatal "Spec $SPECNAME does not found"
fi fi
[ -n "$CHANGELOGUPDATE" ] || fatal "Run with -l param" [ -n "$CHANGELOGUPDATE$TESTRUN" ] || fatal "Run with -l param"
if [ -z "$FROMTAG" ] ; then if [ -z "$FROMTAG" ] ; then
build_rpms_name $SPECNAME build_rpms_name $SPECNAME
...@@ -62,9 +69,14 @@ if [ -z "$FROMTAG" ] ; then ...@@ -62,9 +69,14 @@ if [ -z "$FROMTAG" ] ; then
fi fi
# TODO: найти параметр для упрощения истории. пока - sort? # TODO: найти параметр для упрощения истории. пока - sort?
CHANGELOG="$(git log $FROMTAG..HEAD --simplify-merges --dense --pretty="- %s" | sort -u)" # Делает первую букву маленькой, убирает точку в конце строки
CHANGELOG="$(git log $FROMTAG..HEAD --simplify-merges --dense --pretty="- %s" | sort -u | sed -e "s|\.\$||g" | sed -e "s|- \([A-Z]\)|- \l\1|g")"
[ -n "$CHANGELOG" ] || fatal "git log was failed" [ -n "$CHANGELOG" ] || fatal "git log was failed"
if [ -n "$TESTRUN" ] ; then
INCREMENTMODE=""
fi
# increment release # increment release
if [ "$INCREMENTMODE" = "-r" ] ; then if [ "$INCREMENTMODE" = "-r" ] ; then
inc_release $SPECNAME inc_release $SPECNAME
...@@ -76,6 +88,10 @@ NEWREV=$(get_version $SPECNAME)-$(get_release $SPECNAME) ...@@ -76,6 +88,10 @@ NEWREV=$(get_version $SPECNAME)-$(get_release $SPECNAME)
echo "Add changelog to $NEWREV:" echo "Add changelog to $NEWREV:"
echo "$CHANGELOG" echo "$CHANGELOG"
if [ -n "$TESTRUN" ] ; then
exit
fi
add_changelog_helper "$CHANGELOG" $SPECNAME add_changelog_helper "$CHANGELOG" $SPECNAME
git_commit_ignore_nothing $SPECNAME -m "new build $NEWREV (with rpmlog script)" git_commit_ignore_nothing $SPECNAME -m "new build $NEWREV (with rpmlog script)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment