summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2022-07-08 14:07:45 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2022-07-24 15:27:18 +0200
commitc4bab3c93567fd5a17652e453d4a65d7c83eb4fb (patch)
tree0d5868363c627595c3e1e7874710af924a4754ab
parent119a8d0ed19a4e946591b9aef7d662e14ca7ece5 (diff)
Avoid recursion by looping of other binaries twice
First mark them for upgrade without autoInst, so we don't call their "mark other binaries loop"; then call them again with it. Without this change, each binary package would upgrade the next one in the list, recursively.
-rw-r--r--apt-pkg/depcache.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index f1ad7729e..6aa1fe946 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1496,6 +1496,7 @@ static bool MarkInstall_UpgradeOrRemoveConflicts(pkgDepCache &Cache, bool const
/*}}}*/
static bool MarkInstall_UpgradeOtherBinaries(pkgDepCache &Cache, bool const DebugAutoInstall, unsigned long Depth, bool const ForceImportantDeps, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver) /*{{{*/
{
+ APT::PackageSet toUpgrade;
auto SrcGrp = Cache.FindGrp(Ver.SourcePkgName());
for (auto OtherBinary = SrcGrp.VersionsInSource(); not OtherBinary.end(); OtherBinary = OtherBinary.NextInSource())
{
@@ -1514,8 +1515,13 @@ static bool MarkInstall_UpgradeOtherBinaries(pkgDepCache &Cache, bool const Debu
continue;
if (DebugAutoInstall)
std::clog << OutputInDepth(Depth) << "Upgrading " << APT::PrettyPkg(&Cache, OtherPkg) << " due to " << Pkg.FullName() << '\n';
- Cache.MarkInstall(OtherPkg, true, Depth + 1, false, ForceImportantDeps);
+
+ toUpgrade.insert(OtherPkg);
}
+ for (auto &OtherPkg : toUpgrade)
+ Cache.MarkInstall(OtherPkg, false, Depth + 1, false, ForceImportantDeps);
+ for (auto &OtherPkg : toUpgrade)
+ Cache.MarkInstall(OtherPkg, true, Depth + 1, false, ForceImportantDeps);
return true;
}
/*}}}*/