packagemanager.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: packagemanager.h,v 1.14 2001/05/07 04:24:08 jgg Exp $
  4. /* ######################################################################
  5. Package Manager - Abstacts the package manager
  6. Three steps are
  7. - Aquiration of archives (stores the list of final file names)
  8. - Sorting of operations
  9. - Invokation of package manager
  10. This is the final stage when the package cache entities get converted
  11. into file names and the state stored in a DepCache is transformed
  12. into a series of operations.
  13. In the final scheme of things this may serve as a director class to
  14. access the actual install methods based on the file type being
  15. installed.
  16. ##################################################################### */
  17. /*}}}*/
  18. #ifndef PKGLIB_PACKAGEMANAGER_H
  19. #define PKGLIB_PACKAGEMANAGER_H
  20. #include <string>
  21. #include <apt-pkg/pkgcache.h>
  22. using std::string;
  23. class pkgAcquire;
  24. class pkgDepCache;
  25. class pkgSourceList;
  26. class pkgOrderList;
  27. class pkgRecords;
  28. class pkgPackageManager : protected pkgCache::Namespace
  29. {
  30. public:
  31. enum OrderResult {Completed,Failed,Incomplete};
  32. protected:
  33. string *FileNames;
  34. pkgDepCache &Cache;
  35. pkgOrderList *List;
  36. bool Debug;
  37. bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
  38. virtual OrderResult OrderInstall();
  39. bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
  40. bool CreateOrderList();
  41. // Analysis helpers
  42. bool DepAlwaysTrue(DepIterator D);
  43. // Install helpers
  44. bool ConfigureAll();
  45. bool SmartConfigure(PkgIterator Pkg);
  46. bool SmartUnPack(PkgIterator Pkg);
  47. bool SmartRemove(PkgIterator Pkg);
  48. bool EarlyRemove(PkgIterator Pkg);
  49. // The Actual installation implementation
  50. virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
  51. virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
  52. virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
  53. virtual bool Go(int statusFd=-1) {return true;};
  54. virtual void Reset() {};
  55. public:
  56. // Main action members
  57. bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
  58. pkgRecords *Recs);
  59. OrderResult DoInstall(int statusFd=-1);
  60. bool FixMissing();
  61. pkgPackageManager(pkgDepCache *Cache);
  62. virtual ~pkgPackageManager();
  63. };
  64. #endif