summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc43
1 files changed, 16 insertions, 27 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 21d1736e4..eaa9dfda9 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -14,7 +14,6 @@
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/cachefilter.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/crc-16.h>
#include <apt-pkg/deblistparser.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
@@ -166,8 +165,12 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
}
// Parse the source package name
pkgCache::GrpIterator G = Ver.ParentPkg().Group();
+
+ // Setup the defaults
Ver->SourcePkgName = G->Name;
Ver->SourceVerStr = Ver->VerStr;
+
+ // Parse the name and version str
if (Section.Find(pkgTagSection::Key::Source,Start,Stop) == true)
{
const char * const Space = static_cast<const char *>(memchr(Start, ' ', Stop - Start));
@@ -194,33 +197,19 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
}
APT::StringView const pkgname(Start, Stop - Start);
+ // Oh, our group is the wrong one for the source package. Make a new one.
if (pkgname != G.Name())
{
- for (pkgCache::PkgIterator P = G.PackageList(); P.end() == false; P = G.NextPkg(P))
- {
- for (V = P.VersionList(); V.end() == false; ++V)
- {
- if (pkgname == V.SourcePkgName())
- {
- Ver->SourcePkgName = V->SourcePkgName;
- break;
- }
- }
- if (V.end() == false)
- break;
- }
- if (V.end() == true)
- {
- pkgCache::GrpIterator SG;
- if (not NewGroup(SG, pkgname))
- return false;
-
- G = Ver.ParentPkg().Group();
- Ver->SourcePkgName = SG->Name;
- }
+ if (not NewGroup(G, pkgname))
+ return false;
}
}
+ // Link into by source package group.
+ Ver->SourcePkgName = G->Name;
+ Ver->NextInSource = G->VersionsInSource;
+ G->VersionsInSource = Ver.Index();
+
Ver->MultiArch = ParseMultiArch(true);
// Archive Size
Ver->Size = Section.FindULL(pkgTagSection::Key::Size);
@@ -349,7 +338,7 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
// ---------------------------------------------------------------------
/* */
-unsigned short debListParser::VersionHash()
+uint32_t debListParser::VersionHash()
{
static constexpr pkgTagSection::Key Sections[] ={
pkgTagSection::Key::Installed_Size,
@@ -360,7 +349,7 @@ unsigned short debListParser::VersionHash()
pkgTagSection::Key::Conflicts,
pkgTagSection::Key::Breaks,
pkgTagSection::Key::Replaces};
- unsigned long Result = INIT_FCS;
+ unsigned long Result = 5381;
for (auto I : Sections)
{
const char *Start;
@@ -381,7 +370,7 @@ unsigned short debListParser::VersionHash()
}
if (isspace_ascii(*Start) != 0 || *Start == '=')
continue;
- Result = AddCRC16Byte(Result, tolower_ascii_unsafe(*Start));
+ Result = 33 * Result + tolower_ascii_unsafe(*Start);
}
@@ -1001,7 +990,7 @@ unsigned char debListParser::GetPrio(string Str)
return Out;
}
/*}}}*/
-bool debListParser::SameVersion(unsigned short const Hash, /*{{{*/
+bool debListParser::SameVersion(uint32_t Hash, /*{{{*/
pkgCache::VerIterator const &Ver)
{
if (pkgCacheListParser::SameVersion(Hash, Ver) == false)