|
apt @VERSION@
|
00001 // -*- mode: cpp; mode: fold -*- 00002 // Description /*{{{*/ 00003 // $Id: dpkgpm.h,v 1.8 2001/05/07 05:05:13 jgg Exp $ 00004 /* ###################################################################### 00005 00006 DPKG Package Manager - Provide an interface to dpkg 00007 00008 ##################################################################### */ 00009 /*}}}*/ 00010 #ifndef PKGLIB_DPKGPM_H 00011 #define PKGLIB_DPKGPM_H 00012 00013 #include <apt-pkg/packagemanager.h> 00014 #include <vector> 00015 #include <map> 00016 #include <stdio.h> 00017 00018 class pkgDPkgPMPrivate; 00019 00020 class pkgDPkgPM : public pkgPackageManager 00021 { 00022 private: 00023 pkgDPkgPMPrivate *d; 00024 00038 void handleDisappearAction(std::string const &pkgname); 00039 00040 protected: 00041 int pkgFailures; 00042 00043 // progress reporting 00044 struct DpkgState 00045 { 00046 const char *state; // the dpkg state (e.g. "unpack") 00047 const char *str; // the human readable translation of the state 00048 }; 00049 00050 // the dpkg states that the pkg will run through, the string is 00051 // the package, the vector contains the dpkg states that the package 00052 // will go through 00053 std::map<std::string,std::vector<struct DpkgState> > PackageOps; 00054 // the dpkg states that are already done; the string is the package 00055 // the int is the state that is already done (e.g. a package that is 00056 // going to be install is already in state "half-installed") 00057 std::map<std::string,unsigned int> PackageOpsDone; 00058 00059 // progress reporting 00060 unsigned int PackagesDone; 00061 unsigned int PackagesTotal; 00062 00063 struct Item 00064 { 00065 enum Ops {Install, Configure, Remove, Purge, ConfigurePending, TriggersPending} Op; 00066 std::string File; 00067 PkgIterator Pkg; 00068 Item(Ops Op,PkgIterator Pkg,std::string File = "") : Op(Op), 00069 File(File), Pkg(Pkg) {}; 00070 Item() {}; 00071 00072 }; 00073 std::vector<Item> List; 00074 00075 // Helpers 00076 bool RunScriptsWithPkgs(const char *Cnf); 00077 bool SendV2Pkgs(FILE *F); 00078 void WriteHistoryTag(std::string const &tag, std::string value); 00079 00080 // apport integration 00081 void WriteApportReport(const char *pkgpath, const char *errormsg); 00082 00083 // dpkg log 00084 bool OpenLog(); 00085 bool CloseLog(); 00086 00087 // input processing 00088 void DoStdin(int master); 00089 void DoTerminalPty(int master); 00090 void DoDpkgStatusFd(int statusfd, int OutStatusFd); 00091 void ProcessDpkgStatusLine(int OutStatusFd, char *line); 00092 00093 // The Actuall installation implementation 00094 virtual bool Install(PkgIterator Pkg,std::string File); 00095 virtual bool Configure(PkgIterator Pkg); 00096 virtual bool Remove(PkgIterator Pkg,bool Purge = false); 00097 virtual bool Go(int StatusFd=-1); 00098 virtual void Reset(); 00099 00100 public: 00101 00102 pkgDPkgPM(pkgDepCache *Cache); 00103 virtual ~pkgDPkgPM(); 00104 }; 00105 00106 void SigINT(int sig); 00107 00108 #endif
1.7.4