]>
Commit | Line | Data |
---|---|---|
03e39e59 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
233b185f | 3 | // $Id: dpkgpm.h,v 1.8 2001/05/07 05:05:13 jgg Exp $ |
03e39e59 AL |
4 | /* ###################################################################### |
5 | ||
6 | DPKG Package Manager - Provide an interface to dpkg | |
7 | ||
8 | ##################################################################### */ | |
9 | /*}}}*/ | |
03e39e59 AL |
10 | #ifndef PKGLIB_DPKGPM_H |
11 | #define PKGLIB_DPKGPM_H | |
12 | ||
03e39e59 AL |
13 | #include <apt-pkg/packagemanager.h> |
14 | #include <vector> | |
b2e465d6 | 15 | #include <stdio.h> |
03e39e59 | 16 | |
233b185f AL |
17 | using std::vector; |
18 | ||
03e39e59 AL |
19 | class pkgDPkgPM : public pkgPackageManager |
20 | { | |
6191b008 MV |
21 | private: |
22 | int dpkgbuf_pos; | |
23 | char dpkgbuf[1024]; | |
24 | ||
03e39e59 | 25 | protected: |
2a7e07c7 MV |
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 | }; | |
03e39e59 AL |
33 | |
34 | struct Item | |
35 | { | |
fc4b5c9f | 36 | enum Ops {Install, Configure, Remove, Purge} Op; |
03e39e59 AL |
37 | string File; |
38 | PkgIterator Pkg; | |
b2e465d6 | 39 | Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op), |
03e39e59 AL |
40 | File(File), Pkg(Pkg) {}; |
41 | Item() {}; | |
42 | ||
43 | }; | |
44 | vector<Item> List; | |
6dd55be7 AL |
45 | |
46 | // Helpers | |
47 | bool RunScripts(const char *Cnf); | |
db0c350f | 48 | bool RunScriptsWithPkgs(const char *Cnf); |
b2e465d6 | 49 | bool SendV2Pkgs(FILE *F); |
afb1e2e3 | 50 | |
ceabc520 MV |
51 | // input processing |
52 | void DoStdin(int master); | |
53 | void DoTerminalPty(int master, FILE *out); | |
6191b008 MV |
54 | void DoDpkgStatusFd(int statusfd); |
55 | void ProcessDpkgStatusLine(char *line); | |
56 | ||
ceabc520 | 57 | |
03e39e59 AL |
58 | // The Actuall installation implementation |
59 | virtual bool Install(PkgIterator Pkg,string File); | |
60 | virtual bool Configure(PkgIterator Pkg); | |
fc4b5c9f | 61 | virtual bool Remove(PkgIterator Pkg,bool Purge = false); |
2a7e07c7 | 62 | virtual bool Go(int StatusFd=-1); |
281daf46 | 63 | virtual void Reset(); |
03e39e59 AL |
64 | |
65 | public: | |
66 | ||
b2e465d6 | 67 | pkgDPkgPM(pkgDepCache *Cache); |
03e39e59 AL |
68 | virtual ~pkgDPkgPM(); |
69 | }; | |
70 | ||
71 | #endif |