struct StateCache
{
- // Epoch stripped text versions of the two version fields
+ // text versions of the two version fields
const char *CandVersion;
const char *CurVersion;
unsigned char DepState; // DepState Flags
// Update of candidate version
- const char *StripEpoch(const char *Ver) APT_PURE;
+ APT_DEPRECATED_MSG("Use the method of the same name in contrib/strutl.h instead if you must") const char *StripEpoch(const char *Ver) APT_PURE;
void Update(PkgIterator Pkg,pkgCache &Cache);
// Various test members for the current status of the package
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_MSG("Confusingly named method which returns the candidate as chosen by policy (NOT as chosen via .SetCandidateVersion!). You probably want to use .GetCandidateVersion instead.") 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;};
// Accessors
inline StateCache &operator [](PkgIterator const &I) {return PkgState[I->ID];};
+ inline StateCache &operator [](PkgIterator const &I) const {return PkgState[I->ID];};
inline unsigned char &operator [](DepIterator const &I) {return DepState[I->ID];};
/** \return A function identifying packages in the root set other
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 chosen 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);