[devel] gb-task-repo-vercheck (vercheck): Use rpmevrcmp
Alexey Tourbin
=?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Пн Фев 16 11:16:51 MSK 2009
On Sun, Jan 11, 2009 at 11:33:11PM +0000, Dmitry V. Levin wrote:
> ---
> gb-task-repo-vercheck | 39 ++++-----------------------------------
> 1 files changed, 4 insertions(+), 35 deletions(-)
>
> diff --git a/gb-task-repo-vercheck b/gb-task-repo-vercheck
> index 10a6eaf..8fbcb18 100755
> --- a/gb-task-repo-vercheck
> +++ b/gb-task-repo-vercheck
> @@ -6,41 +6,10 @@
> vercheck()
> {
> local EVR1="${1:?}" EVR2="${2:?}"
> - local IFS=:
> - set -- $EVR1
> - local E1= VR1=
> - if [ $# -eq 2 ] && [ -n "$1" ] && [ -n "$2" ]; then
> - E1="$1" VR1="$2"
> - elif [ $# -eq 1 ] && [ -n "$1" ]; then
> - VR1="$1"
> - else
> - echo " *** bad EVR: $EVR1"
> - return 1
> - fi >&2
> - set -- $EVR2
> - local E2= VR2=
> - if [ $# -eq 2 ] && [ -n "$1" ] && [ -n "$2" ]; then
> - E2="$1" VR2="$2"
> - elif [ $# -eq 1 ] && [ -n "$1" ]; then
> - VR2="$1"
> - else
> - echo " *** bad EVR: $EVR2"
> - return 1
> - fi >&2
> - if [ -n "$E1" ] && [ -z "$E2" ]; then
> - return 1
> - elif [ -z "$E1" ] && [ -n "$E2" ]; then
> - return 0
> - elif [ -n "$E1" ] && [ -n "$E2" ]; then
> - if [ "$E1" -gt "$E2" ]; then
> - return 1
> - elif [ "$E1" -lt "$E2" ]; then
> - return 0
> - fi
> - fi
> - local cmp
> - cmp=$(rpmvercmp "$VR1" "$VR2")
> - [ "$cmp" = -1 ] || return 1
> + # add zero epoch if EVRn does not have epoch
> + [ -z "${EVR1##*:*}" ] || EVR1="0:$EVR1"
> + [ -z "${EVR2##*:*}" ] || EVR2="0:$EVR2"
> + [ "$(rpmevrcmp "$EVR1" "$EVR2")" = -1 ] || return 1
> }
This can be WRONG.
0:1.0-alt1 cmp 1.0-alt2 should yield 1.
Zero serial is greater than no serial.
I fail to see why you choose remove the code wich does the right thing
and replace it with the code which is wrong.
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип : application/pgp-signature
Размер : 197 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url : <http://lists.altlinux.org/pipermail/devel/attachments/20090216/198dd789/attachment.bin>
Подробная информация о списке рассылки Devel