summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-08-11 11:30:11 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-08-11 11:30:11 +0200
commit4ef9a929f1cb74f08f764b321cbea62cbfe025a2 (patch)
treeaadc8b8f299a3e1fe86965bfecd2301e1f0eb3c5 /cmdline
parent1b1c2224f5777956f345471b600ed56203c2d400 (diff)
* cmdline/apt-get.cc:
- added "--fix-policy" option to make it easy to fix any not-install recommends * apt-pkg/depcache.{cc,h} - MarkInstall() has a new "ForceImportantDeps" option (defaults to false) to fice the install of recommends even for already installed pkgs - a new PolicyBroken() function to see how much of the recommends are broken
Diffstat (limited to 'cmdline')
-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 7b7780a48..58976351c 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -628,6 +628,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;
@@ -639,12 +641,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)
@@ -2543,6 +2557,7 @@ int main(int argc,const char *argv[])
{0,"arch-only","APT::Get::Arch-Only",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}};