dpkgpm.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // used for progress reporting
  18. struct DpkgState
  19. {
  20. const char *state; // the dpkg state (e.g. "unpack")
  21. const char *str; // the human readable translation of the state
  22. };
  23. struct Item
  24. {
  25. enum Ops {Install, Configure, Remove, Purge} Op;
  26. string File;
  27. PkgIterator Pkg;
  28. Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
  29. File(File), Pkg(Pkg) {};
  30. Item() {};
  31. };
  32. vector<Item> List;
  33. // Helpers
  34. bool RunScripts(const char *Cnf);
  35. bool RunScriptsWithPkgs(const char *Cnf);
  36. bool SendV2Pkgs(FILE *F);
  37. // The Actuall installation implementation
  38. virtual bool Install(PkgIterator Pkg,string File);
  39. virtual bool Configure(PkgIterator Pkg);
  40. virtual bool Remove(PkgIterator Pkg,bool Purge = false);
  41. virtual bool Go(int StatusFd=-1);
  42. virtual void Reset();
  43. public:
  44. pkgDPkgPM(pkgDepCache *Cache);
  45. virtual ~pkgDPkgPM();
  46. };
  47. #endif