From 7c57fe64e3cc676bb145c187da03ed9aa1ea3d47 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:52:34 +0000 Subject: Made install try the users suggestiosn before bailing, ... Author: jgg Date: 1999-01-30 03:35:28 GMT Made install try the users suggestiosn before bailing, fixes #32395 --- cmdline/apt-get.cc | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 23b9c2237..1cc983e47 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.35 1999/01/30 02:12:53 jgg Exp $ +// $Id: apt-get.cc,v 1.36 1999/01/30 03:35:28 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -367,7 +367,7 @@ class CacheFile inline pkgDepCache *operator ->() {return Cache;}; inline pkgDepCache &operator *() {return *Cache;}; - bool Open(); + bool Open(bool AllowBroken = false); CacheFile() : File(0), Map(0), Cache(0) {}; ~CacheFile() { @@ -381,7 +381,7 @@ class CacheFile // --------------------------------------------------------------------- /* This routine generates the caches and then opens the dependency cache and verifies that the system is OK. */ -bool CacheFile::Open() +bool CacheFile::Open(bool AllowBroken) { if (_error->PendingError() == true) return false; @@ -427,7 +427,7 @@ bool CacheFile::Open() return false; // Nothing is broken - if (Cache->BrokenCount() == 0) + if (Cache->BrokenCount() == 0 || AllowBroken == true) return true; // Attempt to fix broken things @@ -692,9 +692,14 @@ bool DoUpgrade(CommandLine &CmdL) bool DoInstall(CommandLine &CmdL) { CacheFile Cache; - if (Cache.Open() == false) + if (Cache.Open(CmdL.FileSize() != 1) == false) return false; + // Enter the special broken fixing mode if the user specified arguments + bool BrokenFix = false; + if (Cache->BrokenCount() != 0) + BrokenFix = true; + unsigned int ExpectedInst = 0; unsigned int Packages = 0; pkgProblemResolver Fix(Cache); @@ -801,10 +806,21 @@ bool DoInstall(CommandLine &CmdL) ExpectedInst++; // Install it with autoinstalling enabled. - if (State.InstBroken() == true) + if (State.InstBroken() == true && BrokenFix == false) Cache->MarkInstall(Pkg,true); } + /* If we are in the Broken fixing mode we do not attempt to fix the + problems. This is if the user invoked install without -f and gave + packages */ + if (BrokenFix == true && Cache->BrokenCount() != 0) + { + c1out << "You might want to run `apt-get -f install' to correct these." << endl; + ShowBroken(c1out,Cache); + + return _error->Error("Unmet dependencies. Try using -f."); + } + // Call the scored problem resolver Fix.InstallProtect(); if (Fix.Resolve(true) == false) -- cgit v1.2.3-70-g09d2