LibPkg
pkgbase.h
Go to the documentation of this file.
1 // This file is part of LibPkg.
2 // Copyright � 2003-2005 Graham Shaw.
3 // Distribution and use are subject to the GNU Lesser General Public License,
4 // a copy of which may be found in the file !LibPkg.Copyright.
5 
6 #ifndef LIBPKG_PKGBASE
7 #define LIBPKG_PKGBASE
8 
9 #include <string>
10 
11 #include "libpkg/dependency.h"
12 #include "libpkg/status_table.h"
14 #include "libpkg/source_table.h"
15 #include "libpkg/env_checker.h"
16 #include "libpkg/path_table.h"
18 
19 namespace pkg {
20 
21 using std::string;
22 
24 class pkgbase
25 {
26 public:
27  class cache_error;
28 private:
30  string _pathname;
31 
33  string _dpathname;
34 
36  string _cpathname;
37 
39  status_table _curstat;
40 
42  status_table _selstat;
43 
45  status_table _prevstat;
46 
48  env_checker_ptr _env_checker_ptr;
49 
51  binary_control_table _control;
52 
54  source_table _sources;
55 
57  env_packages_table *_env_packages;
58 
60  path_table _paths;
61 
69  bool _changed;
70 public:
76  pkgbase(const string& pathname,const string& dpathname,
77  const string& cpathname);
78 
80  ~pkgbase();
81 
86  { return _curstat; }
87 
92  { return _selstat; }
93 
100  { return _prevstat; }
101 
106  { return _control; }
107 
112  { return _sources; }
113 
120 
125  { return _paths; }
126 
131  string list_pathname(const string& url);
132 
136  string available_pathname();
137 
144  string cache_pathname(const string& pkgname,
145  const string& pkgvrsn,
146  const string& pkgenvid);
147 
152  string info_pathname(const string& pkgname);
153 
157  string sysvars_pathname();
158 
162  string sprites_pathname();
163 
167  string setvars_pathname();
168 
173  string bootsprites_pathname();
174 
178  string component_update_pathname();
179 
187  void verify_cached_file(const binary_control& ctrl);
188 
197  bool fix_dependencies(const std::set<string>& seed);
198 
201  void remove_auto();
202 private:
212  bool fix_dependencies(const pkg::control& ctrl,bool allow_new);
213 
223  bool fix_dependencies(const pkg::control& ctrl,bool allow_new,
224  bool apply);
225 
238  const pkg::control* resolve(const std::vector<dependency>& deps,
239  bool allow_new=true);
240 
251  const pkg::control* resolve(const dependency& dep,
252  bool allow_new=true);
253 
259  void ensure_removed(const string& pkgname);
260 
268  void ensure_installed(const string& pkgname,const string& pkgvrsn,const string &pkgenv);
269 
274  bool update_status_table(status_table &update_table);
275 };
276 
279  public std::runtime_error
280 {
281 public:
286  cache_error(const char* message,const binary_control& ctrl);
287 };
288 
289 }; /* namespace pkg */
290 
291 #endif
An exception class for reporting cache errors.
Definition: pkgbase.h:278
void verify_cached_file(const binary_control &ctrl)
Verify file in cache.
Definition: pkgbase.cc:150
status_table & prevstat()
Get previous status table.
Definition: pkgbase.h:99
string available_pathname()
Get pathname for available list file.
Definition: pkgbase.cc:120
string info_pathname(const string &pkgname)
Get pathname for info directory of package.
Definition: pkgbase.cc:74
The namespace used to hold the package management library.
Definition: auto_dir.cc:12
A class that filters the binary control table to create a list of the packages available in the curre...
Definition: env_packages_table.h:23
binary_control_table & control()
Get binary control table.
Definition: pkgbase.h:105
A class to represent a package dependency.
Definition: dependency.h:24
string sysvars_pathname()
Get pathname for sysvars directory.
Definition: pkgbase.cc:125
~pkgbase()
Destroy pkgbase object.
Definition: pkgbase.cc:47
bool fix_dependencies(const std::set< string > &seed)
Fix dependencies.
Definition: pkgbase.cc:191
string sprites_pathname()
Get pathname for sprites directory.
Definition: pkgbase.cc:130
string setvars_pathname()
Get pathname for setvars file.
Definition: pkgbase.cc:135
status_table & selstat()
Get selected status table.
Definition: pkgbase.h:91
A class to represent the content of a RiscPkg control file.
Definition: control.h:24
void remove_auto()
Remove redundant auto-installed packages.
Definition: pkgbase.cc:329
string list_pathname(const string &url)
Get pathname for index file from given source.
Definition: pkgbase.cc:79
env_packages_table & env_packages()
Get environment packages table which contains the package names of packages suitable for the current ...
Definition: pkgbase.cc:52
A class for holding a list of source URLs.
Definition: source_table.h:26
string bootsprites_pathname()
Get pathname for sprites file.
Definition: pkgbase.cc:140
A class for mapping package name and version to binary control record.
Definition: binary_control_table.h:21
A class for representing the collection of package database tables.
Definition: pkgbase.h:24
status_table & curstat()
Get current status table.
Definition: pkgbase.h:85
Class to help manage the single env_checker instance.
Definition: env_checker.h:130
A class for mapping package name to package status.
Definition: status_table.h:20
source_table & sources()
Get source table.
Definition: pkgbase.h:111
string cache_pathname(const string &pkgname, const string &pkgvrsn, const string &pkgenvid)
Get pathname for package in cache.
Definition: pkgbase.cc:63
path_table & paths()
Get path table.
Definition: pkgbase.h:124
A class to represent the content of a RiscPkg binary control file.
Definition: binary_control.h:24
pkgbase(const string &pathname, const string &dpathname, const string &cpathname)
Create pkgbase object.
Definition: pkgbase.cc:24
string component_update_pathname()
Get pathname for component update file.
Definition: pkgbase.cc:145
A class for mapping source paths to destination paths.
Definition: path_table.h:24

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)