00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PKGLIB_PACKAGEMANAGER_H
00024 #define PKGLIB_PACKAGEMANAGER_H
00025
00026
00027 #include <string>
00028 #include <iostream>
00029 #include <apt-pkg/pkgcache.h>
00030 #include <apt-pkg/depcache.h>
00031 #include <set>
00032
00033 using std::string;
00034
00035 class pkgAcquire;
00036 class pkgDepCache;
00037 class pkgSourceList;
00038 class pkgOrderList;
00039 class pkgRecords;
00040 class pkgPackageManager : protected pkgCache::Namespace
00041 {
00042 public:
00043
00044 enum OrderResult {Completed,Failed,Incomplete};
00045
00046 protected:
00047 string *FileNames;
00048 pkgDepCache &Cache;
00049 pkgOrderList *List;
00050 bool Debug;
00051
00058 std::set<std::string> disappearedPkgs;
00059
00060 bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
00061 void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0);
00062 virtual OrderResult OrderInstall();
00063 bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
00064 bool CreateOrderList();
00065
00066
00067 bool DepAlwaysTrue(DepIterator D);
00068
00069
00070 bool ConfigureAll();
00071 bool SmartConfigure(PkgIterator Pkg);
00072 bool SmartUnPack(PkgIterator Pkg);
00073 bool SmartRemove(PkgIterator Pkg);
00074 bool EarlyRemove(PkgIterator Pkg);
00075
00076
00077 virtual bool Install(PkgIterator ,string ) {return false;};
00078 virtual bool Configure(PkgIterator ) {return false;};
00079 virtual bool Remove(PkgIterator ,bool =false) {return false;};
00080 virtual bool Go(int statusFd=-1) {return true;};
00081 virtual void Reset() {};
00082
00083
00084 OrderResult Res;
00085
00086 public:
00087
00088
00089 bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
00090 pkgRecords *Recs);
00091
00092
00093 OrderResult DoInstall(int statusFd=-1);
00094
00095
00096
00097 OrderResult DoInstallPreFork() {
00098 Res = OrderInstall();
00099 return Res;
00100 };
00101
00102
00103 OrderResult DoInstallPostFork(int statusFd=-1);
00104 bool FixMissing();
00105
00107 inline std::set<std::string> GetDisappearedPackages() { return disappearedPkgs; };
00108
00109 pkgPackageManager(pkgDepCache *Cache);
00110 virtual ~pkgPackageManager();
00111 };
00112
00113 #endif