dpkgpm.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // input processing
  38. void DoStdin(int master);
  39. void DoTerminalPty(int master, FILE *out);
  40. // void DoDpkgStatusFd();
  41. // The Actuall installation implementation
  42. virtual bool Install(PkgIterator Pkg,string File);
  43. virtual bool Configure(PkgIterator Pkg);
  44. virtual bool Remove(PkgIterator Pkg,bool Purge = false);
  45. virtual bool Go(int StatusFd=-1);
  46. virtual void Reset();
  47. public:
  48. pkgDPkgPM(pkgDepCache *Cache);
  49. virtual ~pkgDPkgPM();
  50. };
  51. #endif