]>
git.saurik.com Git - apt.git/blob - apt-pkg/packagemanager.h
1 // -*- mode: cpp; mode: fold -*-
3 /* ######################################################################
5 Package Manager - Abstacts the package manager
8 - Aquiration of archives (stores the list of final file names)
9 - Sorting of operations
10 - Invokation of package manager
12 This is the final stage when the package cache entities get converted
13 into file names and the state stored in a DepCache is transformed
14 into a series of operations.
16 In the final scheme of things this may serve as a director class to
17 access the actual install methods based on the file type being
20 ##################################################################### */
22 #ifndef PKGLIB_PACKAGEMANAGER_H
23 #define PKGLIB_PACKAGEMANAGER_H
25 #include <apt-pkg/pkgcache.h>
26 #include <apt-pkg/init.h>
27 #include <apt-pkg/edsp.h>
28 #include <apt-pkg/macros.h>
33 #ifndef APT_10_CLEANER_HEADERS
34 #include <apt-pkg/install-progress.h>
37 #ifndef APT_8_CLEANER_HEADERS
38 #include <apt-pkg/depcache.h>
48 class pkgPackageManager
;
55 class pkgPackageManager
: protected pkgCache::Namespace
59 enum OrderResult
{Completed
,Failed
,Incomplete
};
60 static bool SigINTStop
;
63 std::string
*FileNames
;
70 /** \brief saves packages dpkg let disappear
72 This way APT can retreat from trying to configure these
73 packages later on and a front-end can choose to display a
74 notice to inform the user about these disappears.
76 std::set
<std::string
> disappearedPkgs
;
78 void ImmediateAdd(PkgIterator P
, bool UseInstallVer
, unsigned const int &Depth
= 0);
79 virtual OrderResult
OrderInstall();
80 bool CheckRConflicts(PkgIterator Pkg
,DepIterator Dep
,const char *Ver
);
81 bool CheckRBreaks(PkgIterator
const &Pkg
,DepIterator Dep
,const char * const Ver
);
82 bool CreateOrderList();
85 bool DepAlwaysTrue(DepIterator D
) APT_PURE
;
89 bool SmartConfigure(PkgIterator Pkg
, int const Depth
) APT_MUSTCHECK
;
90 //FIXME: merge on abi break
91 bool SmartUnPack(PkgIterator Pkg
) APT_MUSTCHECK
;
92 bool SmartUnPack(PkgIterator Pkg
, bool const Immediate
, int const Depth
) APT_MUSTCHECK
;
93 bool SmartRemove(PkgIterator Pkg
) APT_MUSTCHECK
;
94 bool EarlyRemove(PkgIterator Pkg
, DepIterator
const * const Dep
) APT_MUSTCHECK
;
95 APT_DEPRECATED
bool EarlyRemove(PkgIterator Pkg
) APT_MUSTCHECK
;
97 // The Actual installation implementation
98 virtual bool Install(PkgIterator
/*Pkg*/,std::string
/*File*/) {return false;};
99 virtual bool Configure(PkgIterator
/*Pkg*/) {return false;};
100 virtual bool Remove(PkgIterator
/*Pkg*/,bool /*Purge*/=false) {return false;};
101 virtual bool Go(APT::Progress::PackageManager
* /*progress*/) {return true;};
102 virtual bool Go(int /*statusFd*/=-1) {return true;};
104 virtual void Reset() {};
106 // the result of the operation
111 // Main action members
112 bool GetArchives(pkgAcquire
*Owner
,pkgSourceList
*Sources
,
115 // Do the installation
116 OrderResult
DoInstall(APT::Progress::PackageManager
*progress
);
118 APT_DEPRECATED_MSG("Use APT::Progress::PackageManager subclass instead of fd") OrderResult
DoInstall(int statusFd
=-1);
120 friend bool EIPP::OrderInstall(char const * const planer
, pkgPackageManager
* const PM
,
121 unsigned int const version
, OpProgress
* const Progress
);
122 friend bool EIPP::ReadResponse(int const input
, pkgPackageManager
* const PM
,
123 OpProgress
* const Progress
);
125 // stuff that needs to be done before the fork() of a library that
127 OrderResult
DoInstallPreFork() {
128 Res
= OrderInstall();
131 // stuff that needs to be done after the fork
132 OrderResult
DoInstallPostFork(APT::Progress::PackageManager
*progress
);
134 APT_DEPRECATED_MSG("Use APT::Progress::PackageManager subclass instead of fd") OrderResult
DoInstallPostFork(int statusFd
=-1);
139 /** \brief returns all packages dpkg let disappear */
140 inline std::set
<std::string
> GetDisappearedPackages() { return disappearedPkgs
; };
142 explicit pkgPackageManager(pkgDepCache
*Cache
);
143 virtual ~pkgPackageManager();
147 enum APT_HIDDEN SmartAction
{ UNPACK_IMMEDIATE
, UNPACK
, CONFIGURE
};
148 APT_HIDDEN
bool NonLoopingSmart(SmartAction
const action
, pkgCache::PkgIterator
&Pkg
,
149 pkgCache::PkgIterator DepPkg
, int const Depth
, bool const PkgLoop
,
150 bool * const Bad
, bool * const Changed
) APT_MUSTCHECK
;