summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc4
-rw-r--r--apt-pkg/depcache.cc7
-rw-r--r--apt-pkg/depcache.h15
-rw-r--r--apt-pkg/edsp.cc7
-rw-r--r--apt-pkg/edsp/edsplistparser.cc9
6 files changed, 35 insertions, 9 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 7ddbb9d44..d25cbd63a 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -933,7 +933,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
Start.TargetPkg()->CurrentVer == 0 &&
Cache[Start.TargetPkg()].Delete() == false &&
(Flags[Start.TargetPkg()->ID] & ToRemove) != ToRemove &&
- Cache.GetCandidateVer(Start.TargetPkg()).end() == false)
+ Cache.GetCandidateVersion(Start.TargetPkg()).end() == false)
{
/* Before removing or keeping the package with the broken dependency
try instead to install the first not previously installed package
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 3ec8b2d60..ccc4b5a6c 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1718,11 +1718,11 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
if(pos != string::npos)
pkgname = pkgname.substr(0, pos);
- // find the package versin and source package name
+ // find the package version and source package name
pkgCache::PkgIterator Pkg = Cache.FindPkg(pkgname);
if (Pkg.end() == true)
return;
- pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg);
+ pkgCache::VerIterator Ver = Cache.GetCandidateVersion(Pkg);
if (Ver.end() == true)
return;
pkgver = Ver.VerStr() == NULL ? "unknown" : Ver.VerStr();
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 39bbe484f..a3d2f6449 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -153,7 +153,7 @@ bool pkgDepCache::Init(OpProgress * const Prog)
State.iFlags = 0;
// Figure out the install version
- State.CandidateVer = GetCandidateVer(I);
+ State.CandidateVer = LocalPolicy->GetCandidateVer(I);
State.InstallVer = I.CurrentVer();
State.Mode = ModeKeep;
@@ -1467,6 +1467,11 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To)
}
}
/*}}}*/
+pkgCache::VerIterator pkgDepCache::GetCandidateVersion(PkgIterator const &Pkg)/*{{{*/
+{
+ return PkgState[Pkg->ID].CandidateVerIter(*this);
+}
+ /*}}}*/
// DepCache::SetCandidateVersion - Change the candidate version /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index ba997c8a6..a1be56bb2 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -360,9 +360,10 @@ class pkgDepCache : protected pkgCache::Namespace
inline pkgCache &GetCache() {return *Cache;};
inline pkgVersioningSystem &VS() {return *Cache->VS;};
-
+
// Policy implementation
- inline VerIterator GetCandidateVer(PkgIterator const &Pkg) {return LocalPolicy->GetCandidateVer(Pkg);};
+ APT_DEPRECATED inline VerIterator GetCandidateVer(PkgIterator const &Pkg) {return /* GetCandidateVersion(Pkg); but for API compat: */ LocalPolicy->GetCandidateVer(Pkg);};
+
inline bool IsImportantDep(DepIterator Dep) const {return LocalPolicy->IsImportantDep(Dep);};
inline Policy &GetPolicy() {return *LocalPolicy;};
@@ -413,6 +414,16 @@ class pkgDepCache : protected pkgCache::Namespace
void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; };
void SetReInstall(PkgIterator const &Pkg,bool To);
+
+ /** @return 'the' candidate version of a package
+ *
+ * The version returned is the version previously set explicitly via
+ * SetCandidate* methods like #SetCandidateVersion or if there wasn't one
+ * set the version as choosen via #Policy.
+ *
+ * @param Pkg is the package to return the candidate for
+ */
+ pkgCache::VerIterator GetCandidateVersion(pkgCache::PkgIterator const &Pkg);
void SetCandidateVersion(VerIterator TargetVer);
bool SetCandidateRelease(pkgCache::VerIterator TargetVer,
std::string const &TargetRel);
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 90f20472e..bf625cc97 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -84,7 +84,7 @@ static void WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::Pkg
fprintf(output, " %s\n", R->c_str());
}
fprintf(output, "APT-Pin: %d\n", Pin);
- if (Cache.GetCandidateVer(Pkg) == Ver)
+ if (Cache.GetCandidateVersion(Pkg) == Ver)
fprintf(output, "APT-Candidate: yes\n");
if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
fprintf(output, "APT-Automatic: yes\n");
@@ -510,9 +510,10 @@ bool EDSP::WriteSolution(pkgDepCache &Cache, FILE* output)
}
else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
{
- fprintf(output, "Install: %d\n", Cache.GetCandidateVer(Pkg)->ID);
+ pkgCache::VerIterator const CandVer = Cache.GetCandidateVersion(Pkg);
+ fprintf(output, "Install: %d\n", CandVer->ID);
if (Debug == true)
- fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), Cache.GetCandidateVer(Pkg).VerStr());
+ fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), CandVer.VerStr());
}
else if (Cache[Pkg].Garbage == true)
{
diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc
index 5c90cf1fc..77a0edc22 100644
--- a/apt-pkg/edsp/edsplistparser.cc
+++ b/apt-pkg/edsp/edsplistparser.cc
@@ -111,6 +111,15 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
return false;
}
+ // FIXME: Using an overriding pin is wrong.
+ if (Section.FindB("APT-Candidate", false))
+ {
+ std::string out;
+ strprintf(out, "Package: %s\nPin: version %s\nPin-Priority: 9999\n\n", Pkg.FullName().c_str(), Ver.VerStr());
+ if (d->preferences.Write(out.c_str(), out.length()) == false)
+ return false;
+ }
+
signed short const pinvalue = Section.FindI("APT-Pin", 500);
if (pinvalue != 500)
{