summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debindexfile.cc1
-rw-r--r--apt-pkg/deb/deblistparser.cc46
-rw-r--r--apt-pkg/deb/deblistparser.h5
-rw-r--r--apt-pkg/deb/debmetaindex.cc1
4 files changed, 22 insertions, 31 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 279f35a38..e4ceebff2 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -23,6 +23,7 @@
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/srcrecords.h>
+#include <apt-pkg/strutl.h>
#include <iostream>
#include <memory>
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 75fc2d242..eaa9dfda9 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -14,11 +14,10 @@
#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>
#include <apt-pkg/macros.h>
-#include <apt-pkg/md5.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/tagfile-keys.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,30 +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)
- {
- map_stringitem_t const idx = StoreString(pkgCacheGenerator::PKGNAME, pkgname);
- G = Ver.ParentPkg().Group();
- Ver->SourcePkgName = idx;
- }
+ 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);
@@ -295,10 +287,10 @@ APT::StringView debListParser::Description_md5()
if (desc == "\n")
return StringView();
- MD5Summation md5;
+ Hashes md5(Hashes::MD5SUM);
md5.Add(desc.data(), desc.size());
md5.Add("\n");
- MD5Buffer = md5.Result();
+ MD5Buffer = md5.GetHashString(Hashes::MD5SUM).HashValue();
return StringView(MD5Buffer);
}
else if (likely(value.size() == 32))
@@ -346,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,
@@ -357,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;
@@ -378,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);
}
@@ -998,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)
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index c041585e6..eefce2a6a 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -11,7 +11,6 @@
#define PKGLIB_DEBLISTPARSER_H
#include <apt-pkg/macros.h>
-#include <apt-pkg/md5.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgcachegen.h>
#include <apt-pkg/tagfile.h>
@@ -65,8 +64,8 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
virtual APT::StringView Description_md5() APT_OVERRIDE;
- virtual unsigned short VersionHash() APT_OVERRIDE;
- virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
+ virtual uint32_t VersionHash() APT_OVERRIDE;
+ virtual bool SameVersion(uint32_t Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
pkgCache::VerIterator &Ver) APT_OVERRIDE;
virtual map_filesize_t Offset() APT_OVERRIDE {return iOffset;};
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index a88b19807..2c0ab1d0d 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -915,7 +915,6 @@ bool debReleaseIndex::Merge(pkgCacheGenerator &Gen,OpProgress * /*Prog*/) const/
#undef APT_INRELEASE
Section.FindFlag("NotAutomatic", File->Flags, pkgCache::Flag::NotAutomatic);
Section.FindFlag("ButAutomaticUpgrades", File->Flags, pkgCache::Flag::ButAutomaticUpgrades);
- Section.FindFlag("Packages-Require-Authorization", File->Flags, pkgCache::Flag::PackagesRequireAuthorization);
return true;
}