packagemanager.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: packagemanager.h,v 1.10 1999/07/20 05:53:33 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. // Header section: pkglib
  19. #ifndef PKGLIB_PACKAGEMANAGER_H
  20. #define PKGLIB_PACKAGEMANAGER_H
  21. #ifdef __GNUG__
  22. #pragma interface "apt-pkg/packagemanager.h"
  23. #endif
  24. #include <string>
  25. #include <apt-pkg/pkgcache.h>
  26. class pkgAcquire;
  27. class pkgDepCache;
  28. class pkgSourceList;
  29. class pkgOrderList;
  30. class pkgRecords;
  31. class pkgPackageManager
  32. {
  33. public:
  34. enum OrderResult {Completed,Failed,Incomplete};
  35. protected:
  36. string *FileNames;
  37. pkgDepCache &Cache;
  38. pkgOrderList *List;
  39. bool Debug;
  40. // Bring some usefull types into the local scope
  41. typedef pkgCache::PkgIterator PkgIterator;
  42. typedef pkgCache::VerIterator VerIterator;
  43. typedef pkgCache::DepIterator DepIterator;
  44. typedef pkgCache::PrvIterator PrvIterator;
  45. typedef pkgCache::Version Version;
  46. typedef pkgCache::Package Package;
  47. bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
  48. OrderResult OrderInstall();
  49. bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
  50. bool CreateOrderList();
  51. // Analysis helpers
  52. bool DepAlwaysTrue(DepIterator D);
  53. // Install helpers
  54. bool ConfigureAll();
  55. bool SmartConfigure(PkgIterator Pkg);
  56. bool SmartUnPack(PkgIterator Pkg);
  57. bool SmartRemove(PkgIterator Pkg);
  58. bool EarlyRemove(PkgIterator Pkg);
  59. // The Actuall installation implementation
  60. virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
  61. virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
  62. virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
  63. virtual bool Go() {return true;};
  64. virtual void Reset() {};
  65. public:
  66. // Main action members
  67. bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
  68. pkgRecords *Recs);
  69. OrderResult DoInstall();
  70. bool FixMissing();
  71. pkgPackageManager(pkgDepCache &Cache);
  72. virtual ~pkgPackageManager();
  73. };
  74. #endif