Commit 4abd4c77 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmlog: fix -n/-v not resetting release to <prefix>1

The overloaded reset_release() only echoed the new value, which was discarded in the -n and -v case branches, so the release was never written to the spec (e.g. 11.11.5-eter2 -> rpmlog -n 11.12.1 kept eter2 instead of eter1). Drop the broken override and call the library set_release with an empty release, which resets to <prefix>1. Add a test for it.
parent bd83b595
......@@ -125,4 +125,3 @@ $ a=qqq
$ while read l; do a="$l"; done < <(echo "$list")
$ echo $a
line3
......@@ -181,14 +181,6 @@ if [ "$INCREMENTMODE" = "-a" ] ; then
fi
fi
# overload func
reset_release()
{
local SPECNAME="$1"
old="$(get_release $SPECNAME)"
echo "${old/[0-9]/}1"
}
# increment release
case "$INCREMENTMODE" in
"-r")
......@@ -196,14 +188,16 @@ case "$INCREMENTMODE" in
;;
"-n")
set_version $SPECNAME $FORCEVERSION
reset_release $SPECNAME
# reset release to <prefix>1 (e.g. eter2 -> eter1)
set_release $SPECNAME
;;
"-s")
inc_subrelease $SPECNAME
;;
"-v")
inc_version $SPECNAME
reset_release $SPECNAME
# reset release to <prefix>1 (e.g. eter2 -> eter1)
set_release $SPECNAME
;;
*)
;;
......
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod spec
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1 $TESTREL': result '$3' do not match with '$2'" || echo "OK for '$1 $TESTREL' with '$2'"
}
get_release()
{
echo $TESTREL
}
# capture the release set_release would write to the spec
set_var()
{
echo "$3"
}
# empty second arg resets release to <prefix>1 (used by rpmlog -n/-v)
TESTREL=eter2
check set_release "eter1" `set_release spec`
TESTREL=eter1
check set_release "eter1" `set_release spec`
TESTREL=alt5
check set_release "alt1" `set_release spec`
TESTREL=alt6.2
check set_release "alt1" `set_release spec`
TESTREL=alt3.git20110916
check set_release "alt1" `set_release spec`
# explicit second arg is written as is
TESTREL=eter2
check set_release "eter5" `set_release spec eter5`
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