summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-03-12 17:55:08 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:58:46 +0100
commit68134bda8868a8614edf137aad7e9be61cd2a6ee (patch)
treed612ec5af3205437469f90038f97c83d47d78848 /apt-pkg/pkgcachegen.cc
parente33dbfe5cea09b2124be8db5a6ae0eb82ad7e9c5 (diff)
abstract version hash comparison a bit
In #737085 we see that apt can be confused if informations about versions only differ slightly. This commit adds a way of at least adding a few more data points with the next abi break to help a bit with it. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 525f1dfb4..810f0b022 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -356,7 +356,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
map_ptrloc *LastVer = &Pkg->VersionList;
void const * oldMap = Map.Data();
- unsigned long const Hash = List.VersionHash();
+ unsigned short const Hash = List.VersionHash();
if (Ver.end() == false)
{
/* We know the list is sorted so we use that fact in the search.
@@ -369,7 +369,7 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
if (Res > 0)
break;
// Versionstrings are equal - is hash also equal?
- if (Res == 0 && Ver->Hash == Hash)
+ if (Res == 0 && List.SameVersion(Hash, Ver) == true)
break;
// proceed with the next till we have either the right
// or we found another version (which will be lower)
@@ -558,12 +558,12 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
if (Counter % 100 == 0 && Progress != 0)
Progress->Progress(List.Offset());
- unsigned long Hash = List.VersionHash();
+ unsigned short Hash = List.VersionHash();
pkgCache::VerIterator Ver = Pkg.VersionList();
Dynamic<pkgCache::VerIterator> DynVer(Ver);
for (; Ver.end() == false; ++Ver)
{
- if (Ver->Hash == Hash && Version == Ver.VerStr())
+ if (List.SameVersion(Hash, Ver) == true && Version == Ver.VerStr())
{
if (List.CollectFileProvides(Cache,Ver) == false)
return _error->Error(_("Error occurred while processing %s (%s%d)"),
@@ -1051,6 +1051,12 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver,
return true;
}
/*}}}*/
+bool pkgCacheGenerator::ListParser::SameVersion(unsigned short const Hash,/*{{{*/
+ pkgCache::VerIterator const &Ver)
+{
+ return Hash == Ver->Hash;
+}
+ /*}}}*/
// CacheGenerator::SelectFile - Select the current file being parsed /*{{{*/
// ---------------------------------------------------------------------
/* This is used to select which file is to be associated with all newly