]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/dpkgpm.h
merge with my debian-sid branch
[apt.git] / apt-pkg / deb / dpkgpm.h
CommitLineData
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>
09fa2df2 15#include <map>
b2e465d6 16#include <stdio.h>
03e39e59 17
697a1d8a 18class pkgDPkgPMPrivate;
233b185f 19
03e39e59
AL
20class pkgDPkgPM : public pkgPackageManager
21{
6191b008 22 private:
697a1d8a 23 pkgDPkgPMPrivate *d;
9169c871 24
eb6f9bac
DK
25 /** \brief record the disappear action and handle accordingly
26
27 dpkg let packages disappear then they have no files any longer and
28 nothing depends on them. We need to collect this as dpkg as well as
29 APT doesn't know beforehand that the package will disappear, so the
30 only possible option is to tell the user afterwards about it.
31 To enhance the experience we also try to forward the auto-install
32 flag so the disappear-causer(s) are not autoremoved next time -
33 for the transfer to happen the disappeared version needs to depend
34 on the package the flag should be forwarded to and this package
35 needs to declare a Replaces on the disappeared package.
36 \param pkgname Name of the package that disappeared
37 */
8f3ba4e8 38 void handleDisappearAction(std::string const &pkgname);
eb6f9bac 39
ff56e980 40 protected:
5e457a93 41 int pkgFailures;
ff56e980 42
09fa2df2 43 // progress reporting
2a7e07c7
MV
44 struct DpkgState
45 {
46 const char *state; // the dpkg state (e.g. "unpack")
47 const char *str; // the human readable translation of the state
48 };
09fa2df2
MV
49
50 // the dpkg states that the pkg will run through, the string is
51 // the package, the vector contains the dpkg states that the package
52 // will go through
8f3ba4e8 53 std::map<std::string,std::vector<struct DpkgState> > PackageOps;
09fa2df2
MV
54 // the dpkg states that are already done; the string is the package
55 // the int is the state that is already done (e.g. a package that is
56 // going to be install is already in state "half-installed")
8f3ba4e8 57 std::map<std::string,unsigned int> PackageOpsDone;
73e0ee1e 58
09fa2df2 59 // progress reporting
4b7c5a3f
MV
60 unsigned int PackagesDone;
61 unsigned int PackagesTotal;
09fa2df2 62
03e39e59
AL
63 struct Item
64 {
5e312de7 65 enum Ops {Install, Configure, Remove, Purge, ConfigurePending, TriggersPending} Op;
8f3ba4e8 66 std::string File;
03e39e59 67 PkgIterator Pkg;
8f3ba4e8 68 Item(Ops Op,PkgIterator Pkg,std::string File = "") : Op(Op),
03e39e59
AL
69 File(File), Pkg(Pkg) {};
70 Item() {};
71
72 };
8f3ba4e8 73 std::vector<Item> List;
6dd55be7
AL
74
75 // Helpers
db0c350f 76 bool RunScriptsWithPkgs(const char *Cnf);
b2e465d6 77 bool SendV2Pkgs(FILE *F);
8f3ba4e8 78 void WriteHistoryTag(std::string const &tag, std::string value);
afb1e2e3 79
5e457a93
MV
80 // apport integration
81 void WriteApportReport(const char *pkgpath, const char *errormsg);
82
2e1715ea
MV
83 // dpkg log
84 bool OpenLog();
85 bool CloseLog();
86
ceabc520
MV
87 // input processing
88 void DoStdin(int master);
1ba38171 89 void DoTerminalPty(int master);
09fa2df2
MV
90 void DoDpkgStatusFd(int statusfd, int OutStatusFd);
91 void ProcessDpkgStatusLine(int OutStatusFd, char *line);
6191b008 92
03e39e59 93 // The Actuall installation implementation
8f3ba4e8 94 virtual bool Install(PkgIterator Pkg,std::string File);
03e39e59 95 virtual bool Configure(PkgIterator Pkg);
fc4b5c9f 96 virtual bool Remove(PkgIterator Pkg,bool Purge = false);
2a7e07c7 97 virtual bool Go(int StatusFd=-1);
281daf46 98 virtual void Reset();
03e39e59
AL
99
100 public:
101
b2e465d6 102 pkgDPkgPM(pkgDepCache *Cache);
03e39e59
AL
103 virtual ~pkgDPkgPM();
104};
105
590f1923
CB
106void SigINT(int sig);
107
03e39e59 108#endif