]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/dpkgpm.h
a1466878df827fab145b55adc888e69493e0e250
[apt.git] / apt-pkg / deb / dpkgpm.h
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 #include <apt-pkg/packagemanager.h>
14 #include <vector>
15 #include <stdio.h>
16
17 using std::vector;
18
19 class pkgDPkgPM : public pkgPackageManager
20 {
21 protected:
22
23 // used for progress reporting
24 struct DpkgState
25 {
26 const char *state; // the dpkg state (e.g. "unpack")
27 const char *str; // the human readable translation of the state
28 };
29
30 struct Item
31 {
32 enum Ops {Install, Configure, Remove, Purge} Op;
33 string File;
34 PkgIterator Pkg;
35 Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
36 File(File), Pkg(Pkg) {};
37 Item() {};
38
39 };
40 vector<Item> List;
41
42 // Helpers
43 bool RunScripts(const char *Cnf);
44 bool RunScriptsWithPkgs(const char *Cnf);
45 bool SendV2Pkgs(FILE *F);
46
47 // input processing
48 void DoStdin(int master);
49 void DoTerminalPty(int master, FILE *out);
50 // void DoDpkgStatusFd();
51
52 // The Actuall installation implementation
53 virtual bool Install(PkgIterator Pkg,string File);
54 virtual bool Configure(PkgIterator Pkg);
55 virtual bool Remove(PkgIterator Pkg,bool Purge = false);
56 virtual bool Go(int StatusFd=-1);
57 virtual void Reset();
58
59 public:
60
61 pkgDPkgPM(pkgDepCache *Cache);
62 virtual ~pkgDPkgPM();
63 };
64
65 #endif