summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/algorithms.cc41
-rwxr-xr-xtest/integration/test-bug-960705-propagate-protected-to-satisfied-conflict17
2 files changed, 23 insertions, 35 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index ea6d4c39a..c12924c5f 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -841,7 +841,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
pkgCache::DepIterator End;
size_t OldSize = 0;
- KillList.resize(0);
+ KillList.clear();
enum {OrRemove,OrKeep} OrOp = OrRemove;
for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList();
@@ -1099,33 +1099,38 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
// Apply the kill list now
if (Cache[I].InstallVer != 0)
{
- for (auto J = KillList.begin(); J != KillList.end(); J++)
+ for (auto const &J : KillList)
{
- Change = true;
- if ((Cache[J->Dep] & pkgDepCache::DepGNow) == 0)
+ bool foundSomething = false;
+ if ((Cache[J.Dep] & pkgDepCache::DepGNow) == 0)
{
- if (J->Dep.IsNegative() == true)
+ if (J.Dep.IsNegative() && Cache.MarkDelete(J.Pkg, false, 0, false))
{
- if (Debug == true)
- clog << " Fixing " << I.FullName(false) << " via remove of " << J->Pkg.FullName(false) << endl;
- Cache.MarkDelete(J->Pkg, false, 0, false);
+ if (Debug)
+ std::clog << " Fixing " << I.FullName(false) << " via remove of " << J.Pkg.FullName(false) << '\n';
+ foundSomething = true;
}
}
- else
+ else if (Cache.MarkKeep(J.Pkg, false, false))
{
- if (Debug == true)
- clog << " Fixing " << I.FullName(false) << " via keep of " << J->Pkg.FullName(false) << endl;
- Cache.MarkKeep(J->Pkg, false, false);
+ if (Debug)
+ std::clog << " Fixing " << I.FullName(false) << " via keep of " << J.Pkg.FullName(false) << '\n';
+ foundSomething = true;
}
- if (Counter > 1)
+ if (not foundSomething || Counter > 1)
{
- if (Scores[I->ID] > Scores[J->Pkg->ID])
- Scores[J->Pkg->ID] = Scores[I->ID];
- }
- }
+ if (Scores[I->ID] > Scores[J.Pkg->ID])
+ {
+ Scores[J.Pkg->ID] = Scores[I->ID];
+ Change = true;
+ }
+ }
+ if (foundSomething)
+ Change = true;
+ }
}
- }
+ }
}
if (Debug == true)
diff --git a/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict b/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict
index 480b6753e..e793193c3 100755
--- a/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict
+++ b/test/integration/test-bug-960705-propagate-protected-to-satisfied-conflict
@@ -28,26 +28,9 @@ Broken init:amd64 PreDepends on systemd-sysv:amd64 < 1 @ii pmR >
Added systemd-sysv:amd64 to the remove list
Broken init:amd64 PreDepends on sysvinit-core:amd64 < none @un pH >
Considering sysvinit-core:amd64 0 as a solution to init:amd64 5100
- Fixing init:amd64 via keep of systemd-sysv:amd64
Ignore MarkKeep of systemd-sysv:amd64 < 1 @ii pmR > as its mode (Delete) is protected
Investigating (1) init:amd64 < 1 @ii mK Ib >
Broken init:amd64 PreDepends on systemd-sysv:amd64 < 1 @ii pmR >
- Considering systemd-sysv:amd64 0 as a solution to init:amd64 5100
- Added systemd-sysv:amd64 to the remove list
-Broken init:amd64 PreDepends on sysvinit-core:amd64 < none @un pH >
- Considering sysvinit-core:amd64 0 as a solution to init:amd64 5100
- Fixing init:amd64 via keep of systemd-sysv:amd64
- Ignore MarkKeep of systemd-sysv:amd64 < 1 @ii pmR > as its mode (Delete) is protected
-Investigating (2) init:amd64 < 1 @ii mK Ib >
-Broken init:amd64 PreDepends on systemd-sysv:amd64 < 1 @ii pmR >
- Considering systemd-sysv:amd64 0 as a solution to init:amd64 5100
- Added systemd-sysv:amd64 to the remove list
-Broken init:amd64 PreDepends on sysvinit-core:amd64 < none @un pH >
- Considering sysvinit-core:amd64 0 as a solution to init:amd64 5100
- Fixing init:amd64 via keep of systemd-sysv:amd64
- Ignore MarkKeep of systemd-sysv:amd64 < 1 @ii pmR > as its mode (Delete) is protected
-Investigating (3) init:amd64 < 1 @ii mK Ib >
-Broken init:amd64 PreDepends on systemd-sysv:amd64 < 1 @ii pmR >
Considering systemd-sysv:amd64 5100 as a solution to init:amd64 5100
Broken init:amd64 PreDepends on sysvinit-core:amd64 < none @un pH >
Considering sysvinit-core:amd64 0 as a solution to init:amd64 5100