summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-05-10 14:51:30 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-05-10 14:51:30 +0200
commit33190fe3d3c200dcd417cd336f9db11f5f4408d5 (patch)
tree566a5a26aa9f54346d113e31c90c989480699b5f /apt-pkg
parent2fac0dd5a7a62b67a869cd4c71c9d09159aaa31d (diff)
don't sent uninstallable rc-only versions via EDSP
Versions which are only available in dpkg/status aren't installable and apt doesn't pick them as candidate for this reason – for the same reason such packages shouldn't be sent to an external solver via EDSP. The packages are pinned to -1, but if the solver has strict pinning disabled it could end up picking this version anyhow – which is a request apt can not satisfy. Reported-By: Maximiliano Curia <maxy@debian.org> on IRC
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/edsp.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 610f9379e..77928379f 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -176,6 +176,24 @@ static void WriteScenarioLimitedDependency(FILE* output,
fprintf(output, "Provides: %s\n", provides.c_str()+2);
}
/*}}}*/
+static bool SkipUnavailableVersions(pkgDepCache &Cache, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver)/*{{{*/
+{
+ /* versions which aren't current and aren't available in
+ any "online" source file are bad, expect if they are the choosen
+ candidate: The exception is for build-dep implementation as it creates
+ such pseudo (package) versions and removes them later on again.
+ We filter out versions at all so packages in 'rc' state only available
+ in dpkg/status aren't passed to solvers as they can't be installed. */
+ if (Pkg->CurrentVer != 0)
+ return false;
+ if (Cache.GetCandidateVersion(Pkg) == Ver)
+ return false;
+ for (pkgCache::VerFileIterator I = Ver.FileList(); I.end() == false; ++I)
+ if (I.File().Flagged(pkgCache::Flag::NotSource) == false)
+ return false;
+ return true;
+}
+ /*}}}*/
// EDSP::WriteScenario - to the given file descriptor /*{{{*/
bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress)
{
@@ -190,6 +208,8 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output, OpProgress *Progress)
continue;
for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver, ++p)
{
+ if (SkipUnavailableVersions(Cache, Pkg, Ver))
+ continue;
WriteScenarioVersion(Cache, output, Pkg, Ver);
WriteScenarioDependency(output, Ver);
fprintf(output, "\n");
@@ -211,6 +231,8 @@ bool EDSP::WriteLimitedScenario(pkgDepCache &Cache, FILE* output,
for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg, ++p)
for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
{
+ if (SkipUnavailableVersions(Cache, Pkg, Ver))
+ continue;
WriteScenarioVersion(Cache, output, Pkg, Ver);
WriteScenarioLimitedDependency(output, Ver, pkgset);
fprintf(output, "\n");