X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/75a90b93257ea81d42331c03b56bd6589c62e065..23397c9d7d4d455461176600bb45c81185493504:/apt-pkg/depcache.h diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 66cb7dbab..5554e1a69 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -15,7 +15,7 @@ This structure is important to support the readonly status of the cache file. When the data is saved the cache will be refereshed from our - internal rep and written to disk. Then the actual persistant data + internal rep and written to disk. Then the actual persistent data files will be put on the disk. Each dependency is compared against 3 target versions to produce to @@ -40,12 +40,27 @@ #include #include -#include -#include +#include +#include + +#include -#include #include +#include +#include +#include + +#ifndef APT_8_CLEANER_HEADERS +#include +#include +#endif +#ifndef APT_10_CLEANER_HEADERS #include +#include +#endif + +class OpProgress; +class pkgVersioningSystem; class pkgDepCache : protected pkgCache::Namespace { @@ -55,7 +70,7 @@ class pkgDepCache : protected pkgCache::Namespace class InRootSetFunc { public: - virtual bool InRootSet(const pkgCache::PkgIterator &pkg) {return false;}; + virtual bool InRootSet(const pkgCache::PkgIterator &/*pkg*/) {return false;}; virtual ~InRootSetFunc() {}; }; @@ -76,7 +91,7 @@ class pkgDepCache : protected pkgCache::Namespace * \param follow_suggests If \b true, suggestions of the package * will be recursively marked. */ - void MarkPackage(const pkgCache::PkgIterator &pkg, + APT_HIDDEN void MarkPackage(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver, bool const &follow_recommends, bool const &follow_suggests); @@ -94,7 +109,7 @@ class pkgDepCache : protected pkgCache::Namespace * * \return \b false if an error occurred. */ - bool MarkRequired(InRootSetFunc &rootFunc); + APT_HIDDEN bool MarkRequired(InRootSetFunc &rootFunc); /** \brief Set the StateCache::Garbage flag on all packages that * should be removed. @@ -105,7 +120,7 @@ class pkgDepCache : protected pkgCache::Namespace * * \return \b false if an error occurred. */ - bool Sweep(); + APT_HIDDEN bool Sweep(); public: @@ -122,7 +137,7 @@ class pkgDepCache : protected pkgCache::Namespace 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}; + enum ModeList {ModeDelete = 0, ModeKeep = 1, ModeInstall = 2, ModeGarbage = 3}; /** \brief Represents an active action group. * @@ -154,7 +169,7 @@ class pkgDepCache : protected pkgCache::Namespace bool released; /** Action groups are noncopyable. */ - ActionGroup(const ActionGroup &other); + APT_HIDDEN ActionGroup(const ActionGroup &other); public: /** \brief Create a new ActionGroup. * @@ -225,7 +240,7 @@ class pkgDepCache : protected pkgCache::Namespace unsigned char DepState; // DepState Flags // Update of candidate version - const char *StripEpoch(const char *Ver); + const char *StripEpoch(const char *Ver) APT_PURE; void Update(PkgIterator Pkg,pkgCache &Cache); // Various test members for the current status of the package @@ -338,9 +353,9 @@ class pkgDepCache : protected pkgCache::Namespace inline Header &Head() {return *Cache->HeaderP;}; inline GrpIterator GrpBegin() {return Cache->GrpBegin();}; inline PkgIterator PkgBegin() {return Cache->PkgBegin();}; - inline GrpIterator FindGrp(string const &Name) {return Cache->FindGrp(Name);}; - inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Name);}; - inline PkgIterator FindPkg(string const &Name, string const &Arch) {return Cache->FindPkg(Name, Arch);}; + inline GrpIterator FindGrp(std::string const &Name) {return Cache->FindGrp(Name);}; + inline PkgIterator FindPkg(std::string const &Name) {return Cache->FindPkg(Name);}; + inline PkgIterator FindPkg(std::string const &Name, std::string const &Arch) {return Cache->FindPkg(Name, Arch);}; inline pkgCache &GetCache() {return *Cache;}; inline pkgVersioningSystem &VS() {return *Cache->VS;}; @@ -375,25 +390,14 @@ class pkgDepCache : protected pkgCache::Namespace /** \brief 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. + * and when an ActionGroup is destroyed. It invokes the private + * MarkRequired() and Sweep() to do its dirty work. * * \param rootFunc A predicate that returns \b true for packages * that should be added to the root set. */ - bool MarkAndSweep(InRootSetFunc &rootFunc) - { - return MarkRequired(rootFunc) && Sweep(); - } - - bool MarkAndSweep() - { - std::auto_ptr f(GetRootSetFunc()); - if(f.get() != NULL) - return MarkAndSweep(*f.get()); - else - return false; - } + bool MarkAndSweep(InRootSetFunc &rootFunc); + bool MarkAndSweep(); /** \name State Manipulators */ @@ -436,16 +440,15 @@ class pkgDepCache : protected pkgCache::Namespace /** \return \b true if it's OK for MarkInstall to install * the given package. * - * 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 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: * \param Pkg the package that MarkInstall wants to install. - * \param AutoInst needs a previous MarkInstall this package? + * \param AutoInst install this and all its dependencies * \param Depth recursive deep of this Marker call * \param FromUser was the install requested by the user? */ @@ -455,16 +458,12 @@ class pkgDepCache : protected pkgCache::Namespace /** \return \b true if it's OK for MarkDelete to remove * the given package. * - * 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 default implementation simply calls all IsDeleteOk* + * method mentioned below, see also #IsInstallOk. * * The parameters are the same as in the calling MarkDelete: * \param Pkg the package that MarkDelete wants to remove. - * \param Purge should we purge instead of "only" remove? + * \param MarkPurge should we purge instead of "only" remove? * \param Depth recursive deep of this Marker call * \param FromUser was the remove requested by the user? */ @@ -492,8 +491,19 @@ class pkgDepCache : protected pkgCache::Namespace pkgDepCache(pkgCache *Cache,Policy *Plcy = 0); virtual ~pkgDepCache(); + protected: + // methods call by IsInstallOk + 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); + + // methods call by IsDeleteOk + bool IsDeleteOkProtectInstallRequests(PkgIterator const &Pkg, + bool const rPurge, unsigned long const Depth, bool const FromUser); + private: - bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, + APT_HIDDEN bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg, unsigned long const Depth, bool const FromUser); };