]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/dpkgpm.h
apt-pkg/deb/dpkgpm.cc:
[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 // The Actuall installation implementation
48 virtual bool Install(PkgIterator Pkg,string File);
49 virtual bool Configure(PkgIterator Pkg);
50 virtual bool Remove(PkgIterator Pkg,bool Purge = false);
51 virtual bool Go(int StatusFd=-1);
52 virtual void Reset();
53
54 public:
55
56 pkgDPkgPM(pkgDepCache *Cache);
57 virtual ~pkgDPkgPM();
58 };
59
60 #endif