summaryrefslogtreecommitdiff
path: root/cmdline/apt-get.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r--cmdline/apt-get.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index d0330b08e..96e974acb 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -629,6 +629,8 @@ void CacheFile::Sort()
and verifies that the system is OK. */
bool CacheFile::CheckDeps(bool AllowBroken)
{
+ bool FixBroken = _config->FindB("APT::Get::Fix-Broken",false);
+
if (_error->PendingError() == true)
return false;
@@ -640,12 +642,24 @@ bool CacheFile::CheckDeps(bool AllowBroken)
if (pkgApplyStatus(*DCache) == false)
return false;
+ if (_config->FindB("APT::Get::Fix-Policy-Broken",false) == true)
+ {
+ FixBroken = true;
+ if ((DCache->PolicyBrokenCount() > 0))
+ {
+ // upgrade all policy-broken packages with ForceImportantDeps=True
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); I++)
+ if ((*DCache)[I].NowPolicyBroken() == true)
+ DCache->MarkInstall(I,true,0,true);
+ }
+ }
+
// Nothing is broken
if (DCache->BrokenCount() == 0 || AllowBroken == true)
return true;
// Attempt to fix broken things
- if (_config->FindB("APT::Get::Fix-Broken",false) == true)
+ if (FixBroken == true)
{
c1out << _("Correcting dependencies...") << flush;
if (pkgFixBroken(*DCache) == false || DCache->BrokenCount() != 0)
@@ -2618,6 +2632,7 @@ int main(int argc,const char *argv[])
{0,"auto-remove","APT::Get::AutomaticRemove",0},
{0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0},
{0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean},
+ {0,"fix-policy","APT::Get::Fix-Policy-Broken",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};