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