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
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();
State.iFlags = 0;
// Figure out the install version
- State.CandidateVer = GetCandidateVer(I);
+ State.CandidateVer = LocalPolicy->GetCandidateVer(I);
State.InstallVer = I.CurrentVer();
State.Mode = ModeKeep;
}
}
/*}}}*/
+pkgCache::VerIterator pkgDepCache::GetCandidateVersion(PkgIterator const &Pkg)/*{{{*/
+{
+ return PkgState[Pkg->ID].CandidateVerIter(*this);
+}
+ /*}}}*/
// DepCache::SetCandidateVersion - Change the candidate version /*{{{*/
// ---------------------------------------------------------------------
/* */
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;};
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);
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");
}
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)
{
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)
{
// choose a good candidate and proceed with that.
// Maybe we will find a source later on with the right VerTag
// or RelTag
- pkgCache::VerIterator Ver = Cache->GetCandidateVer(Pkg);
- if (Ver.end() == false)
+ pkgCache::VerIterator const Ver = Cache->GetCandidateVersion(Pkg);
+ if (Ver.end() == false)
{
if (strcmp(Ver.SourcePkgName(),Ver.ParentPkg().Name()) != 0)
Src = Ver.SourcePkgName();
Inst coolstuff (3 experimental [amd64])
Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s -t experimental
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Selected version '3' (experimental [amd64]) for 'coolstuff'
+Execute external solver...
+The following NEW packages will be installed:
+ coolstuff
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst coolstuff (3 experimental [amd64])
+Conf coolstuff (3 experimental [amd64])" aptget install --solver apt coolstuff/experimental -sq=0
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Execute external solver...
+The following NEW packages will be installed:
+ coolstuff
+0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
+Inst coolstuff (3 experimental [amd64])
+Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff=3 -sq=0
+
testsuccessequal 'Reading package lists...
Building dependency tree...
Execute external solver...