#include <depcache.h>
Classes | |
class | ActionGroup |
Represents an active action group. More... | |
class | DefaultRootSetFunc |
Returns true for packages matching a regular expression in APT::NeverAutoRemove. More... | |
class | InRootSetFunc |
An arbitrary predicate on packages. More... | |
class | Policy |
struct | StateCache |
Public Types | |
enum | DepFlags { DepNow = (1 << 0), DepInstall = (1 << 1), DepCVer = (1 << 2), DepGNow = (1 << 3), DepGInstall = (1 << 4), DepGCVer = (1 << 5) } |
enum | DepStateFlags { DepNowPolicy = (1 << 0), DepNowMin = (1 << 1), DepInstPolicy = (1 << 2), DepInstMin = (1 << 3), DepCandPolicy = (1 << 4), DepCandMin = (1 << 5) } |
enum | InternalFlags { AutoKept = (1 << 0), Purge = (1 << 1), ReInstall = (1 << 2), Protected = (1 << 3) } |
enum | ModeList { ModeDelete = 0, ModeKeep = 1, ModeInstall = 2 } |
enum | VersionTypes { NowVersion, InstallVersion, CandidateVersion } |
Public Member Functions | |
pkgDepCache (pkgCache *Cache, Policy *Plcy=0) | |
virtual | ~pkgDepCache () |
unsigned long | BadCount () |
unsigned long | BrokenCount () |
void | BuildGroupOrs (VerIterator const &V) |
unsigned long long | DebSize () |
unsigned long | DelCount () |
GrpIterator | FindGrp (std::string const &Name) |
PkgIterator | FindPkg (std::string const &Name) |
PkgIterator | FindPkg (std::string const &Name, std::string const &Arch) |
pkgCache & | GetCache () |
VerIterator | GetCandidateVer (PkgIterator const &Pkg) |
Policy & | GetPolicy () |
virtual InRootSetFunc * | GetRootSetFunc () |
GrpIterator | GrpBegin () |
Header & | Head () |
bool | Init (OpProgress *Prog) |
unsigned long | InstCount () |
virtual bool | IsDeleteOk (const PkgIterator &Pkg, bool MarkPurge=false, unsigned long Depth=0, bool FromUser=true) |
bool | IsImportantDep (DepIterator Dep) |
virtual bool | IsInstallOk (const PkgIterator &Pkg, bool AutoInst=true, unsigned long Depth=0, bool FromUser=true) |
unsigned long | KeepCount () |
bool | MarkAndSweep (InRootSetFunc &rootFunc) |
Update the Marked and Garbage fields of all packages. More... | |
bool | MarkAndSweep () |
virtual bool | MarkFollowsRecommends () |
virtual bool | MarkFollowsSuggests () |
operator pkgCache & () | |
StateCache & | operator[] (PkgIterator const &I) |
unsigned char & | operator[] (DepIterator const &I) |
PkgIterator | PkgBegin () |
unsigned long | PolicyBrokenCount () |
bool | readStateFile (OpProgress *prog) |
void | Update (OpProgress *Prog=0) |
void | UpdateVerState (PkgIterator Pkg) |
signed long long | UsrSize () |
pkgVersioningSystem & | VS () |
bool | writeStateFile (OpProgress *prog, bool InstalledOnly=true) |
State Manipulators | |
bool | MarkKeep (PkgIterator const &Pkg, bool Soft=false, bool FromUser=true, unsigned long Depth=0) |
bool | MarkDelete (PkgIterator const &Pkg, bool MarkPurge=false, unsigned long Depth=0, bool FromUser=true) |
bool | MarkInstall (PkgIterator const &Pkg, bool AutoInst=true, unsigned long Depth=0, bool FromUser=true, bool ForceImportantDeps=false) |
void | MarkProtected (PkgIterator const &Pkg) |
void | SetReInstall (PkgIterator const &Pkg, bool To) |
void | SetCandidateVersion (VerIterator TargetVer) |
bool | SetCandidateRelease (pkgCache::VerIterator TargetVer, std::string const &TargetRel) |
bool | SetCandidateRelease (pkgCache::VerIterator TargetVer, std::string const &TargetRel, std::list< std::pair< pkgCache::VerIterator, pkgCache::VerIterator > > &Changed) |
Set the candidate version for dependencies too if needed. More... | |
void | MarkAuto (const PkgIterator &Pkg, bool Auto) |
Set the "is automatically installed" flag of Pkg. More... | |
Protected Types | |
typedef pkgCache::Dep | Dep |
typedef pkgCache::DepIterator | DepIterator |
typedef pkgCache::DescIterator | DescIterator |
typedef pkgCache::Description | Description |
typedef pkgCache::Flag | Flag |
typedef pkgCache::GrpIterator | GrpIterator |
typedef pkgCache::Header | Header |
typedef pkgCache::Package | Package |
typedef pkgCache::PkgFileIterator | PkgFileIterator |
typedef pkgCache::PkgIterator | PkgIterator |
typedef pkgCache::PrvIterator | PrvIterator |
typedef pkgCache::VerFileIterator | VerFileIterator |
typedef pkgCache::VerIterator | VerIterator |
typedef pkgCache::Version | Version |
Protected Member Functions | |
void | AddSizes (const PkgIterator &Pkg, bool const Invert=false) |
void | AddStates (const PkgIterator &Pkg, bool const Invert=false) |
bool | CheckDep (DepIterator Dep, int Type, PkgIterator &Res) |
bool | CheckDep (DepIterator Dep, int Type) |
unsigned char | DependencyState (DepIterator &D) |
void | RemoveSizes (const PkgIterator &Pkg) |
void | RemoveStates (const PkgIterator &Pkg) |
void | Update (DepIterator Dep) |
void | Update (PkgIterator const &P) |
unsigned char | VersionState (DepIterator D, unsigned char Check, unsigned char SetMin, unsigned char SetPolicy) |
Protected Attributes | |
pkgCache * | Cache |
bool | DebugAutoInstall |
bool | DebugMarker |
Policy * | delLocalPolicy |
unsigned char * | DepState |
unsigned long | iBadCount |
unsigned long | iBrokenCount |
unsigned long | iDelCount |
unsigned long long | iDownloadSize |
Stores how much we need to download to get the packages. More... | |
unsigned long | iInstCount |
unsigned long | iKeepCount |
unsigned long | iPolicyBrokenCount |
signed long long | iUsrSize |
Stores the space changes after installation. More... | |
Policy * | LocalPolicy |
StateCache * | PkgState |
Private Member Functions | |
bool | IsModeChangeOk (ModeList const mode, PkgIterator const &Pkg, unsigned long const Depth, bool const FromUser) |
void | MarkPackage (const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver, bool const &follow_recommends, bool const &follow_suggests) |
Mark a single package and all its unmarked important dependencies during mark-and-sweep. More... | |
bool | MarkRequired (InRootSetFunc &rootFunc) |
Update the Marked field of all packages. More... | |
bool | Sweep () |
Set the StateCache::Garbage flag on all packages that should be removed. More... | |
Private Attributes | |
int | group_level |
The number of open "action groups"; certain post-action operations are suppressed if this number is > 0. More... | |
Friends | |
class | ActionGroup |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
virtual |
|
protected |
|
protected |
|
inline |
References iBadCount.
|
inline |
References iBrokenCount.
void pkgDepCache::BuildGroupOrs | ( | VerIterator const & | V | ) |
|
protected |
|
inlineprotected |
|
inline |
References iDownloadSize.
|
inline |
References iDelCount.
|
protected |
|
inline |
|
inline |
|
inline |
|
inline |
References pkgDepCache::Policy::GetCandidateVer(), and LocalPolicy.
|
inline |
References LocalPolicy.
|
virtual |
Referenced by MarkAndSweep().
|
inline |
|
inline |
References Cache, and pkgCache::HeaderP.
bool pkgDepCache::Init | ( | OpProgress * | Prog | ) |
|
inline |
References iInstCount.
|
virtual |
See the default implementation for a simple example how this method can be used. Overriding implementations should use the hold-state-flag to cache results from previous checks of this package - also it should be used if the default resolver implementation is also used to ensure that these packages are handled like "normal" dpkg holds.
The parameters are the same as in the calling MarkDelete:
Pkg | the package that MarkDelete wants to remove. |
Purge | should we purge instead of "only" remove? |
Depth | recursive deep of this Marker call |
FromUser | was the remove requested by the user? |
|
inline |
References pkgDepCache::Policy::IsImportantDep(), and LocalPolicy.
|
virtual |
See the default implementation for a simple example how this method can be used. Overriding implementations should use the hold-state-flag to cache results from previous checks of this package - also it should be used if the default resolver implementation is also used to ensure that these packages are handled like "normal" dpkg holds.
The parameters are the same as in the calling MarkInstall:
Pkg | the package that MarkInstall wants to install. |
AutoInst | needs a previous MarkInstall this package? |
Depth | recursive deep of this Marker call |
FromUser | was the install requested by the user? |
|
private |
|
inline |
References iKeepCount.
|
inline |
Update the Marked and Garbage fields of all packages.
This routine is implicitly invoked after all state manipulators and when an ActionGroup is destroyed. It invokes MarkRequired and Sweep to do its dirty work.
rootFunc | A predicate that returns true for packages that should be added to the root set. |
References MarkRequired(), and Sweep().
|
inline |
void pkgDepCache::MarkAuto | ( | const PkgIterator & | Pkg, |
bool | Auto | ||
) |
Set the "is automatically installed" flag of Pkg.
bool pkgDepCache::MarkDelete | ( | PkgIterator const & | Pkg, |
bool | MarkPurge = false , |
||
unsigned long | Depth = 0 , |
||
bool | FromUser = true |
||
) |
|
virtual |
|
virtual |
bool pkgDepCache::MarkInstall | ( | PkgIterator const & | Pkg, |
bool | AutoInst = true , |
||
unsigned long | Depth = 0 , |
||
bool | FromUser = true , |
||
bool | ForceImportantDeps = false |
||
) |
bool pkgDepCache::MarkKeep | ( | PkgIterator const & | Pkg, |
bool | Soft = false , |
||
bool | FromUser = true , |
||
unsigned long | Depth = 0 |
||
) |
|
private |
Mark a single package and all its unmarked important dependencies during mark-and-sweep.
Recursively invokes itself to mark all dependencies of the package.
pkg | The package to mark. |
ver | The version of the package that is to be marked. |
follow_recommends | If true, recommendations of the package will be recursively marked. |
follow_suggests | If true, suggestions of the package will be recursively marked. |
|
inline |
References pkgDepCache::StateCache::iFlags, PkgState, and Protected.
Referenced by pkgProblemResolver::Protect().
|
private |
Update the Marked field of all packages.
Each package's StateCache::Marked field will be set to true if and only if it can be reached from the root set. By default, the root set consists of the set of manually installed or essential packages, but it can be extended using the parameter #rootFunc.
rootFunc | A callback that can be used to add extra packages to the root set. |
Referenced by MarkAndSweep().
|
inline |
References PkgState.
|
inline |
References DepState.
|
inline |
|
inline |
References iPolicyBrokenCount.
bool pkgDepCache::readStateFile | ( | OpProgress * | prog | ) |
|
inlineprotected |
|
inlineprotected |
bool pkgDepCache::SetCandidateRelease | ( | pkgCache::VerIterator | TargetVer, |
std::string const & | TargetRel | ||
) |
bool pkgDepCache::SetCandidateRelease | ( | pkgCache::VerIterator | TargetVer, |
std::string const & | TargetRel, | ||
std::list< std::pair< pkgCache::VerIterator, pkgCache::VerIterator > > & | Changed | ||
) |
Set the candidate version for dependencies too if needed.
Sets not only the candidate version as SetCandidateVersion does, but walks also down the dependency tree and checks if it is required to set the candidate of the dependency to a version from the given release, too.
TargetVer | new candidate version of the package | |
TargetRel | try to switch to this release if needed | |
[out] | Changed | a list of pairs consisting of the old version of the changed package and the version which required the switch of this dependency |
void pkgDepCache::SetCandidateVersion | ( | VerIterator | TargetVer | ) |
void pkgDepCache::SetReInstall | ( | PkgIterator const & | Pkg, |
bool | To | ||
) |
|
private |
Set the StateCache::Garbage flag on all packages that should be removed.
Packages that were not marked by the last call to MarkRequired are tested to see whether they are actually garbage. If so, they are marked as such.
Referenced by MarkAndSweep().
|
protected |
|
protected |
void pkgDepCache::Update | ( | OpProgress * | Prog = 0 | ) |
void pkgDepCache::UpdateVerState | ( | PkgIterator | Pkg | ) |
|
inline |
References iUsrSize.
|
protected |
|
inline |
References Cache, and pkgCache::VS.
bool pkgDepCache::writeStateFile | ( | OpProgress * | prog, |
bool | InstalledOnly = true |
||
) |
|
friend |
|
protected |
Referenced by FindGrp(), FindPkg(), GetCache(), GrpBegin(), Head(), operator pkgCache &(), PkgBegin(), and VS().
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by operator[]().
|
private |
The number of open "action groups"; certain post-action operations are suppressed if this number is > 0.
|
protected |
Referenced by BadCount().
|
protected |
Referenced by BrokenCount().
|
protected |
Referenced by DelCount().
|
protected |
Stores how much we need to download to get the packages.
Referenced by DebSize().
|
protected |
Referenced by InstCount().
|
protected |
Referenced by KeepCount().
|
protected |
Referenced by PolicyBrokenCount().
|
protected |
Stores the space changes after installation.
Referenced by UsrSize().
|
protected |
Referenced by GetCandidateVer(), GetPolicy(), and IsImportantDep().
|
protected |
Referenced by MarkProtected(), and operator[]().