Commit acc992cd authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmlog: add support for changelog message, add quiet mode support

parent 674c1b46
#!/bin/sh #!/bin/sh
# 2010, 2012, 2013 (c) Etersoft http://etersoft.ru # 2010, 2012, 2013, 2014 (c) Etersoft http://etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Script for update changelog or increment release # Script for update changelog or increment release
...@@ -7,31 +7,41 @@ ...@@ -7,31 +7,41 @@
# load common functions, compatible with local and installed script # load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common . `dirname $0`/../share/eterbuild/functions/common
load_mod spec rpm git etersoft load_mod spec rpm git etersoft spec
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echog "rpmlog - update version/release and changelog" echog "rpmlog - update version/release and changelog"
echog "Usage: rpmlog [-r|-s|-v] [-l|-t] [SPEC] [fromTAG] [toTAG]" echog "Usage: rpmlog [-q] [-r|-s|-v] [-l|-t] [-e [changelog entry]] [SPEC] [fromTAG] [toTAG]"
echo echo
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 " -e increment and add empty changelog entry" echog " -e increment and add (empty) changelog entry"
echo echo
echog "Ext. options:" echog "Ext. options:"
echog " -t test run (without change files and repo)" echog " -t test run (without change files and repo)"
echog " -q quiet mode (do not ask anything)"
echo echo
echog "Example:" echog "Example:"
echog " $ rpmlog -v -l - typical build new version" echog " $ rpmlog -v -l - typical build new version"
echog " $ rpmlog -r -l HEAD~2 - build new version with last two commit message as changelog" echog " $ rpmlog -r -l HEAD~2 - build new version with last two commit message as changelog"
echog " $ rpmlog -r -e - prepare new version build with empty changelog entry" echog " $ rpmlog -r -e - prepare new version build with empty changelog entry"
echog " $ rpmlog -r -e 'new build' - prepare new version build with changelog entry 'new build'"
exit 0 exit 0
fi fi
is_gear || fatal "rpmlog usable only with gear repo" is_gear || fatal "rpmlog usable only with gear repo"
# TODO: rewrite option parsing
QUIET=
if [ "$1" = "-q" ] ; then
QUIET=$1
shift
fi
INCREMENTMODE="" INCREMENTMODE=""
if [ "$1" = "-r" ] || [ "$1" = "-s" ] || [ "$1" = "-v" ]; then if [ "$1" = "-r" ] || [ "$1" = "-s" ] || [ "$1" = "-v" ]; then
INCREMENTMODE=$1 INCREMENTMODE=$1
...@@ -48,6 +58,7 @@ CHANGELOGADD= ...@@ -48,6 +58,7 @@ CHANGELOGADD=
if [ "$1" = "-e" ] ; then if [ "$1" = "-e" ] ; then
CHANGELOGADD=$1 CHANGELOGADD=$1
shift shift
TEXTMESSAGE="$@"
fi fi
TESTRUN= TESTRUN=
...@@ -91,7 +102,7 @@ if [ -z "$FROMTAG" ] ; then ...@@ -91,7 +102,7 @@ if [ -z "$FROMTAG" ] ; then
fi fi
if [ -n "$CHANGELOGADD" ] ; then if [ -n "$CHANGELOGADD" ] ; then
CHANGELOG="- " CHANGELOG="- $TEXTMESSAGE"
else else
# TODO: найти параметр для упрощения истории. пока - sort? # TODO: найти параметр для упрощения истории. пока - sort?
# Делает первую букву маленькой, убирает точку в конце строки # Делает первую букву маленькой, убирает точку в конце строки
......
...@@ -195,8 +195,11 @@ add_changelog_helper() ...@@ -195,8 +195,11 @@ add_changelog_helper()
[ -z "$SPECS" ] && fatal "run add_changelog without spec(s)" [ -z "$SPECS" ] && fatal "run add_changelog without spec(s)"
add_changelog -e "$DESC" $SPECS add_changelog -e "$DESC" $SPECS
R=$? R=$?
[ -n "$QUIET" ] && return
[ -z "$EDITOR" ] && { echo "skip changelog editing without EDITOR var"; return 0 ; } [ -z "$EDITOR" ] && { echo "skip changelog editing without EDITOR var"; return 0 ; }
# If changelog sucessfully added
# If changelog sucessfully added, let us to edit
if [ "$R" = "0" ]; then if [ "$R" = "0" ]; then
local SPEC local SPEC
for SPEC in $SPECS ; do for SPEC in $SPECS ; do
......
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