#include <sbuild-config.h>
Public Types | |
typedef std::vector< Chroot * > | 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 * > | chroot_map |
A map between a chroot name and a Chroot object. | |
typedef runtime_error_custom< Config > | error |
Exception type. | |
Public Member Functions | |
Config () | |
The constructor. | |
Config (const std::string &file) | |
The constructor. | |
virtual | ~Config () |
The destructor. | |
void | add_config_file (const std::string &file) |
Add a configuration file. | |
void | add_config_directory (const std::string &dir) |
Add a configuration directory. | |
chroot_list | get_chroots () const |
Get a list of available chroots. | |
const Chroot * | find_chroot (const std::string &name) const |
Find a chroot by its name. | |
const Chroot * | find_alias (const std::string &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_info (const string_list &chroots, std::ostream &stream) const |
Print information about the specified chroots to the specified stream. | |
string_list | validate_chroots (const string_list &chroots) const |
Check that all the chroots specified exist. | |
Private Member Functions | |
void | check_security (int fd) const |
Check the permissions and ownership of a configuration file. | |
void | load (const std::string &file) |
Load a 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.
|
The constructor.
|
|
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, the program will be aborted immediately.
|
|
Print information about the specified chroots to the specified stream.
|
|
Print all the available chroots to the specified stream.
|
|
Check that all the chroots specified exist.
|