summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-07-28 21:53:17 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-07-28 21:53:17 +0200
commit966640d8fd2feac29909a22415955b3ce5779dcd (patch)
tree790b2e64cf076710f7fc26122a1c47c826226bbd
parent8f8169ac464249c8a2b35b13f9c5278d4c9e5a46 (diff)
* apt-pkg/orderlist.cc:
- try to install another or-group member in DepRemove before breaking the or group (Closes: #590438)
-rw-r--r--apt-pkg/orderlist.cc77
-rw-r--r--debian/changelog5
-rw-r--r--test/integration/Packages-bug-590438-broken-provides-thanks-to-remove-order35
-rw-r--r--test/integration/status-bug-590438-broken-provides-thanks-to-remove-order97
-rwxr-xr-xtest/integration/test-bug-590438-broken-provides-thanks-to-remove-order59
5 files changed, 271 insertions, 2 deletions
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index 55f9cb9cc..cb55147c3 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -886,13 +886,16 @@ bool pkgOrderList::DepRemove(DepIterator D)
continue;
/* We wish to see if the dep on the parent package is okay
- in the removed (install) state of the target pkg. */
+ in the removed (install) state of the target pkg. */
+ bool tryFixDeps = false;
if (CheckDep(D) == true)
{
// We want to catch loops with the code below.
if (IsFlag(D.ParentPkg(),AddPending) == false)
continue;
}
+ else
+ tryFixDeps = true;
// This is the loop detection
if (IsFlag(D.ParentPkg(),Added) == true ||
@@ -903,6 +906,78 @@ bool pkgOrderList::DepRemove(DepIterator D)
continue;
}
+ if (tryFixDeps == true)
+ {
+ for (pkgCache::DepIterator F = D.ParentPkg().CurrentVer().DependsList();
+ F.end() == false; ++F)
+ {
+ if (F->Type != pkgCache::Dep::Depends && F->Type != pkgCache::Dep::PreDepends)
+ continue;
+ // Check the Providers
+ if (F.TargetPkg()->ProvidesList != 0)
+ {
+ pkgCache::PrvIterator Prov = F.TargetPkg().ProvidesList();
+ for (; Prov.end() == false; ++Prov)
+ {
+ pkgCache::PkgIterator const P = Prov.OwnerPkg();
+ if (IsFlag(P, InList) == true &&
+ IsFlag(P, AddPending) == true &&
+ IsFlag(P, Added) == false &&
+ Cache[P].InstallVer == 0)
+ break;
+ }
+ if (Prov.end() == false)
+ for (pkgCache::PrvIterator Prv = F.TargetPkg().ProvidesList();
+ Prv.end() == false; ++Prv)
+ {
+ pkgCache::PkgIterator const P = Prv.OwnerPkg();
+ if (IsFlag(P, InList) == true &&
+ IsFlag(P, AddPending) == false &&
+ Cache[P].InstallVer != 0 &&
+ VisitNode(P) == true)
+ {
+ tryFixDeps = false;
+ break;
+ }
+ }
+ if (tryFixDeps == false)
+ break;
+ }
+
+ // Check for Or groups
+ if ((F->CompareOp & pkgCache::Dep::Or) != pkgCache::Dep::Or)
+ continue;
+ // Lets see if the package is part of the Or group
+ pkgCache::DepIterator S = F;
+ for (; S.end() == false; ++S)
+ {
+ if (S.TargetPkg() == D.TargetPkg())
+ break;
+ if ((S->CompareOp & pkgCache::Dep::Or) != pkgCache::Dep::Or ||
+ CheckDep(S)) // Or group is satisfied by another package
+ for (;S.end() == false; ++S);
+ }
+ if (S.end() == true)
+ continue;
+ // skip to the end of the or group
+ for (;S.end() == false && (S->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or; ++S);
+ ++S;
+ // The soon to be removed is part of the Or group
+ // start again in the or group and find something which will serve as replacement
+ for (; F.end() == false && F != S; ++F)
+ {
+ if (F.TargetPkg() == D.TargetPkg() ||
+ IsFlag(F.TargetPkg(), InList) == false ||
+ VisitNode(F.TargetPkg()) == false)
+ continue;
+ tryFixDeps = false;
+ break;
+ }
+ if (tryFixDeps == false)
+ break;
+ }
+ }
+
// Skip over missing files
if (IsMissing(D.ParentPkg()) == true)
continue;
diff --git a/debian/changelog b/debian/changelog
index 345a46579..86b154dab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,8 +14,11 @@ apt (0.7.26~exp11) experimental; urgency=low
- prefer non-virtual packages in FindPreferredPkg (Closes: #590041)
* test/integration/*:
- add with bug#590041 testcase a small test "framework"
+ * apt-pkg/orderlist.cc:
+ - try to install another or-group member in DepRemove before
+ breaking the or group (Closes: #590438)
- -- David Kalnischkies <kalnischkies@gmail.com> Mon, 26 Jul 2010 12:40:44 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Wed, 28 Jul 2010 21:41:35 +0200
apt (0.7.26~exp10) experimental; urgency=low
diff --git a/test/integration/Packages-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/Packages-bug-590438-broken-provides-thanks-to-remove-order
new file mode 100644
index 000000000..16bf008f6
--- /dev/null
+++ b/test/integration/Packages-bug-590438-broken-provides-thanks-to-remove-order
@@ -0,0 +1,35 @@
+Package: gawk
+Priority: optional
+Section: interpreters
+Installed-Size: 2084
+Maintainer: Arthur Loiret <aloiret@debian.org>
+Architecture: i386
+Version: 1:3.1.7.dfsg-5
+Provides: awk
+Pre-Depends: libc6 (>= 2.3)
+Filename: pool/main/g/gawk/gawk_3.1.7.dfsg-5_i386.deb
+Size: 766008
+MD5sum: 6459a02cfc1b9eafb3c0415e4ff4e252
+SHA1: ac033488dae4b7e8167d610e490319c047edf7e4
+SHA256: a2337dfe1cc82aeae46f2c722e5cc7be9ecefdea4aaf13f540cfe70bd8b1d627
+Description-de: GNU awk, eine Mustererkennungs- und Verarbeitungssprache
+Homepage: http://www.gnu.org/software/gawk/
+Tag: devel::interpreter, implemented-in::c, interface::commandline, role::program, scope::utility, suite::gnu, use::filtering, use::scanning, works-with::text
+
+Package: aawk
+Priority: optional
+Section: interpreters
+Installed-Size: 2084
+Maintainer: Arthur Loiret <aloiret@debian.org>
+Architecture: i386
+Version: 1:3.1.7.dfsg-5
+Provides: awk
+Pre-Depends: libc6 (>= 2.3)
+Filename: pool/main/a/aawk/aawk_3.1.7.dfsg-5_i386.deb
+Size: 766008
+MD5sum: 6459a02cfc1b9eafb3c0415e4ff4e252
+SHA1: ac033488dae4b7e8167d610e490319c047edf7e4
+SHA256: a2337dfe1cc82aeae46f2c722e5cc7be9ecefdea4aaf13f540cfe70bd8b1d627
+Description-de: GNU awk, eine Mustererkennungs- und Verarbeitungssprache
+Homepage: http://www.gnu.org/software/gawk/
+Tag: devel::interpreter, implemented-in::c, interface::commandline, role::program, scope::utility, suite::gnu, use::filtering, use::scanning, works-with::text
diff --git a/test/integration/status-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/status-bug-590438-broken-provides-thanks-to-remove-order
new file mode 100644
index 000000000..c2c03c0e4
--- /dev/null
+++ b/test/integration/status-bug-590438-broken-provides-thanks-to-remove-order
@@ -0,0 +1,97 @@
+Package: libc-bin
+Status: install ok installed
+Priority: required
+Section: libs
+Installed-Size: 1516
+Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
+Architecture: i386
+Source: eglibc
+Version: 2.11.2-2
+Replaces: libc0.1, libc0.3, libc6, libc6.1
+Breaks: libc0.1 (<< 2.10), libc0.3 (<< 2.10), libc6 (<< 2.10), libc6.1 (<< 2.10)
+Filename: pool/main/e/eglibc/libc-bin_2.11.2-2_i386.deb
+Size: 703542
+MD5sum: f554ec34c092bb8e52e3d917bec7b46c
+SHA1: 4d5ba53b50937b1d50e3234e45335de5ea97b84b
+SHA256: 4f1e6430a730321209bb6b9cf89ba8a72c95f5c93f3e263a982251b3cc8beb14
+Description-de: Die »Embedded GNU C Library«: Binärdateien
+Homepage: http://www.eglibc.org
+Tag: devel::lang:c, devel::packaging, implemented-in::c, interface::commandline, role::program, scope::utility, special::auto-inst-parts, suite::gnu, works-with::text, works-with::unicode
+
+Package: libc6
+Status: install ok installed
+Priority: required
+Section: libs
+Installed-Size: 9340
+Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
+Architecture: i386
+Source: eglibc
+Version: 2.11.2-2
+Provides: glibc-2.11-1
+Depends: libc-bin (= 2.11.2-2), libgcc1
+Recommends: libc6-i686
+Suggests: glibc-doc, debconf | debconf-2.0, locales
+Conflicts: tzdata (<< 2007k-1), tzdata-etch
+Breaks: locales (<< 2.11), locales-all (<< 2.11), nscd (<< 2.11)
+Filename: pool/main/e/eglibc/libc6_2.11.2-2_i386.deb
+Size: 3877166
+MD5sum: 3d8fe972a359ad362ac1957c2687e5c2
+SHA1: cd901f3265254e40ad198b935877f546eeaa8403
+SHA256: e1bc3da1e11f9b742d05f927362e2079482db4186ff45af9f937d284e112e7e5
+Description-de: Die »Embedded GNU C Library«: Laufzeitbibliotheken
+Homepage: http://www.eglibc.org
+Tag: devel::lang:c, devel::library, implemented-in::c, protocol::ipv6, role::shared-lib, suite::gnu
+
+Package: mawk
+Status: install ok installed
+Priority: required
+Section: utils
+Installed-Size: 228
+Maintainer: Steve Langasek <vorlon@debian.org>
+Architecture: i386
+Version: 1.3.3-15
+Provides: awk
+Pre-Depends: libc6 (>= 2.1)
+Filename: pool/main/m/mawk/mawk_1.3.3-15_i386.deb
+Size: 81430
+MD5sum: e0f9e9903a862a52b5f107d560c4d8e0
+SHA1: cca3b3ea3a57b9c3c136fb538a4fb06a99d1a33e
+SHA256: 7449b10ffb6a8636a249ad6866188cad0040a6a446fb4a3a71d81fd136297ee6
+Description-de: Eine Muster- und Textverarbeitungssprache
+Tag: devel::interpreter, implemented-in::c, interface::commandline, role::program, scope::utility, use::filtering, use::scanning, works-with::text
+
+Package: gcc-4.5-base
+Status: install ok installed
+Priority: required
+Section: libs
+Installed-Size: 172
+Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
+Architecture: i386
+Source: gcc-4.5
+Version: 4.5.0-8
+Filename: pool/main/g/gcc-4.5/gcc-4.5-base_4.5.0-8_i386.deb
+Size: 117894
+MD5sum: f5850c42681fcfee3429a1b43da68433
+SHA1: 0548343feba69c4c01d5dbf147393d8dc27605ac
+SHA256: 04b60f5fe24b7397e3be233051615ff9addb66d4581578f67fde76f5d7f69f7a
+Description: The GNU Compiler Collection (base package)
+Homepage: http://gcc.gnu.org/
+
+Package: libgcc1
+Status: install ok installed
+Priority: required
+Section: libs
+Installed-Size: 148
+Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
+Architecture: i386
+Source: gcc-4.5 (4.5.0-8)
+Version: 1:4.5.0-8
+Depends: gcc-4.5-base (= 4.5.0-8), libc6 (>= 2.2.4)
+Filename: pool/main/g/gcc-4.5/libgcc1_4.5.0-8_i386.deb
+Size: 52190
+MD5sum: beda956a1dcdeffed11072c2d0f3eb83
+SHA1: 7117ec43eec7982a030fcc9a12d4772de3fcdba0
+SHA256: 1d10bd532adce8683b475fcc60c22300f717ef19bf84dc5bf43b07e504f85dcb
+Description: GCC support library
+Homepage: http://gcc.gnu.org/
+
diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
new file mode 100755
index 000000000..bb10c4f73
--- /dev/null
+++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order
@@ -0,0 +1,59 @@
+#!/bin/sh
+set -e
+
+local TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+setupflataptarchive
+
+pkgbasefile="Package: base-files
+Status: install ok installed
+Essential: yes
+Priority: required
+Section: admin
+Installed-Size: 472
+Maintainer: Santiago Vila <sanvila@debian.org>
+Architecture: i386
+Version: 5.8
+Replaces: base, dpkg (<= 1.15.0), miscutils
+Provides: base
+Filename: pool/main/b/base-files/base-files_5.8_i386.deb
+Size: 73986
+MD5sum: 8489687ce10e656babd467c9ee389349
+Description-de: Verschiedene Dateien für das Basis-System von Debian"
+
+predependstest() {
+# rm rootdir/var/cache/apt/*.bin
+ cp $TESTDIR/$(echo "$(basename $0)" | sed 's/test-/status-/') rootdir/var/lib/dpkg/status
+ echo "$pkgbasefile
+Pre-Depends: $1
+" >> rootdir/var/lib/dpkg/status
+ testequal "Inst gawk (1:3.1.7.dfsg-5 localhost [i386])
+Conf gawk (1:3.1.7.dfsg-5 localhost [i386])
+Remv mawk [1.3.3-15]" aptget install gawk mawk- -sqq -o PreDepends=$(echo "$1" | sed 's/ //g')
+}
+
+predependstest "gawk | mawk"
+predependstest "mawk | gawk"
+
+predependstest "aawk | mawk | gawk"
+predependstest "aawk | gawk | mawk"
+
+predependstest "gawk | awk"
+predependstest "aawk | gawk | awk"
+
+predependstest "mawk | awk"
+
+predependstest "awk | gawk"
+predependstest "awk | gawk | aawk"
+
+predependstest "awk | mawk"
+
+predependstest "aawk | awk"
+predependstest "awk | aawk"
+
+predependstest "awk"
+
+# aptget install gawk mawk- -sqq -o Debug::pkgOrderList=1 #-o Debug::pkgPackageManager=1