apt: pkgDepCache Class Reference

apt 3.2.0 commandline package manager

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
pkgDepCache Class Reference
Inheritance diagram for pkgDepCache:

## Classes
class | InRootSetFunc
| An arbitrary predicate on packages. More...
class | ActionGroup
| Represents an active action group. More...
class | DefaultRootSetFunc
| Returns true for packages matching a regular expression in APT::NeverAutoRemove. More...
struct | StateCache
class | Policy
class | Transaction
| Perform changes to the depcache atomically. More...
struct | Private

## 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 | VersionTypes { NowVersion , InstallVersion , CandidateVersion }
enum | ModeList { ModeDelete = 0 , ModeKeep = 1 , ModeInstall = 2 , ModeGarbage = 3 }

## Public Member Functions
void | BuildGroupOrs (VerIterator const &V)
void | UpdateVerState (PkgIterator const &Pkg)
int | IncreaseActionGroupLevel ()
int | DecreaseActionGroupLevel ()
| operator pkgCache & ()
Header & | Head ()
GrpIterator | GrpBegin ()
PkgIterator | PkgBegin ()
GrpIterator | FindGrp (std::string_view Name)
PkgIterator | FindPkg (std::string_view Name)
PkgIterator | FindPkg (std::string_view Name, std::string_view Arch)
pkgCache & | GetCache ()
pkgVersioningSystem & | VS ()
bool | IsImportantDep (DepIterator Dep) const
Policy & | GetPolicy ()
StateCache & | operator[] (PkgIterator const &I)
StateCache & | operator[] (PkgIterator const &I) const
unsigned char & | operator[] (DepIterator const &I)
unsigned char const & | operator[] (DepIterator const &I) const
virtual InRootSetFunc * | GetRootSetFunc ()
InRootSetFunc * | GetCachedRootSetFunc () APT_HIDDEN
virtual bool | MarkFollowsRecommends ()
virtual bool | MarkFollowsSuggests ()
bool | MarkAndSweep (InRootSetFunc &rootFunc)
| Update the Marked and Garbage fields of all packages.
bool | MarkAndSweep ()
bool | PhasingApplied (PkgIterator Pkg) const

## Protected Member Functions
bool | CheckDep (DepIterator const &Dep, int const Type, PkgIterator &Res)
bool | CheckDep (DepIterator const &Dep, int const Type)
unsigned char | DependencyState (DepIterator const &D)
unsigned char | VersionState (DepIterator D, unsigned char const Check, unsigned char const SetMin, unsigned char const SetPolicy) const
void | Update (DepIterator Dep)
void | Update (PkgIterator const &P)
void | AddSizes (const PkgIterator &Pkg, bool const Invert=false)
void | RemoveSizes (const PkgIterator &Pkg)
void | AddStates (const PkgIterator &Pkg, bool const Invert=false)
void | RemoveStates (const PkgIterator &Pkg)

## Protected Attributes
pkgCache * | Cache
StateCache * | PkgState
unsigned char * | DepState
signed long long | iUsrSize
unsigned long long | iDownloadSize
unsigned long | iInstCount
unsigned long | iDelCount
unsigned long | iKeepCount
unsigned long | iBrokenCount
unsigned long | iPolicyBrokenCount
unsigned long | iBadCount
bool | DebugMarker
bool | DebugAutoInstall
Policy * | delLocalPolicy
Policy * | LocalPolicy

## Friends
class | ActionGroup
class | Transaction

## 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)
pkgCache::VerIterator | GetCandidateVersion (pkgCache::PkgIterator const &Pkg)
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)
void | MarkAuto (const PkgIterator &Pkg, bool Auto)
virtual bool | IsInstallOk (const PkgIterator &Pkg, bool AutoInst=true, unsigned long Depth=0, bool FromUser=true)
virtual bool | IsDeleteOk (const PkgIterator &Pkg, bool MarkPurge=false, unsigned long Depth=0, bool FromUser=true)
bool | readStateFile (OpProgress *const prog)
bool | writeStateFile (OpProgress *const prog, bool const InstalledOnly=true)
signed long long | UsrSize ()
unsigned long long | DebSize ()
unsigned long | DelCount ()
unsigned long | KeepCount ()
unsigned long | InstCount ()
unsigned long | UpgradeCount ()
unsigned long | BrokenCount ()
unsigned long | PolicyBrokenCount ()
unsigned long | BadCount ()
bool | Init (OpProgress *const Prog)
void | Update (OpProgress *const Prog=0)
| pkgDepCache (pkgCache *const Cache, Policy *const Plcy=0)
bool | CheckConsistency (char const *const msgtag="")
bool | IsInstallOkMultiArchSameVersionSynced (PkgIterator const &Pkg, bool const AutoInst, unsigned long const Depth, bool const FromUser)
bool | IsInstallOkDependenciesSatisfiableByCandidates (PkgIterator const &Pkg, bool const AutoInst, unsigned long const Depth, bool const FromUser)
bool | IsDeleteOkProtectInstallRequests (PkgIterator const &Pkg, bool const rPurge, unsigned long const Depth, bool const FromUser)

