apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

packagemanager.h
Go to the documentation of this file.
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4 
5  Package Manager - Abstacts the package manager
6 
7  Three steps are
8  - Aquiration of archives (stores the list of final file names)
9  - Sorting of operations
10  - Invocation of package manager
11 
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.
15 
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
18  installed.
19 
20  ##################################################################### */
21  /*}}}*/
22 #ifndef PKGLIB_PACKAGEMANAGER_H
23 #define PKGLIB_PACKAGEMANAGER_H
24 
25 #include <apt-pkg/edsp.h>
26 #include <apt-pkg/init.h>
27 #include <apt-pkg/macros.h>
28 #include <apt-pkg/pkgcache.h>
29 
30 #include <set>
31 #include <string>
32 
33 
34 class pkgAcquire;
35 class pkgDepCache;
36 class pkgSourceList;
37 class pkgOrderList;
38 class pkgRecords;
39 class OpProgress;
40 class pkgPackageManager;
41 namespace APT {
42  namespace Progress {
43  class PackageManager;
44  }
45 }
46 
48 {
49  public:
50 
51  enum OrderResult {Completed,Failed,Incomplete};
52  static bool SigINTStop;
53 
54  protected:
55  std::string *FileNames;
58  bool Debug;
61 
62  /** \brief saves packages dpkg let disappear
63 
64  This way APT can retreat from trying to configure these
65  packages later on and a front-end can choose to display a
66  notice to inform the user about these disappears.
67  */
68  std::set<std::string> disappearedPkgs;
69 
70  void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0);
71  virtual OrderResult OrderInstall();
72  bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
73  bool CheckRBreaks(PkgIterator const &Pkg,DepIterator Dep,const char * const Ver);
74  bool CreateOrderList();
75 
76  // Analysis helpers
77  bool DepAlwaysTrue(DepIterator D) APT_PURE;
78 
79  // Install helpers
80  bool ConfigureAll();
81  bool SmartConfigure(PkgIterator Pkg, int const Depth) APT_MUSTCHECK;
82  bool SmartUnPack(PkgIterator Pkg, bool const Immediate = true, int const Depth = 0) APT_MUSTCHECK;
83  bool SmartRemove(PkgIterator Pkg) APT_MUSTCHECK;
84  bool EarlyRemove(PkgIterator Pkg, DepIterator const * const Dep) APT_MUSTCHECK;
85 
86  // The Actual installation implementation
87  virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;};
88  virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
89  virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
90  virtual bool Go(APT::Progress::PackageManager * /*progress*/) {return true;};
91 
92  virtual void Reset() {};
93 
94  // the result of the operation
96 
97  public:
98 
99  // Main action members
100  bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
101  pkgRecords *Recs);
102 
103  // Do the installation
105 
106  friend bool EIPP::OrderInstall(char const * const planner, pkgPackageManager * const PM,
107  unsigned int const version, OpProgress * const Progress);
108  friend bool EIPP::ReadResponse(int const input, pkgPackageManager * const PM,
109  OpProgress * const Progress);
110 
111  // stuff that needs to be done before the fork() of a library that
112  // uses apt
114  Res = OrderInstall();
115  return Res;
116  };
117  // stuff that needs to be done after the fork
118  OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress);
119  // compat
120 
121  // ?
122  bool FixMissing();
123 
124  /** \brief returns all packages dpkg let disappear */
125  inline std::set<std::string> GetDisappearedPackages() { return disappearedPkgs; };
126 
127  explicit pkgPackageManager(pkgDepCache *Cache);
128  virtual ~~pkgPackageManager();
129 
130  private:
131  void * const d;
132  enum APT_HIDDEN SmartAction { UNPACK_IMMEDIATE, UNPACK, CONFIGURE };
133  APT_HIDDEN bool NonLoopingSmart(SmartAction const action, pkgCache::PkgIterator &Pkg,
134  pkgCache::PkgIterator DepPkg, int const Depth, bool const PkgLoop,
135  bool * const Bad, bool * const Changed) APT_MUSTCHECK;
136 };
137 
138 #endif
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition: acquire-item.h:59
pkgCache::PkgIterator PkgIterator
Definition: pkgcache.h:829
pkgCache::DepIterator DepIterator
Definition: pkgcache.h:832
std::set< std::string > disappearedPkgs
saves packages dpkg let disappear
std::string * FileNames
virtual void Reset()
pkgDepCache & Cache
virtual bool Configure(PkgIterator)
virtual bool Remove(PkgIterator, bool=false)
static bool SigINTStop
pkgOrderList * List
virtual bool Go(APT::Progress::PackageManager *)
std::set< std::string > GetDisappearedPackages()
returns all packages dpkg let disappear
OrderResult DoInstallPreFork()
#define APT_MUSTCHECK
Definition: macros.h:68
#define APT_PURE
Definition: macros.h:56
#define APT_PUBLIC
Definition: macros.h:77
#define APT_HIDDEN
Definition: macros.h:78
APT_HIDDEN bool ReadResponse(int const input, pkgPackageManager *const PM, OpProgress *const Progress)
Definition: edsp.cc:1005
APT_HIDDEN bool OrderInstall(char const *const planner, pkgPackageManager *const PM, unsigned int const version, OpProgress *const Progress)
Definition: edsp.cc:785
UNPACK_IMMEDIATE
UNPACK
pkgCache - Structure definitions for the cache file
bool DoInstall(CommandLine &CmdL)