dpkgpm.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: dpkgpm.h,v 1.8 2001/05/07 05:05:13 jgg Exp $
  4. /* ######################################################################
  5. DPKG Package Manager - Provide an interface to dpkg
  6. ##################################################################### */
  7. /*}}}*/
  8. #ifndef PKGLIB_DPKGPM_H
  9. #define PKGLIB_DPKGPM_H
  10. #include <apt-pkg/packagemanager.h>
  11. #include <vector>
  12. #include <stdio.h>
  13. using std::vector;
  14. class pkgDPkgPM : public pkgPackageManager
  15. {
  16. protected:
  17. int pkgFailures;
  18. // used for progress reporting
  19. struct DpkgState
  20. {
  21. const char *state; // the dpkg state (e.g. "unpack")
  22. const char *str; // the human readable translation of the state
  23. };
  24. struct Item
  25. {
  26. enum Ops {Install, Configure, Remove, Purge} Op;
  27. string File;
  28. PkgIterator Pkg;
  29. Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
  30. File(File), Pkg(Pkg) {};
  31. Item() {};
  32. };
  33. vector<Item> List;
  34. // Helpers
  35. bool RunScripts(const char *Cnf);
  36. bool RunScriptsWithPkgs(const char *Cnf);
  37. bool SendV2Pkgs(FILE *F);
  38. // apport integration
  39. void WriteApportReport(const char *pkgpath, const char *errormsg);
  40. // The Actuall installation implementation
  41. virtual bool Install(PkgIterator Pkg,string File);
  42. virtual bool Configure(PkgIterator Pkg);
  43. virtual bool Remove(PkgIterator Pkg,bool Purge = false);
  44. virtual bool Go(int StatusFd=-1);
  45. virtual void Reset();
  46. public:
  47. pkgDPkgPM(pkgDepCache *Cache);
  48. virtual ~pkgDPkgPM();
  49. };
  50. #endif