packagemanager.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: packagemanager.h,v 1.7 1998/11/22 23:37:06 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. protected:
  34. string *FileNames;
  35. pkgDepCache &Cache;
  36. pkgOrderList *List;
  37. bool Debug;
  38. // Bring some usefull types into the local scope
  39. typedef pkgCache::PkgIterator PkgIterator;
  40. typedef pkgCache::VerIterator VerIterator;
  41. typedef pkgCache::DepIterator DepIterator;
  42. typedef pkgCache::PrvIterator PrvIterator;
  43. typedef pkgCache::Version Version;
  44. typedef pkgCache::Package Package;
  45. bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
  46. bool OrderInstall();
  47. bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
  48. bool CreateOrderList();
  49. // Analysis helpers
  50. bool DepAlwaysTrue(DepIterator D);
  51. // Install helpers
  52. bool ConfigureAll();
  53. bool SmartConfigure(PkgIterator Pkg);
  54. bool SmartUnPack(PkgIterator Pkg);
  55. bool SmartRemove(PkgIterator Pkg);
  56. bool EarlyRemove(PkgIterator Pkg);
  57. // The Actuall installation implementation
  58. virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
  59. virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
  60. virtual bool Remove(PkgIterator /*Pkg*/) {return false;};
  61. virtual bool Go() {return true;};
  62. public:
  63. // Main action members
  64. bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
  65. pkgRecords *Recs);
  66. bool DoInstall();
  67. bool FixMissing();
  68. pkgPackageManager(pkgDepCache &Cache);
  69. virtual ~pkgPackageManager();
  70. };
  71. #endif