## Additional Inherited Members
Protected Types inherited from pkgCache::Namespace
typedef pkgCache::GrpIterator | GrpIterator
typedef pkgCache::PkgIterator | PkgIterator
typedef pkgCache::VerIterator | VerIterator
typedef pkgCache::SrcVerIterator | SrcVerIterator
typedef pkgCache::DescIterator | DescIterator
typedef pkgCache::DepIterator | DepIterator
typedef pkgCache::PrvIterator | PrvIterator
typedef pkgCache::RlsFileIterator | RlsFileIterator
typedef pkgCache::PkgFileIterator | PkgFileIterator
typedef pkgCache::VerFileIterator | VerFileIterator
typedef pkgCache::Version | Version
typedef pkgCache::Description | Description
typedef pkgCache::Package | Package
typedef pkgCache::Header | Header
typedef pkgCache::Dep | Dep
typedef pkgCache::Flag | Flag

## Member Function Documentation

## ◆ GetCachedRootSetFunc()

pkgDepCache::InRootSetFunc * GetCachedRootSetFunc | ( |  | ) |

This should return const really - do not delete.

References GetRootSetFunc().

## ◆ GetCandidateVersion()

pkgCache::VerIterator GetCandidateVersion | ( | pkgCache::PkgIterator const & | Pkg | ) |

Returns
  '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.

Parameters

  Pkg | is the package to return the candidate for

Referenced by DependencySolver::FromDepCache().

## ◆ GetRootSetFunc()

pkgDepCache::InRootSetFunc * GetRootSetFunc | ( |  | ) |
| virtual

Returns
  A function identifying packages in the root set other than manually installed packages and essential packages, or NULL if an error occurs.

Todo
  Is this the best place for this function? Perhaps the settings for mark-and-sweep should be stored in a single external class?

References Configuration::MatchAgainstConfig::wasConstructedSuccessfully().

Referenced by GetCachedRootSetFunc().

## ◆ IsDeleteOk()

bool IsDeleteOk | ( | const PkgIterator & | Pkg,
|  | bool | MarkPurge = false,
|  | unsigned long | Depth = 0,
|  | bool | FromUser = true )
| virtual

Returns
  true if it's OK for MarkDelete to remove the given package.

The default implementation simply calls all IsDeleteOk* method mentioned below, see also IsInstallOk.

The parameters are the same as in the calling MarkDelete:

Parameters

  Pkg | the package that MarkDelete wants to remove.
  MarkPurge | should we purge instead of "only" remove?
  Depth | recursive deep of this Marker call
  FromUser | was the remove requested by the user?

## ◆ IsInstallOk()

bool IsInstallOk | ( | const PkgIterator & | Pkg,
|  | bool | AutoInst = true,
|  | unsigned long | Depth = 0,
|  | bool | FromUser = true )
| virtual

Returns
  true if it's OK for MarkInstall to install the given package.

The default implementation simply calls all IsInstallOk* method mentioned below.

Overriding implementations should use the hold-state-flag to cache results from previous checks of this package - if possible.

The parameters are the same as in the calling MarkInstall:

Parameters

  Pkg | the package that MarkInstall wants to install.
  AutoInst | install this and all its dependencies
  Depth | recursive deep of this Marker call
  FromUser | was the install requested by the user?

## ◆ MarkAndSweep()

bool MarkAndSweep | ( | InRootSetFunc & | rootFunc | ) |

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 the private MarkRequired() and Sweep() to do its dirty work.

Parameters

  rootFunc | A predicate that returns true for packages that should be added to the root set.

## ◆ MarkAuto()

void MarkAuto | ( | const PkgIterator & | Pkg,
|  | bool | Auto )

Set the "is automatically installed" flag of Pkg.

Referenced by DependencySolver::ToDepCache().

## ◆ MarkFollowsRecommends()

bool MarkFollowsRecommends | ( |  | ) |
| virtual

Returns
  true if the garbage collector should follow recommendations.

## ◆ MarkFollowsSuggests()

bool MarkFollowsSuggests | ( |  | ) |
| virtual

Returns
  true if the garbage collector should follow suggestions.

## ◆ PhasingApplied()

bool PhasingApplied | ( | pkgCache::PkgIterator | Pkg | ) | const

Check if the phased update is ready.

Returns
  false if this is a phased update that is not yet ready for us

Referenced by DependencySolver::FromDepCache().

## ◆ SetCandidateRelease()

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.

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.

Parameters

  | 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

Returns
  true if the switch was successful, false otherwise

References pkgCache::Dep::Or.

## Member Data Documentation

## ◆ iDownloadSize

unsigned long long iDownloadSize
| protected

Stores how much we need to download to get the packages

## ◆ iUsrSize

signed long long iUsrSize
| protected

Stores the space changes after installation

The documentation for this class was generated from the following files:

- apt-pkg/depcache.h
- apt-pkg/depcache.cc