summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-07-28 11:43:36 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-08-10 23:51:34 +0200
commit4326680d2ed23d597f45ca8872a7054368560acc (patch)
treed355be7dc120d07771a774da88241f10150cc673 /apt-pkg/algorithms.h
parent83e5cffc2015aa809acac84737756d292d7bf106 (diff)
simulate all package manager actions explicitly
If a planner lets actions to be figured out by dpkg in pending calls these actions aren't mentioned in a simulation. While that might be a good thing for debugging, it would be a change in behavior and especially if a planner avoids explicit removals could be confusing for users. As such we perform the same 'trick' as in the dpkg implementation by performing explicitly what would be done by the pending calls. To save us some work and avoid desyncs we perform a layer violation by using deb/ code in the generic simulation – and further we perform ugly dynamic_cast to avoid breaking the ABI for nothing; aptitude is the only other user of the simulation class according to codesearch.d.n and for that our little trick works. It just isn't working if you happen to extend pkgSimulate or otherwise manage to call the protected Go methods directly – which isn't very realistic/practical.
Diffstat (limited to 'apt-pkg/algorithms.h')
-rw-r--r--apt-pkg/algorithms.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h
index c1a26587d..5148ff19d 100644
--- a/apt-pkg/algorithms.h
+++ b/apt-pkg/algorithms.h
@@ -52,9 +52,10 @@ using std::ostream;
#endif
+class pkgSimulatePrivate;
class pkgSimulate : public pkgPackageManager /*{{{*/
{
- void * const d;
+ pkgSimulatePrivate * const d;
protected:
class Policy : public pkgDepCache::Policy
@@ -81,9 +82,16 @@ class pkgSimulate : public pkgPackageManager /*{{{*/
virtual bool Configure(PkgIterator Pkg) APT_OVERRIDE;
virtual bool Remove(PkgIterator Pkg,bool Purge) APT_OVERRIDE;
+ // FIXME: trick to avoid ABI break for virtual reimplementation; fix on next ABI break
+public:
+ APT_HIDDEN bool Go2(APT::Progress::PackageManager * progress);
+
private:
APT_HIDDEN void ShortBreaks();
APT_HIDDEN void Describe(PkgIterator iPkg,std::ostream &out,bool Current,bool Candidate);
+ APT_HIDDEN bool RealInstall(PkgIterator Pkg,std::string File);
+ APT_HIDDEN bool RealConfigure(PkgIterator Pkg);
+ APT_HIDDEN bool RealRemove(PkgIterator Pkg,bool Purge);
public: