diff options
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 17c283615..3bcd381c0 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -73,8 +73,19 @@ string debListParser::Package() { string Result = Section.Find(pkgTagSection::Key::Package).to_string(); // Normalize mixed case package names to lower case, like dpkg does - // See Bug#807012 for details - std::transform(Result.begin(), Result.end(), Result.begin(), tolower_ascii); + // See Bug#807012 for details. + // Only do this when the package name does not contain a / - as that + // indicates that the package name was derived from a filename given + // to install or build-dep or similar (Bug#854794) + if (likely(Result.find('/') == string::npos)) + { + for (char &c: Result) + { + char l = tolower_ascii_inline(c); + if (unlikely(l != c)) + c = l; + } + } if(unlikely(Result.empty() == true)) _error->Warning("Encountered a section with no Package: header"); @@ -559,11 +570,23 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, bool const &StripMultiArch, bool const &ParseRestrictionsList) { + return debListParser::ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, + StripMultiArch, ParseRestrictionsList, + _config->Find("APT::Architecture")); +} + +const char *debListParser::ParseDepends(const char *Start,const char *Stop, + string &Package,string &Ver, + unsigned int &Op, bool const &ParseArchFlags, + bool const &StripMultiArch, + bool const &ParseRestrictionsList, + string const &Arch) +{ StringView PackageView; StringView VerView; auto res = ParseDepends(Start, Stop, PackageView, VerView, Op, (bool)ParseArchFlags, - (bool) StripMultiArch, (bool) ParseRestrictionsList); + (bool) StripMultiArch, (bool) ParseRestrictionsList, Arch); Package = PackageView.to_string(); Ver = VerView.to_string(); @@ -575,6 +598,17 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, bool StripMultiArch, bool ParseRestrictionsList) { + return debListParser::ParseDepends(Start, Stop, Package, Ver, Op, ParseArchFlags, + StripMultiArch, ParseRestrictionsList, + _config->Find("APT::Architecture")); +} + +const char *debListParser::ParseDepends(const char *Start,const char *Stop, + StringView &Package,StringView &Ver, + unsigned int &Op, bool ParseArchFlags, + bool StripMultiArch, + bool ParseRestrictionsList, string const &Arch) +{ // Strip off leading space for (;Start != Stop && isspace_ascii(*Start) != 0; ++Start); @@ -642,8 +676,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, if (unlikely(ParseArchFlags == true)) { - string const arch = _config->Find("APT::Architecture"); - APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false); + APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(Arch, false); // Parse an architecture if (I != Stop && *I == '[') |