From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 17 Dec 2006 16:43:40 +0300 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20061217134340.GA6148@localhost.localdomain> Mail-Followup-To: ALT Devel discussion list References: <20061009223236.GG23308@localhost.localdomain> <20061009224152.GC18762@basalt.office.altlinux.org> <20061010004028.GH23308@localhost.localdomain> <20061010153903.GA14460@basalt.office.altlinux.org> <20061010155251.GF8008@localhost.localdomain> <20061010221127.GB26619@basalt.office.altlinux.org> <20061011001636.GQ8008@localhost.localdomain> <20061207225233.GA14226@nomad.office.altlinux.org> <20061214234038.GH13476@localhost.localdomain> <20061215012503.GK13476@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oLBj+sq0vYjzfsbl" Content-Disposition: inline In-Reply-To: <20061215012503.GK13476@localhost.localdomain> Subject: [devel] [PATCH] apt virtual packages X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.9rc1 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Dec 2006 13:43:40 -0000 Archived-At: List-Archive: List-Post: --oLBj+sq0vYjzfsbl Content-Type: multipart/mixed; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 15, 2006 at 04:25:03AM +0300, Alexey Tourbin wrote: > On Fri, Dec 15, 2006 at 02:40:38AM +0300, Alexey Tourbin wrote: > > =F4.=C5. 2.4.4-alt2.1 =D7 =DC=D4=CF=CD =CD=C5=D3=D4=C5 =CE=C5 =D7=C9=C4= =CE=CF =D7=CF=CF=C2=DD=C5. > > =F3=CF=CF=D4=D7=C5=D4=D3=D4=D7=C5=CE=CE=CF, =C4=C1=CC=D8=DB=C5, =D7=C5= =D2=CF=D1=D4=CE=CF, =D3=D4=CF=C9=D4 =CB=CF=D7=D9=D2=D1=D4=D8 pkgVersionMatc= h::Find. >=20 > =F7=CF=D4 =C6=C9=CB=D3, =D3 =CB=CF=D4=CF=D2=D9=CD =C2=D5=C4=C5=D4 =D7=D9= =C2=C9=D2=C1=D4=D8=D3=D1 =CE=C5 =D0=C5=D2=D7=C1=D1 =D0=CF=D0=C1=D7=DB=C1=D1= =D3=D1, =C1 =D0=CF=D3=CC=C5=C4=CE=D1=D1 > =D0=CF=D0=C1=D7=DB=C1=D1=D3=D1 =D7=C5=D2=D3=C9=D1. install python-devel= =3D2.4 =D4=C5=D0=C5=D2=D8 =D2=C1=C2=CF=D4=C1=C5=D4 (=D7 =D4=CF=CD > =D3=CD=D9=D3=CC=C5, =DE=D4=CF =D5=D3=D4=C1=CE=CF=D7=C9=D4=D8 =CD=CF=D6=CE= =CF =D4=CF=CC=D8=CB=CF 2.4.4-alt2.1). >=20 > --- apt-pkg/versionmatch.cc- 2006-12-15 01:11:52 +0000 > +++ apt-pkg/versionmatch.cc 2006-12-15 01:15:17 +0000 > @@ -205,10 +205,10 @@ pkgCache::VerIterator pkgVersionMatch::F > if (VerPrefixMatch || (HasRelease && strchr(PrvVerStr, '-') =3D= =3D NULL)) > { > if (MatchVer(PrvVerStr,VerStr,VerPrefixMatch) =3D=3D true) > - return Prv.OwnerVer(); > + Ver =3D Prv.OwnerVer(); > } else { > if (VS->CheckDep(PrvVerStr,VerOp,VerStr.c_str()) =3D=3D true) > - return Prv.OwnerVer(); > + Ver =3D Prv.OwnerVer(); > } > } > } >=20 > =F7=D0=D2=CF=DE=C5=CD install python-base=3D2.4.4-alt2 python-devel=3D2.4 > =CE=C5 =D2=C1=C2=CF=D4=C1=C5=D4 =CE=C9 =D4=C1=CB =CE=C9 =D3=D1=CB. =FC=D4=CF=D4 =D0=C1=D4=DE =C2=D9=CC =CE=C5=D0=D2=C1=D7=C9=CC=D8=CE=D9=CD, = =D0=CF=D4=CF=CD=D5 =DE=D4=CF =D7=C5=D2=D3=C9=C9 =D7 ProvidesList =CE=C1 =D3= =C1=CD=CF=CD =C4=C5=CC=C5 =CE=C5 =CF=D4=D3=CF=D2=D4=C9=D2=CF=D7=C1=CE=D9. =F7=CF=D4 =D0= =D2=C1=D7=C9=CC=D8=CE=D9=CA =D7=C1=D2=C9=C1=CE=D4 =D0=C1=D4=DE=C1 (=D0=D2= =C9=C3=C5=D0=CC=C5=CE). --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="versionmatch.patch" Content-Transfer-Encoding: quoted-printable --- apt-0.5.15lorg2/apt-pkg/versionmatch.h- 2006-06-17 22:00:13 +0400 +++ apt-0.5.15lorg2/apt-pkg/versionmatch.h 2006-12-17 15:49:08 +0300 @@ -36,6 +36,7 @@ #endif =20 #include +#include #include =20 using std::string; @@ -70,6 +71,7 @@ =20 // CNC:2003-11-05 pkgVersionMatch(string Data,MatchType Type,int Op=3DpkgCache::Dep::Equa= ls); + std::list FindAll(pkgCache::PkgIterator Pkg); }; =20 #endif --- apt-0.5.15lorg2/apt-pkg/versionmatch.cc- 2006-12-15 04:11:52 +0300 +++ apt-0.5.15lorg2/apt-pkg/versionmatch.cc 2006-12-17 16:38:44 +0300 @@ -164,11 +164,17 @@ // VersionMatch::Find - Locate the best match for the select type /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg) +static inline bool +vercmpOrder(const pkgCache::VerIterator &a, const pkgCache::VerIterator &b) +{ + return a.CompareVer(b) < 0; +} +std::list pkgVersionMatch::FindAll(pkgCache::PkgIte= rator Pkg) { // CNC:2003-11-05 pkgVersioningSystem *VS =3D Pkg.Cache()->VS; pkgCache::VerIterator Ver =3D Pkg.VersionList(); + std::list found; =20 for (; Ver.end() =3D=3D false; Ver++) { @@ -178,10 +184,10 @@ if (VerPrefixMatch) { if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) =3D=3D true) - return Ver; + found.push_back(Ver); } else { if (VS->CheckDep(Ver.VerStr(),VerOp,VerStr.c_str()) =3D=3D true) - return Ver; + found.push_back(Ver); } =20 continue; @@ -189,8 +195,11 @@ =20 for (pkgCache::VerFileIterator VF =3D Ver.FileList(); VF.end() =3D= =3D false; VF++) if (FileMatch(VF.File()) =3D=3D true) - return Ver; + found.push_back(Ver); } + + if (found.size() > 0) + goto done; =20 // CNC:2003-11-11 - Virtual package handling. if (Type =3D=3D Version) @@ -205,15 +214,32 @@ if (VerPrefixMatch || (HasRelease && strchr(PrvVerStr, '-') =3D= =3D NULL)) { if (MatchVer(PrvVerStr,VerStr,VerPrefixMatch) =3D=3D true) - return Prv.OwnerVer(); + found.push_back(Prv.OwnerVer()); } else { if (VS->CheckDep(PrvVerStr,VerOp,VerStr.c_str()) =3D=3D true) - return Prv.OwnerVer(); + found.push_back(Prv.OwnerVer()); } } } =20 - // This will be Ended by now. +done: + // best versions go first + found.sort(vercmpOrder); + found.unique(); + found.reverse(); + return found; +} + +pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg) +{ + std::list found =3D FindAll(Pkg); + if (found.size() > 0) + return found.front(); + + // return "empty" iterator at its end + pkgCache::VerIterator Ver =3D Pkg.VersionList(); + while (Ver.end() =3D=3D false) + Ver++; return Ver; } /*}}}*/ --yrj/dFKFPuw6o+aM-- --oLBj+sq0vYjzfsbl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFhUmMfBKgtDjnu0YRAtGyAKDZ+U16sjqcYPOnbB213fc8pQ+kPgCfb9+d 7nhyrZjm6Bep/HOemre5mMc= =lGOP -----END PGP SIGNATURE----- --oLBj+sq0vYjzfsbl--