LibPkg
Classes | Public Member Functions | List of all members
pkg::pkgbase Class Reference

A class for representing the collection of package database tables. More...

#include <pkgbase.h>

Classes

class  cache_error
 An exception class for reporting cache errors. More...
 

Public Member Functions

 pkgbase (const string &pathname, const string &dpathname, const string &cpathname)
 Create pkgbase object. More...
 
 ~pkgbase ()
 Destroy pkgbase object. More...
 
status_tablecurstat ()
 Get current status table. More...
 
status_tableselstat ()
 Get selected status table. More...
 
status_tableprevstat ()
 Get previous status table. More...
 
binary_control_tablecontrol ()
 Get binary control table. More...
 
source_tablesources ()
 Get source table. More...
 
path_tablepaths ()
 Get path table. More...
 
string list_pathname (const string &url)
 Get pathname for index file from given source. More...
 
string available_pathname ()
 Get pathname for available list file. More...
 
string cache_pathname (const string &pkgname, const string &pkgvrsn)
 Get pathname for package in cache. More...
 
string info_pathname (const string &pkgname)
 Get pathname for info directory of package. More...
 
string sysvars_pathname ()
 Get pathname for sysvars directory. More...
 
string sprites_pathname ()
 Get pathname for sprites directory. More...
 
string setvars_pathname ()
 Get pathname for setvars file. More...
 
string bootsprites_pathname ()
 Get pathname for sprites file. More...
 
string component_update_pathname ()
 Get pathname for component update file. More...
 
void verify_cached_file (const binary_control &ctrl)
 Verify file in cache. More...
 
bool fix_dependencies (const std::set< string > &seed)
 Fix dependencies. More...
 
void remove_auto ()
 Remove redundant auto-installed packages. More...
 

Detailed Description

A class for representing the collection of package database tables.

Constructor & Destructor Documentation

pkg::pkgbase::pkgbase ( const string &  pathname,
const string &  dpathname,
const string &  cpathname 
)

Create pkgbase object.

Parameters
pathnamethe pathname of the !Packages directory.
dpathnamethe pathname of the default choices directory
cpathnamethe pathname of the choices directory

References pkg::create_directory().

pkg::pkgbase::~pkgbase ( )

Destroy pkgbase object.

Member Function Documentation

status_table& pkg::pkgbase::curstat ( )
inline

Get current status table.

Returns
the current status table

Referenced by pkg::commit::commit(), pkg::commit::poll(), pkg::unpack::poll(), and pkg::unpack::unpack().

status_table& pkg::pkgbase::selstat ( )
inline

Get selected status table.

Returns
the selected status table

Referenced by pkg::commit::commit(), fix_dependencies(), pkg::commit::poll(), remove_auto(), and pkg::unpack::unpack().

status_table& pkg::pkgbase::prevstat ( )
inline

Get previous status table.

This is the state to which packages are restored when changes are unwound after an error.

Returns
the previous status table

Referenced by pkg::commit::commit().

binary_control_table& pkg::pkgbase::control ( )
inline

Get binary control table.

Returns
the binary control table

Referenced by pkg::commit::poll(), and pkg::trigger::trigger().

source_table& pkg::pkgbase::sources ( )
inline

Get source table.

Returns
the source table
path_table& pkg::pkgbase::paths ( )
inline

Get path table.

Returns
the path table

Referenced by pkg::commit::poll(), pkg::trigger::trigger(), and pkg::update_sysvars().

string pkg::pkgbase::list_pathname ( const string &  url)

Get pathname for index file from given source.

Parameters
urlthe URL of the source
Returns
the pathname
string pkg::pkgbase::available_pathname ( )

Get pathname for available list file.

Returns
the pathname
string pkg::pkgbase::cache_pathname ( const string &  pkgname,
const string &  pkgvrsn 
)

Get pathname for package in cache.

Parameters
pkgnamethe package name
pkgvrsnthe package version
Returns
the pathname

Referenced by pkg::commit::poll(), and verify_cached_file().

string pkg::pkgbase::info_pathname ( const string &  pkgname)

Get pathname for info directory of package.

Parameters
pkgnamethe package name
Returns
the pathname
string pkg::pkgbase::sysvars_pathname ( )

Get pathname for sysvars directory.

Returns
the pathname

Referenced by pkg::update_sysvars().

string pkg::pkgbase::sprites_pathname ( )

Get pathname for sprites directory.

Returns
the pathname
string pkg::pkgbase::setvars_pathname ( )

Get pathname for setvars file.

Returns
the pathname

Referenced by pkg::update_sysvars().

string pkg::pkgbase::bootsprites_pathname ( )

Get pathname for sprites file.

Returns
the pathname
string pkg::pkgbase::component_update_pathname ( )

Get pathname for component update file.

Returns
the pathname

Referenced by pkg::commit::poll().

void pkg::pkgbase::verify_cached_file ( const binary_control ctrl)

Verify file in cache.

This function checks first whether a suitably named file exists, then whether it has the correct length, then whether it has the correct MD5Sum. If any of these tests fail then a cache error is thrown.

Parameters
ctrla control record for the requested package

References cache_pathname(), pkg::control::end(), pkg::control::find(), pkg::object_length(), pkg::object_type(), pkg::control::pkgname(), and pkg::control::version().

Referenced by pkg::commit::poll().

bool pkg::pkgbase::fix_dependencies ( const std::set< string > &  seed)

Fix dependencies.

If a package is in the seed set then its selection state cannot change from installed to removed or vice-versa. If it is not in the seed set then it can be installed or removed as necessary to meet all dependencies.

Parameters
seedthe seed set
Returns
true if all dependencies were fixed, otherwise false

References pkg::status_table::begin(), pkg::status_table::end(), pkg::status::flag(), pkg::status::flag_auto, pkg::status::flag_must_install, pkg::status::flag_must_remove, pkg::status::flag_must_upgrade, pkg::status_table::insert(), selstat(), pkg::status::state(), pkg::status::state_installed, pkg::status::state_removed, pkg::status::version(), and pkg::control::version().

Referenced by remove_auto().

void pkg::pkgbase::remove_auto ( )

The documentation for this class was generated from the following files:

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)