diff options
| author | Julian Andres Klode <jak@debian.org> | 2022-05-06 16:20:52 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2022-05-06 16:20:52 +0000 |
| commit | 97f16727b50dcaa4810e80d3c16639e0ce6a0958 (patch) | |
| tree | 1228c44118015b13b2f94177571c6780eb861a7e /apt-pkg/deb/deblistparser.cc | |
| parent | 6778e2d672d84c962a578f6de415c666b9cf6ee1 (diff) | |
| parent | 05fae6fae95d8ef6690f3d56863e3bb6a44d424c (diff) | |
Merge branch 'fix/tagfilekeys' into 'main'
Consistently dealing with fields via pkgTagSection::Key
See merge request apt-team/apt!233
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
| -rw-r--r-- | apt-pkg/deb/deblistparser.cc | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 2f0ebaa7b..6f47053a5 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -126,7 +126,7 @@ unsigned char debListParser::ParseMultiArch(bool const showErrors) /*{{{*/ { if (showErrors == true) _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same", - Section.FindS("Package").c_str()); + Package().c_str()); MA = pkgCache::Version::No; } else @@ -140,7 +140,7 @@ unsigned char debListParser::ParseMultiArch(bool const showErrors) /*{{{*/ { if (showErrors == true) _error->Warning("Unknown Multi-Arch type '%s' for package '%s'", - MultiArch.to_string().c_str(), Section.FindS("Package").c_str()); + MultiArch.to_string().c_str(), Package().c_str()); MA = pkgCache::Version::No; } @@ -241,10 +241,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) return false; if (ParseDepends(Ver,pkgTagSection::Key::Enhances,pkgCache::Dep::Enhances) == false) return false; - // Obsolete. - if (ParseDepends(Ver,pkgTagSection::Key::Optional,pkgCache::Dep::Suggests) == false) - return false; - + if (ParseProvides(Ver) == false) return false; if (not APT::KernelAutoRemoveHelper::getUname(Ver.ParentPkg().Name()).empty()) @@ -259,21 +256,20 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) // ListParser::AvailableDescriptionLanguages /*{{{*/ std::vector<std::string> debListParser::AvailableDescriptionLanguages() { - std::vector<std::string> const understood = APT::Configuration::getLanguages(true); std::vector<std::string> avail; static constexpr int prefixLen = 12; char buf[32] = "Description-"; - if (Section.Exists("Description") == true) - avail.push_back(""); - for (std::vector<std::string>::const_iterator lang = understood.begin(); lang != understood.end(); ++lang) + if (Section.Exists(pkgTagSection::Key::Description)) + avail.emplace_back(); + for (auto const &lang : APT::Configuration::getLanguages(true)) { - if (unlikely(lang->size() > sizeof(buf) - prefixLen)) { - _error->Warning("Ignoring translated description %s", lang->c_str()); + if (unlikely(lang.size() > sizeof(buf) - prefixLen)) { + _error->Warning("Ignoring translated description %s", lang.c_str()); continue; } - memcpy(buf + prefixLen, lang->c_str(), lang->size()); - if (Section.Exists(StringView(buf, prefixLen + lang->size())) == true) - avail.push_back(*lang); + memcpy(buf + prefixLen, lang.c_str(), lang.size()); + if (Section.Exists(StringView(buf, prefixLen + lang.size())) == true) + avail.push_back(lang); } return avail; } |
