0.5.15lorg2-alt8

- Fixed longstanding problem with versioned virtual packages (Alexey Tourbin),
  see http://lists.altlinux.org/pipermail/devel/2006-December/039317.html
This commit is contained in:
Дмитрий Левин 2006-12-31 00:29:51 +00:00
parent b1a4603d03
commit 11b0080fe6
2 changed files with 110 additions and 1 deletions

View File

@ -0,0 +1,103 @@
http://lists.altlinux.org/pipermail/devel/2006-December/039698.html
--- apt-0.5.15lorg2.orig/apt-pkg/versionmatch.cc 2006-12-31 00:19:56 +0000
+++ apt-0.5.15lorg2/apt-pkg/versionmatch.cc 2006-12-31 00:20:42 +0000
@@ -164,11 +164,17 @@ bool pkgVersionMatch::MatchVer(const cha
// 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<pkgCache::VerIterator> pkgVersionMatch::FindAll(pkgCache::PkgIterator Pkg)
{
// CNC:2003-11-05
pkgVersioningSystem *VS = Pkg.Cache()->VS;
pkgCache::VerIterator Ver = Pkg.VersionList();
+ std::list<pkgCache::VerIterator> found;
for (; Ver.end() == false; Ver++)
{
@@ -178,10 +184,10 @@ pkgCache::VerIterator pkgVersionMatch::F
if (VerPrefixMatch)
{
if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
- return Ver;
+ found.push_back(Ver);
} else {
if (VS->CheckDep(Ver.VerStr(),VerOp,VerStr.c_str()) == true)
- return Ver;
+ found.push_back(Ver);
}
continue;
@@ -189,8 +195,11 @@ pkgCache::VerIterator pkgVersionMatch::F
for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
if (FileMatch(VF.File()) == true)
- return Ver;
+ found.push_back(Ver);
}
+
+ if (found.size() > 0)
+ goto done;
// CNC:2003-11-11 - Virtual package handling.
if (Type == Version)
@@ -205,15 +214,32 @@ pkgCache::VerIterator pkgVersionMatch::F
if (VerPrefixMatch || (HasRelease && strchr(PrvVerStr, '-') == NULL))
{
if (MatchVer(PrvVerStr,VerStr,VerPrefixMatch) == true)
- return Prv.OwnerVer();
+ found.push_back(Prv.OwnerVer());
} else {
if (VS->CheckDep(PrvVerStr,VerOp,VerStr.c_str()) == true)
- return Prv.OwnerVer();
+ found.push_back(Prv.OwnerVer());
}
}
}
- // 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<pkgCache::VerIterator> found = FindAll(Pkg);
+ if (found.size() > 0)
+ return found.front();
+
+ // return "empty" iterator at its end
+ pkgCache::VerIterator Ver = Pkg.VersionList();
+ while (Ver.end() == false)
+ Ver++;
return Ver;
}
/*}}}*/
--- apt-0.5.15lorg2.orig/apt-pkg/versionmatch.h 2006-12-31 00:19:56 +0000
+++ apt-0.5.15lorg2/apt-pkg/versionmatch.h 2006-12-31 00:20:42 +0000
@@ -36,6 +36,7 @@
#endif
#include <string>
+#include <list>
#include <apt-pkg/pkgcache.h>
using std::string;
@@ -70,6 +71,7 @@ class pkgVersionMatch
// CNC:2003-11-05
pkgVersionMatch(string Data,MatchType Type,int Op=pkgCache::Dep::Equals);
+ std::list<pkgCache::VerIterator> FindAll(pkgCache::PkgIterator Pkg);
};
#endif

View File

@ -2,7 +2,7 @@
Name: apt
Version: 0.5.15lorg2
Release: alt7
Release: alt8
Summary: Debian's Advanced Packaging Tool with RPM support
Summary(ru_RU.KOI8-R): Debian APT - õÓÏ×ÅÒÛÅÎÓÔ×Ï×ÁÎÎÏÅ ÓÒÅÄÓÔ×Ï ÕÐÒÁ×ÌÅÎÉÑ ÐÁËÅÔÁÍÉ Ó ÐÏÄÄÅÒÖËÏÊ RPM
@ -60,6 +60,7 @@ Patch46: apt-0.5.15lorg2-alt-pkgCache-PrvIterator.patch
Patch47: apt-0.5.15lorg2-alt-realloc.patch
Patch48: apt-0.5.15lorg2-alt-apt-get-TryToInstall-PrvPkgCandVer.patch
Patch49: apt-0.5.15lorg2-alt-apt-get-simple-output.patch
Patch50: apt-0.5.15lorg2-alt-versionmatch.patch
# Normally not applied, but useful.
Patch101: apt-0.5.4cnc9-alt-getsrc-debug.patch
@ -264,6 +265,7 @@ This package contains method 'rsync' for APT.
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
find -type f -name \*.orig -delete
@ -378,6 +380,10 @@ fi
# Probably %%doc with README.rsync?
%changelog
* Sun Dec 31 2006 Dmitry V. Levin <ldv@altlinux.org> 0.5.15lorg2-alt8
- Fixed longstanding problem with versioned virtual packages (Alexey Tourbin),
see http://lists.altlinux.org/pipermail/devel/2006-December/039317.html
* Thu Nov 30 2006 Dmitry V. Levin <ldv@altlinux.org> 0.5.15lorg2-alt7
- apt-get: More simple-output enhancements (Stanislav Ievlev).