lib/libapsa.lib: coding style fixes

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-07-21 19:47:56 +02:00
parent 547b750aef
commit 616d130d55
2 changed files with 40 additions and 27 deletions

View File

@ -1,3 +1,11 @@
Changes in version 1.12.4
+ update
* lib/libapse.lib - Davide Madrisan:
Coding style fixes.
-------------------------------------------------------------------------------
Changes in version 1.12.3 Changes in version 1.12.3
Tue Jul 17 2012 Davide Madrisan <davide.madrisan(a)gmail.com> Tue Jul 17 2012 Davide Madrisan <davide.madrisan(a)gmail.com>

View File

@ -54,7 +54,8 @@ function apse.cmpversion() {
prealpha=(\ prealpha=(\
"prealpha" "nightlybuild" "development" "dev" ${vcs[*]}) "prealpha" "nightlybuild" "development" "dev" ${vcs[*]})
beta=(\ beta=(\
"beta" "preview" "pre" "prototype" "proto" "tp" "ctp" "ea" "test" "milestone") "beta" "preview" "pre" "prototype" "proto" "tp" "ctp" "ea" "test" \
"milestone")
rc=(\ rc=(\
"rc" "gm" "gamma") "rc" "gm" "gamma")
stable=(\ stable=(\
@ -62,14 +63,17 @@ function apse.cmpversion() {
precedence=(\ precedence=(\
"prealpha[*]" "alpha" "beta[*]" "rc[*]" "delta" "omega" "stable[*]") "prealpha[*]" "alpha" "beta[*]" "rc[*]" "delta" "omega" "stable[*]")
# TODO: if in both there is vcs compare, if only in one of them watch changelog or/and data # TODO: if in both there is vcs compare, if only in one of them watch
# changelog or/and data
version1=($(echo $1 | tr '[:punct:]' ' ' | \ version1=(\
sed -e "s,\([a-zA-Z^ ]*\)\([0-9^ ]*\)\([a-zA-Z^ ]*\),\1 \2 \3,g")) $(echo $1 | tr '[:punct:]' ' ' | \
sed -e "s,\([a-zA-Z^ ]*\)\([0-9^ ]*\)\([a-zA-Z^ ]*\),\1 \2 \3,g"))
notify.debug "$FUNCNAME: version1 = ${version1[*]}" notify.debug "$FUNCNAME: version1 = ${version1[*]}"
version2=($(echo $2 | tr '[:punct:]' ' ' | \ version2=(\
sed -e "s,\([a-zA-Z^ ]*\)\([0-9^ ]*\)\([a-zA-Z^ ]*\),\1 \2 \3,g")) $(echo $2 | tr '[:punct:]' ' ' | \
sed -e "s,\([a-zA-Z^ ]*\)\([0-9^ ]*\)\([a-zA-Z^ ]*\),\1 \2 \3,g"))
notify.debug "$FUNCNAME: version2 = ${version2[*]}" notify.debug "$FUNCNAME: version2 = ${version2[*]}"
minfield=${#version1[*]} minfield=${#version1[*]}
@ -153,19 +157,19 @@ $FUNCNAME: \`$code1' has position ${version1[$i]} in precedence"
fi fi
if [[ ${version2[$i]} -gt ${version1[$i]} ]]; then if [[ ${version2[$i]} -gt ${version1[$i]} ]]; then
retval=2 retval=2
break break
elif [[ ${version2[$i]} -lt ${version1[$i]} ]]; then elif [[ ${version2[$i]} -lt ${version1[$i]} ]]; then
retval=1 retval=1
break break
elif [ "${version2[$i]}" = "8" ]; then elif [ "${version2[$i]}" = "8" ]; then
if [ "$code2" \> "$code1" ]; then if [ "$code2" \> "$code1" ]; then
retval=2 retval=2
elif [ "$code2" \< "$code1" ]; then elif [ "$code2" \< "$code1" ]; then
retval=1 retval=1
else else
retval=0 retval=0
fi fi
else else
if [ $i -eq $(($minfield-1)) ]; then if [ $i -eq $(($minfield-1)) ]; then
for j in $(seq $i 1 $[$maxfield-1]); do for j in $(seq $i 1 $[$maxfield-1]); do
@ -356,7 +360,8 @@ sed "s,%{?[A-Za-z0-9_]*:.*\(%[A-Za-z0-9_]*\)},\1,"`
done done
# remove archiver extension from rexexp to match changes # remove archiver extension from rexexp to match changes
local pcknameregexp=$(echo [^A-Za-z0-9._-]$spck | sed "\ local pcknameregexp=$(echo [^A-Za-z0-9._-]$spck | \
sed "\
s,\.gz$,\\\., s,\.gz$,\\\.,
s,\.tgz$,\\\., s,\.tgz$,\\\.,
s,\.bz2$,\\\., s,\.bz2$,\\\.,
@ -394,15 +399,15 @@ sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 ))
local curr_version_dots new_version_dots candidate_version local curr_version_dots new_version_dots candidate_version
curr_version_dots=`echo $SPEC_VERSION | tr -d [0-9][A-Z][a-z]_` curr_version_dots=`echo $SPEC_VERSION | tr -d [0-9][A-Z][a-z]_`
for candidate_version in ${candidate_versions[*]}; do for candidate_version in ${candidate_versions[*]}; do
# skip version with no dots if current version has at least # skip version with no dots if current version has at least
# one (e.g. date release like 20000110) # one (e.g. date release like 20000110)
new_version_dots=`echo $candidate_version | \ new_version_dots=`echo $candidate_version | \
tr -d [0-9][A-Z][a-z]_` tr -d [0-9][A-Z][a-z]_`
[ "${#new_version_dots}" = 0 -a \ [ "${#new_version_dots}" = 0 -a \
${#curr_version_dots} -gt 0 ] && ${#curr_version_dots} -gt 0 ] &&
continue continue
new_version="$candidate_version" new_version="$candidate_version"
break break
done done
fi fi
fi fi