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/path_table.h"
16 
17 namespace pkg {
18 
19 using std::string;
20 
22 class pkgbase
23 {
24 public:
25  class cache_error;
26 private:
28  string _pathname;
29 
31  string _dpathname;
32 
34  string _cpathname;
35 
37  status_table _curstat;
38 
40  status_table _selstat;
41 
43  status_table _prevstat;
44 
46  binary_control_table _control;
47 
49  source_table _sources;
50 
52  path_table _paths;
53 
61  bool _changed;
62 public:
68  pkgbase(const string& pathname,const string& dpathname,
69  const string& cpathname);
70 
72  ~pkgbase();
73 
78  { return _curstat; }
79 
84  { return _selstat; }
85 
92  { return _prevstat; }
93 
98  { return _control; }
99 
104  { return _sources; }
105 
110  { return _paths; }
111 
116  string list_pathname(const string& url);
117 
121  string available_pathname();
122 
128  string cache_pathname(const string& pkgname,
129  const string& pkgvrsn);
130 
135  string info_pathname(const string& pkgname);
136 
140  string sysvars_pathname();
141 
145  string sprites_pathname();
146 
150  string setvars_pathname();
151 
155  string bootsprites_pathname();
156 
160  string component_update_pathname();
161 
169  void verify_cached_file(const binary_control& ctrl);
170 
179  bool fix_dependencies(const std::set<string>& seed);
180 
183  void remove_auto();
184 private:
194  bool fix_dependencies(const pkg::control& ctrl,bool allow_new);
195 
204  bool fix_dependencies(const pkg::control& ctrl,bool allow_new,
205  bool apply);
206 
219  const pkg::control* resolve(const std::vector<dependency>& deps,
220  bool allow_new=true);
221 
232  const pkg::control* resolve(const dependency& dep,
233  bool allow_new=true);
234 
240  void ensure_removed(const string& pkgname);
241 
248  void ensure_installed(const string& pkgname,const string& pkgvrsn);
249 };
250 
253  public std::runtime_error
254 {
255 public:
260  cache_error(const char* message,const binary_control& ctrl);
261 };
262 
263 }; /* namespace pkg */
264 
265 #endif
An exception class for reporting cache errors.
Definition: pkgbase.h:252
void verify_cached_file(const binary_control &ctrl)
Verify file in cache.
Definition: pkgbase.cc:127
status_table & prevstat()
Get previous status table.
Definition: pkgbase.h:91
string available_pathname()
Get pathname for available list file.
Definition: pkgbase.cc:97
string info_pathname(const string &pkgname)
Get pathname for info directory of package.
Definition: pkgbase.cc:51
binary_control_table & control()
Get binary control table.
Definition: pkgbase.h:97
string cache_pathname(const string &pkgname, const string &pkgvrsn)
Get pathname for package in cache.
Definition: pkgbase.cc:42
cache_error(const char *message, const binary_control &ctrl)
Construct cache error.
Definition: pkgbase.cc:484
A class to represent a package dependency.
Definition: dependency.h:24
string sysvars_pathname()
Get pathname for sysvars directory.
Definition: pkgbase.cc:102
~pkgbase()
Destroy pkgbase object.
Definition: pkgbase.cc:39
bool fix_dependencies(const std::set< string > &seed)
Fix dependencies.
Definition: pkgbase.cc:168
string sprites_pathname()
Get pathname for sprites directory.
Definition: pkgbase.cc:107
string setvars_pathname()
Get pathname for setvars file.
Definition: pkgbase.cc:112
status_table & selstat()
Get selected status table.
Definition: pkgbase.h:83
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:298
string list_pathname(const string &url)
Get pathname for index file from given source.
Definition: pkgbase.cc:56
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:117
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:22
status_table & curstat()
Get current status table.
Definition: pkgbase.h:77
A class for mapping package name to package status.
Definition: status_table.h:20
source_table & sources()
Get source table.
Definition: pkgbase.h:103
path_table & paths()
Get path table.
Definition: pkgbase.h:109
A class to represent the content of a RiscPkg binary control file.
Definition: binary_control.h:22
pkgbase(const string &pathname, const string &dpathname, const string &cpathname)
Create pkgbase object.
Definition: pkgbase.cc:23
string component_update_pathname()
Get pathname for component update file.
Definition: pkgbase.cc:122
A class for mapping source paths to destination paths.
Definition: path_table.h:24

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)