Browse Source

don't auto-switch candidate if installed is good enough

If we perform candidate switching in requests like "apt install foo/bar"
we should first check if the dependencies of foo from release bar are
already satisfied by what is already installed before checking if the
candidate (or switched candidate) would.
tags/debian/1.6_alpha6
David Kalnischkies 4 years ago
parent
commit
b857d586ed
2 changed files with 31 additions and 0 deletions
  1. +7
    -0
      apt-pkg/depcache.cc
  2. +24
    -0
      test/integration/test-release-candidate-switching

+ 7
- 0
apt-pkg/depcache.cc View File

@@ -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')


+ 24
- 0
test/integration/test-release-candidate-switching View File

@@ -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

Loading…
Cancel
Save