From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 28 Feb 2009 20:36:09 +0300 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20090228173609.GD9851@altlinux.org> Mail-Followup-To: ALT Devel discussion list References: <20090216081651.GA15873@altlinux.org> <20090216122312.GK27664@wo.int.altlinux.org> <20090216130508.GL31985@altlinux.org> <20090216232939.GA11469@wo.int.altlinux.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7DO5AaGCk89r4vaK" Content-Disposition: inline In-Reply-To: <20090216232939.GA11469@wo.int.altlinux.org> 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: Sat, 28 Feb 2009 17:36:09 -0000 Archived-At: List-Archive: List-Post: --7DO5AaGCk89r4vaK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 17, 2009 at 02:29:39AM +0300, Dmitry V. Levin wrote: > On Mon, Feb 16, 2009 at 04:05:08PM +0300, Alexey Tourbin wrote: > > On Mon, Feb 16, 2009 at 03:23:12PM +0300, Dmitry V. Levin wrote: > > > On Mon, Feb 16, 2009 at 11:16:51AM +0300, Alexey Tourbin wrote: > > > [...] > > > > 0:1.0-alt1 cmp 1.0-alt2 should yield 1. > > >=20 > > > Why? > > >=20 > > > > Zero serial is greater than no serial. > > >=20 > > > Why? > >=20 > > This is because how rpm-4.0 works. > >=20 > > lib/psm.c: > > 72 int rpmVersionCompare(Header first, Header second) >=20 > If rpmVersionCompare() works this way, why rpmEVRcmp() doesn't work the > same way? Let's fix librpm rather than multiply workarounds. apt-pkg/rpm/rpmversion.cc: 94 // ----------------------------------------------------------------= ----- 95 /* This fragments the version into E:V-R triples and compares each= =20 96 portion separately. */ 97 int rpmVersioningSystem::DoCmpVersion(const char *A,const char *AEn= d, 98 const char *B,const char *BEn= d) 99 { 100 char *AE, *AV, *AR; 101 char *BE, *BV, *BR; 102 int rc =3D 0; 103 ParseVersion(A, AEnd, &AE, &AV, &AR); 104 ParseVersion(B, BEnd, &BE, &BV, &BR); 105 if (AE && !BE) 106 rc =3D 1; 107 else if (!AE && BE) 108 rc =3D -1; 109 else if (AE && BE) 110 { 111 int AEi, BEi; 112 AEi =3D atoi(AE); 113 BEi =3D atoi(BE); 114 if (AEi < BEi) 115 rc =3D -1; 116 else if (AEi > BEi) 117 rc =3D 1; 118 } 119 if (rc =3D=3D 0) 120 { 121 rc =3D rpmvercmp(AV, BV); 122 if (rc =3D=3D 0) { 123 if (AR && !BR) 124 rc =3D 1; 125 else if (!AR && BR) 126 rc =3D -1; 127 else if (AR && BR) 128 rc =3D rpmvercmp(AR, BR); 129 } 130 } 131 free(AE);free(AV);free(AR);; 132 free(BE);free(BV);free(BR);; 133 return rc; 134 } vercmp seems to be reliable. evrcmp is a "sdelai sam" thing. --7DO5AaGCk89r4vaK Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmpdgkACgkQfBKgtDjnu0bqiQCdGa2tjbvnA8yt+AkdZpWbjZp8 cQ4AoJP+gkCrQV+BScANsrzGv5inY8D4 =1C6c -----END PGP SIGNATURE----- --7DO5AaGCk89r4vaK--