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/macros.h>
32 #ifndef APT_10_CLEANER_HEADERS
33 #include <apt-pkg/install-progress.h>
36 #ifndef APT_8_CLEANER_HEADERS
37 #include <apt-pkg/depcache.h>
53 class pkgPackageManager
: protected pkgCache::Namespace
57 enum OrderResult
{Completed
,Failed
,Incomplete
};
58 static bool SigINTStop
;
61 std::string
*FileNames
;
68 /** \brief saves packages dpkg let disappear
70 This way APT can retreat from trying to configure these
71 packages later on and a frontend can choose to display a
72 notice to inform the user about these disappears.
74 std::set
<std::string
> disappearedPkgs
;
76 void ImmediateAdd(PkgIterator P
, bool UseInstallVer
, unsigned const int &Depth
= 0);
77 virtual OrderResult
OrderInstall();
78 bool CheckRConflicts(PkgIterator Pkg
,DepIterator Dep
,const char *Ver
);
79 bool CreateOrderList();
82 bool DepAlwaysTrue(DepIterator D
) APT_PURE
;
86 bool SmartConfigure(PkgIterator Pkg
, int const Depth
) APT_MUSTCHECK
;
87 //FIXME: merge on abi break
88 bool SmartUnPack(PkgIterator Pkg
) APT_MUSTCHECK
;
89 bool SmartUnPack(PkgIterator Pkg
, bool const Immediate
, int const Depth
) APT_MUSTCHECK
;
90 bool SmartRemove(PkgIterator Pkg
) APT_MUSTCHECK
;
91 bool EarlyRemove(PkgIterator Pkg
, DepIterator
const * const Dep
) APT_MUSTCHECK
;
92 APT_DEPRECATED
bool EarlyRemove(PkgIterator Pkg
) APT_MUSTCHECK
;
94 // The Actual installation implementation
95 virtual bool Install(PkgIterator
/*Pkg*/,std::string
/*File*/) {return false;};
96 virtual bool Configure(PkgIterator
/*Pkg*/) {return false;};
97 virtual bool Remove(PkgIterator
/*Pkg*/,bool /*Purge*/=false) {return false;};
98 #if APT_PKG_ABI >= 413
99 virtual bool Go(APT::Progress::PackageManager
* /*progress*/) {return true;};
101 virtual bool Go(int /*statusFd*/=-1) {return true;};
103 virtual void Reset() {};
105 // the result of the operation
110 // Main action members
111 bool GetArchives(pkgAcquire
*Owner
,pkgSourceList
*Sources
,
114 // Do the installation
115 #if APT_PKG_ABI >= 413
116 OrderResult
DoInstall(APT::Progress::PackageManager
*progress
);
118 APT_DEPRECATED OrderResult
DoInstall(int statusFd
=-1);
120 OrderResult
DoInstall(int statusFd
=-1);
123 // stuff that needs to be done before the fork() of a library that
125 OrderResult
DoInstallPreFork() {
126 Res
= OrderInstall();
129 #if APT_PKG_ABI >= 413
130 // stuff that needs to be done after the fork
131 OrderResult
DoInstallPostFork(APT::Progress::PackageManager
*progress
);
133 APT_DEPRECATED OrderResult
DoInstallPostFork(int statusFd
=-1);
135 OrderResult
DoInstallPostFork(int statusFd
=-1);
141 /** \brief returns all packages dpkg let disappear */
142 inline std::set
<std::string
> GetDisappearedPackages() { return disappearedPkgs
; };
144 pkgPackageManager(pkgDepCache
*Cache
);
145 virtual ~pkgPackageManager();
149 enum APT_HIDDEN SmartAction
{ UNPACK_IMMEDIATE
, UNPACK
, CONFIGURE
};
150 APT_HIDDEN
bool NonLoopingSmart(SmartAction
const action
, pkgCache::PkgIterator
&Pkg
,
151 pkgCache::PkgIterator DepPkg
, int const Depth
, bool const PkgLoop
,
152 bool * const Bad
, bool * const Changed
) APT_MUSTCHECK
;