]> git.saurik.com Git - apt.git/blob - apt-pkg/packagemanager.h
use wildcard to get files in our library makefiles
[apt.git] / apt-pkg / packagemanager.h
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 #include <apt-pkg/init.h>
28 #include <apt-pkg/macros.h>
29
30 #include <string>
31 #include <set>
32
33 #ifndef APT_10_CLEANER_HEADERS
34 #include <apt-pkg/install-progress.h>
35 #include <iostream>
36 #endif
37 #ifndef APT_8_CLEANER_HEADERS
38 #include <apt-pkg/depcache.h>
39 using std::string;
40 #endif
41
42 class pkgAcquire;
43 class pkgDepCache;
44 class pkgSourceList;
45 class pkgOrderList;
46 class pkgRecords;
47
48
49 class pkgPackageManager : protected pkgCache::Namespace
50 {
51 public:
52
53 enum OrderResult {Completed,Failed,Incomplete};
54 static bool SigINTStop;
55
56 protected:
57 std::string *FileNames;
58 pkgDepCache &Cache;
59 pkgOrderList *List;
60 bool Debug;
61 bool NoImmConfigure;
62 bool ImmConfigureAll;
63
64 /** \brief saves packages dpkg let disappear
65
66 This way APT can retreat from trying to configure these
67 packages later on and a frontend can choose to display a
68 notice to inform the user about these disappears.
69 */
70 std::set<std::string> disappearedPkgs;
71
72 void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0);
73 virtual OrderResult OrderInstall();
74 bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
75 bool CreateOrderList();
76
77 // Analysis helpers
78 bool DepAlwaysTrue(DepIterator D) APT_PURE;
79
80 // Install helpers
81 bool ConfigureAll();
82 bool SmartConfigure(PkgIterator Pkg, int const Depth);
83 //FIXME: merge on abi break
84 bool SmartUnPack(PkgIterator Pkg);
85 bool SmartUnPack(PkgIterator Pkg, bool const Immediate, int const Depth);
86 bool SmartRemove(PkgIterator Pkg);
87 bool EarlyRemove(PkgIterator Pkg);
88
89 // The Actual installation implementation
90 virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;};
91 virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
92 virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
93 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
94 virtual bool Go(APT::Progress::PackageManager * /*progress*/) {return true;};
95 #else
96 virtual bool Go(int /*statusFd*/=-1) {return true;};
97 #endif
98
99 virtual void Reset() {};
100
101 // the result of the operation
102 OrderResult Res;
103
104 public:
105
106 // Main action members
107 bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
108 pkgRecords *Recs);
109
110 // Do the installation
111 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
112 OrderResult DoInstall(APT::Progress::PackageManager *progress);
113 // compat
114 APT_DEPRECATED OrderResult DoInstall(int statusFd=-1);
115 #else
116 OrderResult DoInstall(int statusFd=-1);
117 #endif
118
119 // stuff that needs to be done before the fork() of a library that
120 // uses apt
121 OrderResult DoInstallPreFork() {
122 Res = OrderInstall();
123 return Res;
124 };
125 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
126 // stuff that needs to be done after the fork
127 OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress);
128 // compat
129 APT_DEPRECATED OrderResult DoInstallPostFork(int statusFd=-1);
130 #else
131 OrderResult DoInstallPostFork(int statusFd=-1);
132 #endif
133
134 // ?
135 bool FixMissing();
136
137 /** \brief returns all packages dpkg let disappear */
138 inline std::set<std::string> GetDisappearedPackages() { return disappearedPkgs; };
139
140 pkgPackageManager(pkgDepCache *Cache);
141 virtual ~pkgPackageManager();
142 };
143
144 #endif