From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 16 Feb 2009 11:16:51 +0300 From: Alexey Tourbin To: devel@lists.altlinux.org Message-ID: <20090216081651.GA15873@altlinux.org> Mail-Followup-To: devel@lists.altlinux.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qxx1br4bt0+wmkIi" Content-Disposition: inline Subject: Re: [devel] gb-task-repo-vercheck (vercheck): Use rpmevrcmp X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.10b3 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2009 08:16:52 -0000 Archived-At: List-Archive: List-Post: --Qxx1br4bt0+wmkIi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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(-) >=20 > 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=3D"${1:?}" EVR2=3D"${2:?}" > - local IFS=3D: > - set -- $EVR1 > - local E1=3D VR1=3D > - if [ $# -eq 2 ] && [ -n "$1" ] && [ -n "$2" ]; then > - E1=3D"$1" VR1=3D"$2" > - elif [ $# -eq 1 ] && [ -n "$1" ]; then > - VR1=3D"$1" > - else > - echo " *** bad EVR: $EVR1" > - return 1 > - fi >&2 > - set -- $EVR2 > - local E2=3D VR2=3D > - if [ $# -eq 2 ] && [ -n "$1" ] && [ -n "$2" ]; then > - E2=3D"$1" VR2=3D"$2" > - elif [ $# -eq 1 ] && [ -n "$1" ]; then > - VR2=3D"$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=3D$(rpmvercmp "$VR1" "$VR2") > - [ "$cmp" =3D -1 ] || return 1 > + # add zero epoch if EVRn does not have epoch > + [ -z "${EVR1##*:*}" ] || EVR1=3D"0:$EVR1" > + [ -z "${EVR2##*:*}" ] || EVR2=3D"0:$EVR2" > + [ "$(rpmevrcmp "$EVR1" "$EVR2")" =3D -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. --Qxx1br4bt0+wmkIi Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmZIPMACgkQfBKgtDjnu0Zx6QCgw4s7qKk6idIo7L+GNxLNQkL7 UdUAnRWRsLt1t3E+uOE5Bzz9E1SZP8uW =qR3b -----END PGP SIGNATURE----- --Qxx1br4bt0+wmkIi--