]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode: cpp; mode: fold -*- | |
2 | // Description /*{{{*/ | |
3 | // $Id: packagemanager.h,v 1.14 2001/05/07 04:24:08 jgg Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | Package Manager - Abstacts the package manager | |
7 | ||
8 | Three steps are | |
9 | - Aquiration of archives (stores the list of final file names) | |
10 | - Sorting of operations | |
11 | - Invokation of package manager | |
12 | ||
13 | This is the final stage when the package cache entities get converted | |
14 | into file names and the state stored in a DepCache is transformed | |
15 | into a series of operations. | |
16 | ||
17 | In the final scheme of things this may serve as a director class to | |
18 | access the actual install methods based on the file type being | |
19 | installed. | |
20 | ||
21 | ##################################################################### */ | |
22 | /*}}}*/ | |
23 | #ifndef PKGLIB_PACKAGEMANAGER_H | |
24 | #define PKGLIB_PACKAGEMANAGER_H | |
25 | ||
26 | #include <apt-pkg/pkgcache.h> | |
27 | ||
28 | #include <string> | |
29 | #include <iostream> | |
30 | #include <set> | |
31 | ||
32 | class pkgAcquire; | |
33 | class pkgDepCache; | |
34 | class pkgSourceList; | |
35 | class pkgOrderList; | |
36 | class pkgRecords; | |
37 | class pkgPackageManager : protected pkgCache::Namespace | |
38 | { | |
39 | public: | |
40 | ||
41 | enum OrderResult {Completed,Failed,Incomplete}; | |
42 | static bool SigINTStop; | |
43 | ||
44 | protected: | |
45 | std::string *FileNames; | |
46 | pkgDepCache &Cache; | |
47 | pkgOrderList *List; | |
48 | bool Debug; | |
49 | bool NoImmConfigure; | |
50 | bool ImmConfigureAll; | |
51 | ||
52 | /** \brief saves packages dpkg let disappear | |
53 | ||
54 | This way APT can retreat from trying to configure these | |
55 | packages later on and a frontend can choose to display a | |
56 | notice to inform the user about these disappears. | |
57 | */ | |
58 | std::set<std::string> disappearedPkgs; | |
59 | ||
60 | void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0); | |
61 | virtual OrderResult OrderInstall(); | |
62 | bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver); | |
63 | bool CreateOrderList(); | |
64 | ||
65 | // Analysis helpers | |
66 | bool DepAlwaysTrue(DepIterator D); | |
67 | ||
68 | // Install helpers | |
69 | bool ConfigureAll(); | |
70 | bool SmartConfigure(PkgIterator Pkg, int const Depth); | |
71 | //FIXME: merge on abi break | |
72 | bool SmartUnPack(PkgIterator Pkg); | |
73 | bool SmartUnPack(PkgIterator Pkg, bool const Immediate, int const Depth); | |
74 | bool SmartRemove(PkgIterator Pkg); | |
75 | bool EarlyRemove(PkgIterator Pkg); | |
76 | ||
77 | // The Actual installation implementation | |
78 | virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;}; | |
79 | virtual bool Configure(PkgIterator /*Pkg*/) {return false;}; | |
80 | virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;}; | |
81 | virtual bool Go(int statusFd=-1) {return true;}; | |
82 | virtual void Reset() {}; | |
83 | ||
84 | // the result of the operation | |
85 | OrderResult Res; | |
86 | ||
87 | public: | |
88 | ||
89 | // Main action members | |
90 | bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, | |
91 | pkgRecords *Recs); | |
92 | ||
93 | // Do the installation | |
94 | OrderResult DoInstall(int statusFd=-1); | |
95 | ||
96 | // stuff that needs to be done before the fork() of a library that | |
97 | // uses apt | |
98 | OrderResult DoInstallPreFork() { | |
99 | Res = OrderInstall(); | |
100 | return Res; | |
101 | }; | |
102 | ||
103 | // stuff that needs to be done after the fork | |
104 | OrderResult DoInstallPostFork(int statusFd=-1); | |
105 | bool FixMissing(); | |
106 | ||
107 | /** \brief returns all packages dpkg let disappear */ | |
108 | inline std::set<std::string> GetDisappearedPackages() { return disappearedPkgs; }; | |
109 | ||
110 | pkgPackageManager(pkgDepCache *Cache); | |
111 | virtual ~pkgPackageManager(); | |
112 | }; | |
113 | ||
114 | #endif |