Commit 1f2b1a0e authored by Vitaly Lipatov's avatar Vitaly Lipatov

major fix inc_release and inc_subrelease

parent 81bb7d6c
...@@ -105,21 +105,37 @@ reset_release() ...@@ -105,21 +105,37 @@ reset_release()
} }
# inc 2 release to 3 # inc 2 release to 3
# textMAJOR.middle.MINOR
inc_release() inc_release()
{ {
local BASERELEASE=$(get_numrelease "$1") local BASERELEASE=$(get_numrelease "$1")
local MAJOR=`echo "$BASERELEASE" | sed -e "s|\..*||"` local MAJOR=`echo "$BASERELEASE" | sed -e "s|\..*||"`
set_release "$1" $(get_txtrelease "$1")$(($MAJOR + 1 )) local MINOR=`echo "$BASERELEASE" | sed -e "s|.*\.||"`
local m=$(echo "$BASERELEASE" | sed -e "s|$MAJOR\.\(.*\)\.$MINOR|\1|")
[ "$m" = "$BASERELEASE" ] && m=''
local am=''
# keep minor part
[ -z "$m" ] && rhas "$MINOR" "[a-zA-Z]" && am=".$MINOR"
# keep middle part
[ -n "$m" ] && am=".$m"
set_release "$1" "$(get_txtrelease "$1")$(($MAJOR + 1 ))$am"
} }
# inc 2.x to 2.(x+1) or 2 to 2.1 # inc 2.x to 2.(x+1) or 2 to 2.1
# textMAJOR.middle.MINOR
inc_subrelease() inc_subrelease()
{ {
local BASERELEASE=$(get_numrelease $1) local BASERELEASE=$(get_numrelease $1)
local MAJOR=`echo "$BASERELEASE" | sed -e "s|\..*||"` local MAJOR=`echo "$BASERELEASE" | sed -e "s|\..*||"`
local MINOR=`echo "$BASERELEASE" | sed -e "s|.*\.||"` local MINOR=`echo "$BASERELEASE" | sed -e "s|.*\.||"`
[ "$MINOR" = "$BASERELEASE" ] && MINOR="0" [ "$MINOR" = "$BASERELEASE" ] && MINOR="0"
set_release "$1" "$(get_txtrelease $1)${MAJOR}.$(($MINOR + 1 ))" local m=$(echo "$BASERELEASE" | sed -e "s|$MAJOR\.\(.*\)\.$MINOR|\1|")
local am=''
# keep minor part
rhas "$MINOR" "[a-zA-Z]" && am=".$MINOR" && MINOR="0"
# keep middle part
[ -n "$m" ] && [ "$m" != "$BASERELEASE" ] && am=".$m"
set_release "$1" "$(get_txtrelease $1)${MAJOR}$am.$(($MINOR + 1 ))"
} }
reset_subrelease() reset_subrelease()
......
...@@ -120,6 +120,8 @@ get_mn_fromspec ...@@ -120,6 +120,8 @@ get_mn_fromspec
check MAJOR 27.5 $MAJOR check MAJOR 27.5 $MAJOR
check MINOR 2 $MINOR check MINOR 2 $MINOR
BASERELEASE=alt3.git20130916.2
# from rpmbh: # from rpmbh:
# General rule: alwars alt(N-1).MM.(N) # General rule: alwars alt(N-1).MM.(N)
set_release $SPECNAME $(get_txtrelease $SPECNAME)$(decrement_release $BASERELEASE).$MDISTR.$BASERELEASE set_release $SPECNAME $(get_txtrelease $SPECNAME)$(decrement_release $BASERELEASE).$MDISTR.$BASERELEASE
...@@ -5,7 +5,7 @@ load_mod spec ...@@ -5,7 +5,7 @@ load_mod spec
check() check()
{ {
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'" [ "$2" != "$3" ] && echo "FATAL with '$1 $TESTREL': result '$3' do not match with '$2'" || echo "OK for '$1 $TESTREL' with '$2'"
} }
...@@ -39,23 +39,42 @@ check inc_subrelease "alt6.3" `inc_subrelease ""` ...@@ -39,23 +39,42 @@ check inc_subrelease "alt6.3" `inc_subrelease ""`
# FIXME: strange behaviour # FIXME: strange behaviour
TESTREL=alt6.r5001 TESTREL=alt6.r5001
check inc_subrelease "alt6.r5001" `inc_subrelease ""` check inc_release "alt7.r5001" `inc_release ""`
check inc_subrelease "alt6.r5001.1" `inc_subrelease ""`
TESTREL=alt5 TESTREL=alt5
check inc_release "alt6" `inc_release ""` check inc_release "alt6" `inc_release ""`
check inc_subrelease "alt5.1" `inc_subrelease ""`
TESTREL=alt6.2 TESTREL=alt6.2
check inc_release "alt7" `inc_release ""` check inc_release "alt7" `inc_release ""`
check inc_subrelease "alt6.3" `inc_subrelease ""`
TESTVER=1.5.7 #TESTVER=1.5.7
check inc_version "1.5.8" `inc_version ""` #check inc_version "1.5.8" `inc_version ""`
TESTREL=alt6.eter51 TESTREL=alt6.eter51
check inc_release "alt6.eter52" `inc_release ""` check inc_release "alt7.eter51" `inc_release ""`
check inc_subrelease "alt6.eter51.1" `inc_subrelease ""`
TESTREL=alt5.14f23 TESTREL=alt5.14f23
check inc_release "alt6" `inc_release ""` check inc_release "alt6.14f23" `inc_release ""`
TESTREL=alt4.ff TESTREL=alt4.ff
check inc_release "alt5" `inc_release ""` check inc_release "alt5.ff" `inc_release ""`
TESTREL=alt3.git20110916
check inc_release "alt4.git20110916" `inc_release ""`
check inc_subrelease "alt3.git20110916.1" `inc_subrelease ""`
TESTREL=alt3.git20130916.2
check inc_release "alt4.git20130916" `inc_release ""`
check inc_subrelease "alt3.git20130916.3" `inc_subrelease ""`
TESTREL=alt2.M80P.3
check inc_release "alt3.M80P" `inc_release ""`
check inc_subrelease "alt2.M80P.4" `inc_subrelease ""`
TESTREL=alt3.git20110916
check inc_release "alt4.git20110916" `inc_release ""`
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