1 // -*- mode: cpp; mode: fold -*-
3 // $Id: packagemanager.h,v 1.14 2001/05/07 04:24:08 jgg Exp $
4 /* ######################################################################
6 Package Manager - Abstacts the package manager
9 - Aquiration of archives (stores the list of final file names)
10 - Sorting of operations
11 - Invokation of package manager
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.
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
21 ##################################################################### */
23 #ifndef PKGLIB_PACKAGEMANAGER_H
24 #define PKGLIB_PACKAGEMANAGER_H
26 #include <apt-pkg/pkgcache.h>
27 #include <apt-pkg/init.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>
49 class pkgPackageManager
: protected pkgCache::Namespace
53 enum OrderResult
{Completed
,Failed
,Incomplete
};
54 static bool SigINTStop
;
57 std::string
*FileNames
;
64 /** \brief saves packages dpkg let disappear
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.
70 std::set
<std::string
> disappearedPkgs
;
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();
78 bool DepAlwaysTrue(DepIterator D
);
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
);
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;};
96 virtual bool Go(int /*statusFd*/=-1) {return true;};
99 virtual void Reset() {};
101 // the result of the operation
106 // Main action members
107 bool GetArchives(pkgAcquire
*Owner
,pkgSourceList
*Sources
,
110 // Do the installation
111 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
112 OrderResult
DoInstall(APT::Progress::PackageManager
*progress
);
114 APT_DEPRECATED OrderResult
DoInstall(int statusFd
=-1);
116 OrderResult
DoInstall(int statusFd
=-1);
119 // stuff that needs to be done before the fork() of a library that
121 OrderResult
DoInstallPreFork() {
122 Res
= OrderInstall();
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
);
129 APT_DEPRECATED OrderResult
DoInstallPostFork(int statusFd
=-1);
131 OrderResult
DoInstallPostFork(int statusFd
=-1);
137 /** \brief returns all packages dpkg let disappear */
138 inline std::set
<std::string
> GetDisappearedPackages() { return disappearedPkgs
; };
140 pkgPackageManager(pkgDepCache
*Cache
);
141 virtual ~pkgPackageManager();