From: Alexey Tourbin <at@altlinux.ru>
To: devel@lists.altlinux.org
Subject: Re: [devel] gb-task-repo-vercheck (vercheck): Use rpmevrcmp
Date: Mon, 16 Feb 2009 11:16:51 +0300
Message-ID: <20090216081651.GA15873@altlinux.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1747 bytes --]
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.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2009-02-16 8:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-16 8:16 Alexey Tourbin [this message]
2009-02-16 12:23 ` Dmitry V. Levin
2009-02-16 13:05 ` Alexey Tourbin
2009-02-16 23:29 ` Dmitry V. Levin
2009-02-28 14:17 ` Alexey Tourbin
2009-02-28 22:37 ` Dmitry V. Levin
2009-02-28 17:36 ` Alexey Tourbin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090216081651.GA15873@altlinux.org \
--to=at@altlinux.ru \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git