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 + bugfix
* lib/libspec.lib - Davide Madrisan: * lib/libspec.lib - Davide Madrisan:
Workaround the problem of lines containing an 'Obsoletes' followed by a '<=' Correctly parse lines containing more complex 'obsoletes' directives, like
(or similar) operator. the following one:
Obsoletes: pck1 <= <v1>[,] pck2 > <v2>
(Bug discovered by Silvan Calarco) (Bug discovered by Silvan Calarco)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

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