summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-08-27 00:28:47 +0200
committerJulian Andres Klode <jak@debian.org>2015-08-27 13:27:44 +0200
commit848fd2a65fa2aef296d44c9a19b89ac272ca12fe (patch)
tree11d50e57c34045c3d368164f7eb69d62928d0e0a /apt-private/private-install.cc
parentb6192267c23ffda1b9c8328537a5f2c83e176c26 (diff)
install: Set a local deb as the candidate for that package
This ensures that we can install .deb files that are not the candidate for a given package.
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 844fcbc7e..3647ca99d 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -675,6 +675,18 @@ bool DoInstall(CommandLine &CmdL)
std::map<unsigned short, APT::VersionSet> verset;
+ for (const char **I = CmdL.FileList; *I != 0; I++) {
+ // Check for local pkgs like in the loop above.
+ if(!FileExists(*I) || flExtension(*I) != "deb")
+ continue;
+
+ pkgCache::PkgIterator pkg = Cache->FindPkg(*I);
+
+ // Set any version providing the .deb as the candidate.
+ for (auto Prv = pkg.ProvidesList(); Prv.end() == false; Prv++)
+ Cache.GetDepCache()->SetCandidateVersion(Prv.OwnerVer());
+ }
+
if(!DoCacheManipulationFromCommandLine(CmdL, Cache, verset, 0))
return false;