summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-03-12 16:53:44 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:58:46 +0100
commite33dbfe5cea09b2124be8db5a6ae0eb82ad7e9c5 (patch)
tree500a83dba65b970dbe0fdf9677da28d45ebfbe2b /apt-pkg/deb/deblistparser.cc
parent3b8eb3bc1afb1fc84c6909cf2ee4907b82447409 (diff)
factor out parsing of MultiArch flag
Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc47
1 files changed, 26 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)