From b41929c0139d0658046fb4e4088a8de167705a99 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 6 Jul 2011 12:46:29 +0200 Subject: * cmdline/apt-get.cc: - restore all important dependencies for garbage packages (LP: #806274) --- cmdline/apt-get.cc | 6 +- debian/changelog | 4 +- .../test-ubuntu-bug-806274-install-suggests | 81 ++++++++++++++++++++++ 3 files changed, 87 insertions(+), 4 deletions(-) create mode 100755 test/integration/test-ubuntu-bug-806274-install-suggests diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 845c92026..3292ae745 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1697,7 +1697,7 @@ bool DoAutomaticRemove(CacheFile &Cache) // we could have removed a new dependency of a garbage package, // so check if a reverse depends is broken and if so install it again. - if (tooMuch.empty() == false && Cache->BrokenCount() != 0) + if (tooMuch.empty() == false && (Cache->BrokenCount() != 0 || Cache->PolicyBrokenCount() != 0)) { bool Changed; do { @@ -1708,8 +1708,8 @@ bool DoAutomaticRemove(CacheFile &Cache) for (pkgCache::DepIterator R = P.RevDependsList(); R.end() == false; ++R) { - if (R->Type != pkgCache::Dep::Depends && - R->Type != pkgCache::Dep::PreDepends) + if (R.IsNegative() == true || + Cache->IsImportantDep(R) == false) continue; pkgCache::PkgIterator N = R.ParentPkg(); if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false)) diff --git a/debian/changelog b/debian/changelog index af7e792db..4b70eec55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,8 +8,10 @@ apt (0.8.15.2) unstable; urgency=low - document available [options] for sources.list entries (Closes: 632441) * doc/apt.conf.5.xml: - document APT::Architectures list (Closes: #612102) + * cmdline/apt-get.cc: + - restore all important dependencies for garbage packages (LP: #806274) - -- David Kalnischkies Tue, 05 Jul 2011 15:31:55 +0200 + -- David Kalnischkies Wed, 06 Jul 2011 12:44:58 +0200 apt (0.8.15.1) unstable; urgency=low diff --git a/test/integration/test-ubuntu-bug-806274-install-suggests b/test/integration/test-ubuntu-bug-806274-install-suggests new file mode 100755 index 000000000..fb72f0999 --- /dev/null +++ b/test/integration/test-ubuntu-bug-806274-install-suggests @@ -0,0 +1,81 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'apt' 'i386' '0.8.15' 'Depends: foo +Recommends: bar +Suggests: baz' +insertpackage 'unstable' 'foo' 'i386' '1.0' +insertpackage 'unstable' 'bar' 'i386' '1.0' +insertpackage 'unstable' 'baz' 'i386' '1.0' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar foo +Suggested packages: + baz +The following NEW packages will be installed: + apt bar foo +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [i386]) +Conf foo (1.0 unstable [i386]) +Inst apt (0.8.15 unstable [i386]) +Conf apt (0.8.15 unstable [i386]) +Inst bar (1.0 unstable [i386]) +Conf bar (1.0 unstable [i386])' aptget install apt -s --install-recommends --no-install-suggests + + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar baz foo +The following NEW packages will be installed: + apt bar baz foo +0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [i386]) +Conf foo (1.0 unstable [i386]) +Inst apt (0.8.15 unstable [i386]) +Conf apt (0.8.15 unstable [i386]) +Inst bar (1.0 unstable [i386]) +Inst baz (1.0 unstable [i386]) +Conf bar (1.0 unstable [i386]) +Conf baz (1.0 unstable [i386])' aptget install apt -s --install-recommends --install-suggests + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +Suggested packages: + baz +Recommended packages: + bar +The following NEW packages will be installed: + apt foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [i386]) +Conf foo (1.0 unstable [i386]) +Inst apt (0.8.15 unstable [i386]) +Conf apt (0.8.15 unstable [i386])' aptget install apt -s --no-install-recommends --no-install-suggests + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + baz foo +Recommended packages: + bar +The following NEW packages will be installed: + apt baz foo +0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [i386]) +Conf foo (1.0 unstable [i386]) +Inst apt (0.8.15 unstable [i386]) +Conf apt (0.8.15 unstable [i386]) +Inst baz (1.0 unstable [i386]) +Conf baz (1.0 unstable [i386])' aptget install apt -s --no-install-recommends --install-suggests -- cgit v1.2.3