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.
 
 
 
 
 
 

65 lines
1.5 KiB

  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. #ifdef __GNUG__
  11. #pragma interface "apt-pkg/dpkgpm.h"
  12. #endif
  13. #include <apt-pkg/packagemanager.h>
  14. #include <vector>
  15. #include <stdio.h>
  16. using std::vector;
  17. class pkgDPkgPM : public pkgPackageManager
  18. {
  19. protected:
  20. // used for progress reporting
  21. struct DpkgState
  22. {
  23. const char *state; // the dpkg state (e.g. "unpack")
  24. const char *str; // the human readable translation of the state
  25. };
  26. struct Item
  27. {
  28. enum Ops {Install, Configure, Remove, Purge} Op;
  29. string File;
  30. PkgIterator Pkg;
  31. Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
  32. File(File), Pkg(Pkg) {};
  33. Item() {};
  34. };
  35. vector<Item> List;
  36. // Helpers
  37. bool RunScripts(const char *Cnf);
  38. bool RunScriptsWithPkgs(const char *Cnf);
  39. bool SendV2Pkgs(FILE *F);
  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