libspec.lib: Correctly parse lines containing more complex 'obsoletes' directives

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-01-25 20:15:01 +01:00
parent 9cc2f35855
commit f086d23cce
2 changed files with 18 additions and 7 deletions

View File

@ -36,8 +36,9 @@ Changes in version 1.9.1
+ bugfix
* lib/libspec.lib - Davide Madrisan:
Workaround the problem of lines containing an 'Obsoletes' followed by a '<='
(or similar) operator.
Correctly parse lines containing more complex 'obsoletes' directives, like
the following one:
Obsoletes: pck1 <= <v1>[,] pck2 > <v2>
(Bug discovered by Silvan Calarco)
--------------------------------------------------------------------------------

View File

@ -1087,16 +1087,26 @@ rpmvars.solve "$filesname" "$specfile")" )
continue
fi
case ${tok[0]} in
local currtok skiptok=0
case "${tok[0]}" in
Obsoletes|Obsoletes:)
unset tok[0]
notify.debug "\
$FUNCNAME: * entry found at line $linenum: \"${tok[*]}\""
SPEC_OBSOLETES[${#SPEC_OBSOLETES[*]}]="\"\
$(rpmvars.solve "${tok[*]}" "$specfile")\""
# NOTE: accept lines like: Obsoletes: pck1 <= 1, pck2 > 2
for currtok in ${tok[*]}; do
[ $skiptok -gt 0 ] &&
{ skiptok="$(($skiptok-1))"; continue; }
case "$currtok" in
"<"|">"|"<="|">=")
skiptok="1"; continue ;;
",") skiptok="0"; continue ;;
esac
tok_pck="$(rpmvars.solve "$currtok" "$specfile")"
SPEC_OBSOLETES[${#SPEC_OBSOLETES[*]}]="\"$currtok\""
notify.debug "\
$FUNCNAME: SPEC_OBSOLETES = ( ${SPEC_OBSOLETES[*]} )"
done
;;
esac
done < $specfile