packagemanager.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: packagemanager.h,v 1.4 1998/07/19 21:24:13 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 pkgAquire;
  27. class pkgDepCache;
  28. class pkgSourceList;
  29. class pkgOrderList;
  30. class pkgPackageManager
  31. {
  32. protected:
  33. string *FileNames;
  34. pkgDepCache &Cache;
  35. pkgOrderList *List;
  36. // Bring some usefull types into the local scope
  37. typedef pkgCache::PkgIterator PkgIterator;
  38. typedef pkgCache::VerIterator VerIterator;
  39. typedef pkgCache::DepIterator DepIterator;
  40. typedef pkgCache::PrvIterator PrvIterator;
  41. typedef pkgCache::Version Version;
  42. typedef pkgCache::Package Package;
  43. bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
  44. bool OrderInstall();
  45. bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
  46. // Analysis helpers
  47. bool DepAlwaysTrue(DepIterator D);
  48. // Install helpers
  49. bool ConfigureAll();
  50. bool SmartConfigure(PkgIterator Pkg);
  51. bool SmartUnPack(PkgIterator Pkg);
  52. bool SmartRemove(PkgIterator Pkg);
  53. bool EarlyRemove(PkgIterator Pkg);
  54. // The Actuall installation implementation
  55. virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
  56. virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
  57. virtual bool Remove(PkgIterator /*Pkg*/) {return false;};
  58. virtual bool Go() {return false;};
  59. public:
  60. // Main action members
  61. bool DoInstall();
  62. bool FixMissing();
  63. pkgPackageManager(pkgDepCache &Cache);
  64. virtual ~pkgPackageManager();
  65. };
  66. #endif