From bea417121247afe00cdd4ba13215544d5b5d3262 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 7 Feb 2011 13:08:43 +0100 Subject: [PATCH] always do removes first and set not installed remove packages on hold to prevent temporary installation later (Closes: #549968) --- cmdline/apt-get.cc | 13 ++++------ debian/changelog | 4 ++- ...ug-549968-install-depends-of-not-installed | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) create mode 100755 test/integration/test-bug-549968-install-depends-of-not-installed 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); diff --git a/debian/changelog b/debian/changelog index ecaca2a9b..3adb9d76f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ apt (0.8.11) UNRELEASED; urgency=low so installing packages from experimental or backports is easier - really do not show packages in the extra section if they were requested on the commandline, e.g. with a modifier (Closes: #184730) + - always do removes first and set not installed remove packages + on hold to prevent temporary installation later (Closes: #549968) * debian/control: - add Vcs-Browser now that loggerhead works again (Closes: #511168) - depend on debhelper 7 to raise compat level @@ -99,7 +101,7 @@ apt (0.8.11) UNRELEASED; urgency=low will actually test uncompressed indexes regardless of the internal default value of Acquire::GzipIndexes. - -- David Kalnischkies Mon, 07 Feb 2011 11:42:41 +0100 + -- David Kalnischkies Mon, 07 Feb 2011 13:06:50 +0100 apt (0.8.10.3) unstable; urgency=low diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed new file mode 100755 index 000000000..864dd340a --- /dev/null +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'libc6' 'all' '1.0' +insertpackage 'unstable' 'coolstuff' 'all' '1.0' 'Recommends: extracoolstuff' +insertpackage 'unstable' 'extracoolstuff' 'all' '1.0' 'Depends: libc6' + +setupaptarchive + +# We check the Markers here as the autoremove nuker will also +# prevent it, but to late - its better to fail earlier +testequal 'Reading package lists... +Building dependency tree... + MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 + Hold prevents MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) FU=0 +Package extracoolstuff is not installed, so not removed +The following NEW packages will be installed: + coolstuff +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst coolstuff (1.0 unstable [all]) +Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s -- 2.45.2