packagemanager.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: packagemanager.h,v 1.13 2001/04/06 05:31:01 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. #ifdef __GNUG__
  21. #pragma interface "apt-pkg/packagemanager.h"
  22. #endif
  23. #include <string>
  24. #include <apt-pkg/pkgcache.h>
  25. class pkgAcquire;
  26. class pkgDepCache;
  27. class pkgSourceList;
  28. class pkgOrderList;
  29. class pkgRecords;
  30. class pkgPackageManager : protected pkgCache::Namespace
  31. {
  32. public:
  33. enum OrderResult {Completed,Failed,Incomplete};
  34. protected:
  35. string *FileNames;
  36. pkgDepCache &Cache;
  37. pkgOrderList *List;
  38. bool Debug;
  39. bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
  40. virtual OrderResult OrderInstall();
  41. bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
  42. bool CreateOrderList();
  43. // Analysis helpers
  44. bool DepAlwaysTrue(DepIterator D);
  45. // Install helpers
  46. bool ConfigureAll();
  47. bool SmartConfigure(PkgIterator Pkg);
  48. bool SmartUnPack(PkgIterator Pkg);
  49. bool SmartRemove(PkgIterator Pkg);
  50. bool EarlyRemove(PkgIterator Pkg);
  51. // The Actual installation implementation
  52. virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
  53. virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
  54. virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
  55. virtual bool Go() {return true;};
  56. virtual void Reset() {};
  57. public:
  58. // Main action members
  59. bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
  60. pkgRecords *Recs);
  61. OrderResult DoInstall();
  62. bool FixMissing();
  63. pkgPackageManager(pkgDepCache *Cache);
  64. virtual ~pkgPackageManager();
  65. };
  66. #endif