You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.4 KiB

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