packagemanager.h 2.5 KB

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