summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/deb/deblistparser.cc47
-rw-r--r--apt-pkg/deb/deblistparser.h3
2 files changed, 29 insertions, 21 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 7777d654e..18b8b931d 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -104,44 +104,49 @@ string debListParser::Version()
return Section.FindS("Version");
}
/*}}}*/
-// ListParser::NewVersion - Fill in the version structure /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
+unsigned char debListParser::ParseMultiArch(bool const showErrors) /*{{{*/
{
- // Parse the section
- Ver->Section = UniqFindTagWrite("Section");
-
- // Parse multi-arch
+ unsigned char MA;
string const MultiArch = Section.FindS("Multi-Arch");
if (MultiArch.empty() == true)
- Ver->MultiArch = pkgCache::Version::None;
+ MA = pkgCache::Version::None;
else if (MultiArch == "same") {
- // Parse multi-arch
if (ArchitectureAll() == true)
{
- /* Arch all packages can't be Multi-Arch: same */
- _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
- Section.FindS("Package").c_str());
- Ver->MultiArch = pkgCache::Version::None;
+ if (showErrors == true)
+ _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
+ Section.FindS("Package").c_str());
+ MA = pkgCache::Version::None;
}
else
- Ver->MultiArch = pkgCache::Version::Same;
+ MA = pkgCache::Version::Same;
}
else if (MultiArch == "foreign")
- Ver->MultiArch = pkgCache::Version::Foreign;
+ MA = pkgCache::Version::Foreign;
else if (MultiArch == "allowed")
- Ver->MultiArch = pkgCache::Version::Allowed;
+ MA = pkgCache::Version::Allowed;
else
{
- _error->Warning("Unknown Multi-Arch type '%s' for package '%s'",
- MultiArch.c_str(), Section.FindS("Package").c_str());
- Ver->MultiArch = pkgCache::Version::None;
+ if (showErrors == true)
+ _error->Warning("Unknown Multi-Arch type '%s' for package '%s'",
+ MultiArch.c_str(), Section.FindS("Package").c_str());
+ MA = pkgCache::Version::None;
}
if (ArchitectureAll() == true)
- Ver->MultiArch |= pkgCache::Version::All;
+ MA |= pkgCache::Version::All;
+ return MA;
+}
+ /*}}}*/
+// ListParser::NewVersion - Fill in the version structure /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
+{
+ // Parse the section
+ Ver->Section = UniqFindTagWrite("Section");
+ Ver->MultiArch = ParseMultiArch(true);
// Archive Size
Ver->Size = Section.FindULL("Size");
// Unpacked Size (in K)
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index c0973260f..03733ae8c 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -97,6 +97,9 @@ class debListParser : public pkgCacheGenerator::ListParser
debListParser(FileFd *File, std::string const &Arch = "");
virtual ~debListParser() {};
+
+ private:
+ unsigned char ParseMultiArch(bool const showErrors);
};
#endif