diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:18:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:18:38 +0000 |
commit | b81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4 (patch) | |
tree | bf5624f8edc149dca9d78bfa8bcbf2d493c8b128 /apt-private | |
parent | Adding upstream version 2.9.2. (diff) | |
download | apt-b81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4.tar.xz apt-b81238fa02b2348f3fbb90e4d5e54a3ad8d78ac4.zip |
Adding upstream version 2.9.3.upstream/2.9.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-cmndline.cc | 8 | ||||
-rw-r--r-- | apt-private/private-install.cc | 40 | ||||
-rw-r--r-- | apt-private/private-output.cc | 4 | ||||
-rw-r--r-- | apt-private/private-show.cc | 14 | ||||
-rw-r--r-- | apt-private/private-source.cc | 8 |
5 files changed, 52 insertions, 22 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index b05ec89..592ebd9 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -190,6 +190,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const addArg(0, "auto-remove", "APT::Get::AutomaticRemove", 0); addArg(0, "reinstall", "APT::Get::ReInstall", 0); addArg(0, "solver", "APT::Solver", CommandLine::HasArg); + addArg(0, "strict-pinning", "APT::Solver::Strict-Pinning", 0); addArg(0, "planner", "APT::Planner", CommandLine::HasArg); addArg('U', "update", "APT::Update", 0); if (CmdMatches("upgrade")) @@ -230,6 +231,7 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg); addArg(0, "purge", "APT::Get::Purge", 0); addArg(0, "solver", "APT::Solver", CommandLine::HasArg); + addArg(0, "strict-pinning", "APT::Solver::Strict-Pinning", 0); if (CmdMatches("build-dep")) { addArg(0,"arch-only","APT::Get::Arch-Only",0); @@ -580,6 +582,12 @@ std::vector<CommandLine::Dispatch> ParseCommandLine(CommandLine &CmdL, APT_CMD c _error->Warning(_("--force-yes is deprecated, use one of the options starting with --allow instead.")); } + if (not _config->FindB("APT::Solver::Strict-Pinning", true) && _config->Find("APT::Solver", "internal") == "internal") + { + _config->Set("APT::Solver", "3.0"); + _error->Notice("Automatically enabled --solver 3.0 for --no-strict-pinning"); + } + // See if the help should be shown if (_config->FindB("help") == true || _config->FindB("version") == true || (CmdL.FileSize() > 0 && strcmp(CmdL.FileList[0], "help") == 0)) diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 9a2ed0b..4f71f18 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -20,6 +20,7 @@ #include <apt-pkg/prettyprinters.h> #include <apt-pkg/strutl.h> #include <apt-pkg/upgrade.h> +#include <apt-pkg/version.h> #include <algorithm> #include <cstdlib> @@ -214,16 +215,6 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo return false; } - APT::PackageVector PhasingPackages; - APT::PackageVector NotPhasingHeldBackPackages; - for (auto const &Pkg : HeldBackPackages) - { - if (Cache->PhasingApplied(Pkg)) - PhasingPackages.push_back(Pkg); - else - NotPhasingHeldBackPackages.push_back(Pkg); - } - // Show all the various warning indicators if (_config->FindI("APT::Output-Version") < 30) ShowDel(c1out,Cache); @@ -234,6 +225,16 @@ bool InstallPackages(CacheFile &Cache, APT::PackageVector &HeldBackPackages, boo ShowWeakDependencies(Cache); if (ShwKept == true) { + APT::PackageVector PhasingPackages; + APT::PackageVector NotPhasingHeldBackPackages; + for (auto const &Pkg : HeldBackPackages) + { + if (Cache->PhasingApplied(Pkg)) + PhasingPackages.push_back(Pkg); + else + NotPhasingHeldBackPackages.push_back(Pkg); + } + ShowPhasing(c1out, Cache, PhasingPackages); ShowKept(c1out, Cache, NotPhasingHeldBackPackages); if (not PhasingPackages.empty() && not NotPhasingHeldBackPackages.empty()) @@ -620,12 +621,14 @@ bool DoAutomaticRemove(CacheFile &Cache) for (APT::PackageSet::iterator Pkg = tooMuch.begin(); Pkg != tooMuch.end(); ++Pkg) { - APT::PackageSet too; - too.insert(*Pkg); - for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList(); - Prv.end() == false; ++Prv) - too.insert(Prv.ParentPkg()); - for (APT::PackageSet::const_iterator P = too.begin(); P != too.end(); ++P) + auto const PkgCand = Cache[Pkg].CandidateVerIter(Cache); + if (unlikely(PkgCand.end())) + continue; + std::vector<std::pair<pkgCache::PkgIterator, char const *>> too; + too.emplace_back(*Pkg, PkgCand.VerStr()); + for (pkgCache::PrvIterator Prv = PkgCand.ProvidesList(); not Prv.end(); ++Prv) + too.emplace_back(Prv.ParentPkg(), Prv.ProvideVersion()); + for (auto const &[P, PVerStr] : too) { for (pkgCache::DepIterator R = P.RevDependsList(); R.end() == false; ++R) @@ -650,6 +653,11 @@ bool DoAutomaticRemove(CacheFile &Cache) } else // ignore dependency from a non-candidate version continue; + if (R->Version != 0) + { + if (not Cache->VS().CheckDep(PVerStr, R->CompareOp, R.TargetVer())) + continue; + } if (Debug == true) std::clog << "Save " << APT::PrettyPkg(Cache, Pkg) << " as another installed package depends on it: " << APT::PrettyPkg(Cache, RP) << std::endl; Cache->MarkInstall(Pkg, false, 0, false); diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 09d03d3..2e81095 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -350,7 +350,7 @@ struct columnInfo void ShowWithColumns(ostream &out, vector<string> const &List, size_t Indent, size_t ScreenWidth) { constexpr size_t MinColumnWidth = 2; - constexpr size_t ColumnSpace = 1; + constexpr size_t ColumnSpace = 2; size_t const ListSize = List.size(); size_t const MaxScreenCols = (ScreenWidth - Indent) / @@ -740,7 +740,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache) } return ShowList(out,_("WARNING: The following essential packages will be removed.\n" "This should NOT be done unless you know exactly what you are doing!"), - pkglist, &AlwaysTrue, withdue, &EmptyString); + pkglist, &AlwaysTrue, withdue, &EmptyString, "action::remove"); } /*}}}*/ // Stats - Show some statistics /*{{{*/ diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index 4ae0430..ceef670 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -446,14 +446,22 @@ bool ShowSrcPackage(CommandLine &CmdL) /*{{{*/ std::set<std::string> seen; for (const char **I = CmdL.FileList + 1; *I != 0; I++) { + const char *pkgname = *I; SrcRecs.Restart(); pkgSrcRecords::Parser *Parse; bool found_this = false; - while ((Parse = SrcRecs.Find(*I,false)) != 0) { + bool only_source = _config->FindB("APT::Cache::Only-Source", false); + if (APT::String::Startswith(pkgname, "src:")) + { + only_source = true; + pkgname += 4; + } + while ((Parse = SrcRecs.Find(pkgname, false)) != 0) + { // SrcRecs.Find() will find both binary and source names - if (_config->FindB("APT::Cache::Only-Source", false) == true) - if (Parse->Package() != *I) + if (only_source) + if (Parse->Package() != pkgname) continue; std::string sha1str = Sha1FromString(Parse->AsStr()); if (std::find(seen.begin(), seen.end(), sha1str) == seen.end()) diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index 9b9409c..6280b9f 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -77,7 +77,14 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, std::string ArchTag = ""; std::string RelTag = _config->Find("APT::Default-Release"); std::string TmpSrc = Name; + bool MatchSrcOnly = _config->FindB("APT::Get::Only-Source"); + // Check if we should look by source package + if (APT::String::Startswith(TmpSrc, "src:")) + { + MatchSrcOnly = true; + TmpSrc = TmpSrc.substr(4); + } // extract release size_t found = TmpSrc.find_last_of("/"); if (found != std::string::npos) @@ -103,7 +110,6 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, /* Lookup the version of the package we would install if we were to install a version and determine the source package name, then look in the archive for a source package of the same name. */ - bool MatchSrcOnly = _config->FindB("APT::Get::Only-Source"); pkgCache::PkgIterator Pkg; if (ArchTag != "") Pkg = Cache.GetPkgCache()->FindPkg(TmpSrc, ArchTag); |