From bea417121247afe00cdd4ba13215544d5b5d3262 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 13:08:43 +0100 Subject: always do removes first and set not installed remove packages on hold to prevent temporary installation later (Closes: #549968) --- cmdline/apt-get.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index e93d12c2b..a6377f9f1 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -895,7 +895,11 @@ struct TryToRemove { if ((Pkg->CurrentVer == 0 && PurgePkgs == false) || (PurgePkgs == true && Pkg->CurrentState == pkgCache::State::NotInstalled)) + { ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.FullName(true).c_str()); + // MarkInstall refuses to install packages on hold + Pkg->SelectedState = pkgCache::State::Hold; + } else Cache->GetDepCache()->MarkDelete(Pkg, PurgePkgs); } @@ -1790,14 +1794,7 @@ bool DoInstall(CommandLine &CmdL) return false; } - unsigned short order[] = { 0, 0, 0 }; - if (fallback == MOD_INSTALL) { - order[0] = MOD_INSTALL; - order[1] = MOD_REMOVE; - } else { - order[0] = MOD_REMOVE; - order[1] = MOD_INSTALL; - } + unsigned short const order[] = { MOD_REMOVE, MOD_INSTALL, 0 }; TryToInstall InstallAction(Cache, Fix, BrokenFix); TryToRemove RemoveAction(Cache, Fix); -- cgit v1.2.3