summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/depcache.cc7
-rwxr-xr-xtest/integration/test-release-candidate-switching24
2 files changed, 31 insertions, 0 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index c66ab2ded..3787106f7 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1559,6 +1559,13 @@ bool pkgDepCache::SetCandidateRelease(pkgCache::VerIterator TargetVer,
// virtual packages can't be a solution
if (P.end() == true || (P->ProvidesList == 0 && P->VersionList == 0))
continue;
+ // if its already installed, check if this one is good enough
+ pkgCache::VerIterator const Now = P.CurrentVer();
+ if (Now.end() == false && Start.IsSatisfied(Now))
+ {
+ itsFine = true;
+ break;
+ }
pkgCache::VerIterator const Cand = PkgState[P->ID].CandidateVerIter(*this);
// no versioned dependency - but is it installable?
if (Start.TargetVer() == 0 || Start.TargetVer()[0] == '\0')
diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching
index d7f1c90f7..945f68084 100755
--- a/test/integration/test-release-candidate-switching
+++ b/test/integration/test-release-candidate-switching
@@ -417,3 +417,27 @@ The following packages have unmet dependencies:
uninstallablepkg : Depends: libmtp8 (>= 10:0.20.1) but it is not going to be installed
Depends: amarok-utils (= 2.3.2-2+exp) but 2.3.1-1+sid is to be installed
E: Unable to correct problems, you have held broken packages." aptget install uninstallablepkg/experimental --trivial-only -V
+
+insertinstalledpackage 'libmtp8' 'i386' '1'
+insertinstalledpackage 'amarok' 'i386' '3' 'Depends: amarok-common (= 3), libmtp8 (>= 1)'
+insertinstalledpackage 'amarok-common' 'all' '3'
+# note that libmtp8 isn't downgraded as there is no need
+testfailureequal "Reading package lists...
+Building dependency tree...
+Selected version '2.3.1-1+sid' (unstable [i386]) for 'amarok'
+Selected version '2.3.1-1+sid' (unstable [all]) for 'amarok-common' because of 'amarok'
+The following additional packages will be installed:
+ amarok-common (2.3.1-1+sid)
+ amarok-utils (2.3.1-1+sid)
+ libc6 (2.11.2-7+sid)
+ phonon-backend-xine (4:4.6.0really4.4.2-1+sid)
+The following NEW packages will be installed:
+ amarok-utils (2.3.1-1+sid)
+ libc6 (2.11.2-7+sid)
+ phonon-backend-xine (4:4.6.0really4.4.2-1+sid)
+The following packages will be DOWNGRADED:
+ amarok (3 => 2.3.1-1+sid)
+ amarok-common (3 => 2.3.1-1+sid)
+0 upgraded, 3 newly installed, 2 downgraded, 0 to remove and 0 not upgraded.
+After this operation, 129 kB of additional disk space will be used.
+E: Trivial Only specified but this is not a trivial operation." apt install amarok/sid --trivial-only -V