summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-11 14:09:18 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-11 14:09:18 +0200
commitdf77d8a5fb5340b23fec5363f9a52704e940b048 (patch)
tree1bba838121aa99db9213a939e708464c9a65f38d
parentf1bdfe81560b110dbf1ee6f5f7fa8c98423ef345 (diff)
if critical or-group can't be satisfied, exit directly.
-rw-r--r--apt-pkg/cacheiterators.h1
-rw-r--r--apt-pkg/depcache.cc14
-rw-r--r--apt-pkg/pkgcache.cc11
-rw-r--r--debian/changelog3
-rwxr-xr-xtest/integration/test-handling-broken-orgroups108
5 files changed, 134 insertions, 3 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 8f9f811da..0c9813c6d 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -287,6 +287,7 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);};
inline bool Reverse() const {return Type == DepRev;};
bool IsCritical() const;
+ bool IsNegative() const;
void GlobOr(DepIterator &Start,DepIterator &End);
Version **AllTargets() const;
bool SmartTargetPkg(PkgIterator &Result) const;
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 474313a0d..34ead1726 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1145,8 +1145,18 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
/* If we are in an or group locate the first or that can
succeed. We have already cached this.. */
- for (; Ors > 1 && (DepState[Start->ID] & DepCVer) != DepCVer; Ors--)
- Start++;
+ for (; Ors > 1 && (DepState[Start->ID] & DepCVer) != DepCVer; --Ors)
+ ++Start;
+ if (Ors == 1 && (DepState[Start->ID] &DepCVer) != DepCVer && Start.IsNegative() == false)
+ {
+ if(DebugAutoInstall == true)
+ std::clog << OutputInDepth(Depth) << Start << " can't be satisfied!" << std::endl;
+ if (Start.IsCritical() == false)
+ continue;
+ // if the dependency was critical, we can't install it, so remove it again
+ MarkDelete(Pkg,false,Depth + 1, false);
+ return;
+ }
/* This bit is for processing the possibilty of an install/upgrade
fixing the problem */
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 862d05348..6c12b4581 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -530,6 +530,17 @@ bool pkgCache::DepIterator::IsCritical() const
return false;
}
/*}}}*/
+// DepIterator::IsNegative - Returns true if the dep is a negative one /*{{{*/
+// ---------------------------------------------------------------------
+/* Some dependencies are positive like Depends and Recommends, others
+ are negative like Conflicts which can and should be handled differently */
+bool pkgCache::DepIterator::IsNegative() const
+{
+ return S->Type == Dep::DpkgBreaks ||
+ S->Type == Dep::Conflicts ||
+ S->Type == Dep::Obsoletes;
+}
+ /*}}}*/
// DepIterator::SmartTargetPkg - Resolve dep target pointers w/provides /*{{{*/
// ---------------------------------------------------------------------
/* This intellegently looks at dep target packages and tries to figure
diff --git a/debian/changelog b/debian/changelog
index 9f4edc0ee..2c578d258 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ apt (0.8.14.2) UNRELEASED; urgency=low
* apt-pkg/depcache.cc:
- really include 'rc' packages in the delete count by fixing a
typo which exists since 1999 in the sourceā€¦ (LP: #761175)
+ - if critical or-group can't be satisfied, exit directly.
* apt-pkg/acquire-method.cc:
- write directly to stdout instead of creating the message in
memory first before writing to avoid hitting limits
@@ -54,7 +55,7 @@ apt (0.8.14.2) UNRELEASED; urgency=low
- dequote URL taken from Location in redirects as we will otherwise
quote an already quoted string in the request later (Closes: #602412)
- -- David Kalnischkies <kalnischkies@gmail.com> Tue, 10 May 2011 18:51:15 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Wed, 11 May 2011 13:58:40 +0200
apt (0.8.14.1) unstable; urgency=low
diff --git a/test/integration/test-handling-broken-orgroups b/test/integration/test-handling-broken-orgroups
new file mode 100755
index 000000000..d88ad0000
--- /dev/null
+++ b/test/integration/test-handling-broken-orgroups
@@ -0,0 +1,108 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable' 'cool' 'all' '1.0-1'
+insertpackage 'unstable' 'stuff' 'all' '1.0-1'
+insertpackage 'unstable' 'coolstuff' 'all' '1.0-1' 'Depends: cool | stuff'
+insertpackage 'unstable' 'coolstuff2' 'all' '1.0-1' 'Depends: cool2 | stuff'
+insertpackage 'unstable' 'coolstuff-broken' 'all' '1.0-1' 'Depends: cool2 | stuff2'
+insertpackage 'unstable' 'coolstuff-brokenrec' 'all' '1.0-1' 'Recommends: cool2 | stuff2'
+insertpackage 'unstable' 'coolstuff-conflict' 'all' '1.0-1' 'Depends: cool | stuff
+Conflicts: cool'
+insertpackage 'unstable' 'coolstuff-provided' 'all' '1.0-1' 'Depends: cool2 | stuff-abi'
+insertpackage 'unstable' 'extrastuff' 'all' '1.0-1' 'Provides: stuff-abi'
+
+insertpackage 'unstable' 'coolstuff-provided-broken' 'all' '1.0-1' 'Depends: cool2 | stuff-abi-2'
+insertpackage 'unstable' 'extrastuff' 'all' '1.0-1' 'Depends: stuff2
+Provides: stuff-abi-2'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ cool
+The following NEW packages will be installed:
+ cool coolstuff
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst cool (1.0-1 unstable [all])
+Inst coolstuff (1.0-1 unstable [all])
+Conf cool (1.0-1 unstable [all])
+Conf coolstuff (1.0-1 unstable [all])' aptget install coolstuff -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ stuff
+The following NEW packages will be installed:
+ coolstuff2 stuff
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst stuff (1.0-1 unstable [all])
+Inst coolstuff2 (1.0-1 unstable [all])
+Conf stuff (1.0-1 unstable [all])
+Conf coolstuff2 (1.0-1 unstable [all])' aptget install coolstuff2 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ coolstuff-broken : Depends: cool2 but it is not installable or
+ stuff2 but it is not installable
+E: Broken packages' aptget install coolstuff-broken -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+Recommended packages:
+ cool2 stuff2
+The following NEW packages will be installed:
+ coolstuff-brokenrec
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst coolstuff-brokenrec (1.0-1 unstable [all])
+Conf coolstuff-brokenrec (1.0-1 unstable [all])' aptget install coolstuff-brokenrec -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ stuff
+The following NEW packages will be installed:
+ coolstuff-conflict stuff
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst stuff (1.0-1 unstable [all])
+Inst coolstuff-conflict (1.0-1 unstable [all])
+Conf stuff (1.0-1 unstable [all])
+Conf coolstuff-conflict (1.0-1 unstable [all])' aptget install coolstuff-conflict -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ extrastuff
+The following NEW packages will be installed:
+ coolstuff-provided extrastuff
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst extrastuff (1.0-1 unstable [all])
+Inst coolstuff-provided (1.0-1 unstable [all])
+Conf extrastuff (1.0-1 unstable [all])
+Conf coolstuff-provided (1.0-1 unstable [all])' aptget install coolstuff-provided -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ coolstuff-provided-broken : Depends: cool2 but it is not installable or
+ stuff-abi-2
+E: Broken packages' aptget install coolstuff-provided-broken -s