diff options
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 43 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 11 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 20 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.h | 4 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.cc | 12 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 23 |
6 files changed, 87 insertions, 26 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 == '[') diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 733ea0542..5e945812d 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -105,6 +105,11 @@ class APT_HIDDEN debListParser : public pkgCacheListParser std::string &Package,std::string &Ver,unsigned int &Op, bool const &ParseArchFlags, bool const &StripMultiArch, bool const &ParseRestrictionsList); + APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop, + std::string &Package,std::string &Ver,unsigned int &Op, + bool const &ParseArchFlags, bool const &StripMultiArch, + bool const &ParseRestrictionsList, + std::string const &Arch); #ifdef APT_PKG_EXPOSE_STRING_VIEW APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop, @@ -112,6 +117,12 @@ class APT_HIDDEN debListParser : public pkgCacheListParser APT::StringView &Ver,unsigned int &Op, bool const ParseArchFlags = false, bool StripMultiArch = true, bool const ParseRestrictionsList = false); + APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop, + APT::StringView &Package, + APT::StringView &Ver,unsigned int &Op, + bool const ParseArchFlags, bool StripMultiArch, + bool const ParseRestrictionsList, + std::string const &Arch); #endif APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op); diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 1a89fcc88..f25906fba 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -274,11 +274,14 @@ static void GetIndexTargetsFor(char const * const Type, std::string const &URI, if (dup != IndexTargets.end()) { std::string const dupEntry = dup->Option(IndexTarget::SOURCESENTRY); - //TRANSLATOR: an identifier like Packages; Releasefile key indicating - // a file like main/binary-amd64/Packages; filename and linenumber of - // two sources.list entries - _error->Warning(_("Target %s (%s) is configured multiple times in %s and %s"), - T->c_str(), MetaKey.c_str(), dupEntry.c_str(), E->sourcesEntry.c_str()); + if (T->find("legacy") == std::string::npos) + { + //TRANSLATOR: an identifier like Packages; Releasefile key indicating + // a file like main/binary-amd64/Packages; filename and linenumber of + // two sources.list entries + _error->Warning(_("Target %s (%s) is configured multiple times in %s and %s"), + T->c_str(), MetaKey.c_str(), dupEntry.c_str(), E->sourcesEntry.c_str()); + } if (tplMetaKey.find(BreakPoint) == std::string::npos) break; continue; @@ -1098,8 +1101,11 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ UseByHash = _config->Find("Acquire::By-Hash", UseByHash); { std::string const host = ::URI(URI).Host; - UseByHash = _config->Find("APT::Acquire::" + host + "::By-Hash", UseByHash); - UseByHash = _config->Find("Acquire::" + host + "::By-Hash", UseByHash); + if (host.empty() == false) + { + UseByHash = _config->Find("APT::Acquire::" + host + "::By-Hash", UseByHash); + UseByHash = _config->Find("Acquire::" + host + "::By-Hash", UseByHash); + } std::map<std::string, std::string>::const_iterator const opt = Options.find("by-hash"); if (opt != Options.end()) UseByHash = opt->second; diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index b412dbaef..bc800bc89 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -5,8 +5,8 @@ Debian Package Records - Parser for debian package records - This provides display-type parsing for the Packages file. This is - different than the the list parser which provides cache generation + This provides display-type parsing for the Packages file. This is + different than the list parser which provides cache generation services. There should be no overlap between these two. ##################################################################### */ diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 407b02d39..caaa53063 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -129,8 +129,18 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe return _error->Error("Problem parsing dependency: %s", fields[I]); rec.Type = I; - if (rec.Package != "") + // We parsed a package that was ignored (wrong architecture restriction + // or something). + if (rec.Package == "") { + // If we are in an OR group, we need to set the "Or" flag of the + // previous entry to our value. + if (BuildDeps.size() > 0 && (BuildDeps[BuildDeps.size() - 1].Op & pkgCache::Dep::Or) == pkgCache::Dep::Or) { + BuildDeps[BuildDeps.size() - 1].Op &= ~pkgCache::Dep::Or; + BuildDeps[BuildDeps.size() - 1].Op |= (rec.Op & pkgCache::Dep::Or); + } + } else { BuildDeps.push_back(rec); + } if (Start == Stop) break; diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 45ed66996..01282efcc 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -670,7 +670,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) if (unlikely(candset.empty())) { if (Debug == true) - std::clog << "unable to figure out which package is dpkg refering to with '" << pkgname << "'! (1)" << std::endl; + std::clog << "unable to figure out which package is dpkg referring to with '" << pkgname << "'! (1)" << std::endl; return; } else if (candset.size() == 1) // we are lucky @@ -760,7 +760,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) if (pkgname.find(':') != std::string::npos) { if (Debug == true) - std::clog << "unable to figure out which package is dpkg refering to with '" << pkgname << "'! (2)" << std::endl; + std::clog << "unable to figure out which package is dpkg referring to with '" << pkgname << "'! (2)" << std::endl; return; } } @@ -985,7 +985,8 @@ void pkgDPkgPM::WriteHistoryTag(string const &tag, string value) // DPkgPM::OpenLog /*{{{*/ bool pkgDPkgPM::OpenLog() { - string const logdir = _config->FindDir("Dir::Log"); + string const logfile_name = _config->FindFile("Dir::Log::Terminal"); + string logdir = flNotFile(logfile_name); if(CreateAPTDirectoryIfNeeded(logdir, logdir) == false) // FIXME: use a better string after freeze return _error->Error(_("Directory '%s' missing"), logdir.c_str()); @@ -998,8 +999,6 @@ bool pkgDPkgPM::OpenLog() strftime(timestr, sizeof(timestr), "%F %T", tmp); // open terminal log - string const logfile_name = flCombine(logdir, - _config->Find("Dir::Log::Terminal")); if (!logfile_name.empty()) { d->term_out = fopen(logfile_name.c_str(),"a"); @@ -1020,8 +1019,10 @@ bool pkgDPkgPM::OpenLog() } // write your history - string const history_name = flCombine(logdir, - _config->Find("Dir::Log::History")); + string const history_name = _config->FindFile("Dir::Log::History"); + string logdir2 = flNotFile(logfile_name); + if(logdir != logdir2 && CreateAPTDirectoryIfNeeded(logdir2, logdir2) == false) + return _error->Error(_("Directory '%s' missing"), logdir.c_str()); if (!history_name.empty()) { d->history_out = fopen(history_name.c_str(),"a"); @@ -1447,7 +1448,7 @@ bool pkgDPkgPM::ExpandPendingCalls(std::vector<Item> &List, pkgDepCache &Cache) } bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) { - // explicitely remove&configure everything for hookscripts and progress building + // explicitly remove&configure everything for hookscripts and progress building // we need them only temporarily through, so keep the length and erase afterwards decltype(List)::const_iterator::difference_type explicitIdx = std::distance(List.cbegin(), List.cend()); @@ -1509,7 +1510,7 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) dpkg_recursive_install = Cache.VS().CmpVersion("1.18.5", dpkgpkg.CurrentVer().VerStr()) <= 0; } // no point in doing this dance for a handful of packages only - unsigned int const dpkg_recursive_install_min = _config->FindB("dpkg::install::recursive::minimum", 5); + unsigned int const dpkg_recursive_install_min = _config->FindI("dpkg::install::recursive::minimum", 5); // FIXME: workaround for dpkg bug, see our ./test-bug-740843-versioned-up-down-breaks test bool const dpkg_recursive_install_numbered = _config->FindB("dpkg::install::recursive::numbered", true); @@ -1911,7 +1912,7 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) ADDARG(fullname); } } - // skip configure action if all sheduled packages disappeared + // skip configure action if all scheduled packages disappeared if (oldSize == Size) continue; } @@ -2103,7 +2104,7 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) if (d->dpkg_error.empty() == false) { - // no point in reseting packages we already completed removal for + // no point in resetting packages we already completed removal for StripAlreadyDoneFrom(approvedStates.Remove()); StripAlreadyDoneFrom(approvedStates.Purge()); APT::StateChanges undo; |