#include <sbuild-chroot-config.h>
Inheritance diagram for sbuild::chroot_config:
Public Types | |
typedef std::vector< chroot::ptr > | chroot_list |
A list of chroots. | |
typedef std::map< std::string, std::string > | string_map |
A map between key-value string pairs. | |
typedef std::map< std::string, chroot::ptr > | chroot_map |
A map between a chroot name and a chroot object. | |
typedef runtime_error_custom< chroot_config > | error |
Exception type. | |
typedef std::tr1::shared_ptr< chroot_config > | ptr |
A shared_ptr to a chroot_config object. | |
Public Member Functions | |
chroot_config () | |
The constructor. | |
chroot_config (std::string const &file, bool active) | |
The constructor. | |
virtual | ~chroot_config () |
The destructor. | |
void | add (std::string const &location, bool active) |
Add a configuration file or directory. | |
chroot_list | get_chroots () const |
Get a list of available chroots. | |
const chroot::ptr | find_chroot (std::string const &name) const |
Find a chroot by its name. | |
const chroot::ptr | find_alias (std::string const &name) const |
Find a chroot by its name or an alias. | |
string_list | get_chroot_list () const |
Get the names (including aliases) of all the available chroots, sorted in alphabetical order. | |
void | print_chroot_list (std::ostream &stream) const |
Print all the available chroots to the specified stream. | |
void | print_chroot_list_simple (std::ostream &stream) const |
Print a single line of all the available chroots to the specified stream. | |
void | print_chroot_info (string_list const &chroots, std::ostream &stream) const |
Print information about the specified chroots to the specified stream. | |
void | print_chroot_location (string_list const &chroots, std::ostream &stream) const |
Print location information about the specified chroots to the specified stream. | |
void | print_chroot_config (string_list const &chroots, std::ostream &stream) const |
Print configuration of the specified chroots to the specified stream. | |
string_list | validate_chroots (string_list const &chroots) const |
Check that all the chroots specified exist. | |
Protected Member Functions | |
void | add (chroot::ptr &chroot) |
Add a chroot. | |
Private Member Functions | |
void | add_config_file (std::string const &file, bool active) |
Add a configuration file. | |
void | add_config_directory (std::string const &dir, bool active) |
Add a configuration directory. | |
void | check_security (int fd) const |
Check the permissions and ownership of a configuration file. | |
void | load_data (std::string const &file, bool active) |
Load a configuration file. | |
virtual void | parse_data (std::istream &stream, bool active) |
Parse a loaded configuration file. | |
Private Attributes | |
chroot_map | chroots |
A list of chroots (name->chroot mapping). | |
string_map | aliases |
A list of aliases (alias->name mapping). |
This class holds the configuration details from the configuration file. Conceptually, it's an opaque container of chroot objects.
Methods are provided to query the available chroots and find specific chroots.
|
A list of chroots.
|
|
A map between a chroot name and a chroot object.
|
|
Exception type.
|
|
A shared_ptr to a chroot_config object.
|
|
A map between key-value string pairs.
|
|
The constructor.
Reimplemented in dchroot::chroot_config. |
|
The constructor.
Reimplemented in dchroot::chroot_config. |
|
The destructor.
Reimplemented in dchroot::chroot_config. |
|
Add a chroot. The lists of chroots and aliases will be updated. If a chroot or alias by the same name exists, the chroot will not be added, and a warning will be logged. Af any of the aliases already exist, a warning will be logged, and the alias will not be added.
|
|
Add a configuration file or directory. The configuration file or directory specified will be loaded.
|
|
Add a configuration directory. The configuration files in the directory specified will all be loaded.
|
|
Add a configuration file. The configuration file specified will be loaded.
|
|
Check the permissions and ownership of a configuration file. The file must be owned by root, not writable by other, and be a regular file. An error will be thrown on failure.
|
|
Find a chroot by its name or an alias.
|
|
Find a chroot by its name.
|
|
Get the names (including aliases) of all the available chroots, sorted in alphabetical order.
|
|
Get a list of available chroots.
|
|
Load a configuration file. If there are problems with the configuration file, an error will be thrown.
|
|
Parse a loaded configuration file. If there are problems with the configuration file, an error will be thrown.
Reimplemented in dchroot::chroot_config. |
|
Print configuration of the specified chroots to the specified stream.
|
|
Print information about the specified chroots to the specified stream.
|
|
Print all the available chroots to the specified stream.
|
|
Print a single line of all the available chroots to the specified stream.
|
|
Print location information about the specified chroots to the specified stream.
|
|
Check that all the chroots specified exist.
|
|
A list of aliases (alias->name mapping).
|
|
A list of chroots (name->chroot mapping).
|