19 #ifndef SBUILD_CHROOT_CONFIG_H 20 #define SBUILD_CHROOT_CONFIG_H 22 #include <sbuild/sbuild-chroot.h> 23 #include <sbuild/sbuild-custom-error.h> 76 typedef std::shared_ptr<chroot_config>
ptr;
90 std::string
const& file);
105 add (std::string
const& chroot_namespace,
106 std::string
const& location);
119 std::string
const& file);
131 std::string
const& dir);
146 add (std::string
const& chroot_namespace,
159 get_chroots (std::string
const& chroot_namespace)
const;
192 std::string& chroot_namespace,
193 std::string& chroot_name);
215 std::string
const& name)
const;
226 std::string
const& name)
const;
237 find_alias (std::string
const& namespace_hint,
238 std::string
const& name)
const;
250 std::string
const& name)
const;
310 load_data (std::string
const& chroot_namespace,
311 std::string
const& file);
323 parse_data (std::string
const& chroot_namespace,
324 std::istream& stream);
Chroot not found.
Definition: sbuild-chroot-config.h:61
string_list get_chroot_list(std::string const &chroot_namespace) const
Get the names (including aliases) of all the available chroots, sorted in alphabetical order...
Definition: sbuild-chroot-config.cc:438
string_map aliases
A list of aliases (alias->name mapping).
Definition: sbuild-chroot-config.h:341
void print_chroot_list_simple(std::ostream &stream) const
Print a single line of all the available chroots to the specified stream.
Definition: sbuild-chroot-config.cc:480
Debian source builder components.
Definition: sbuild-auth-null.h:24
Chroots not found.
Definition: sbuild-chroot-config.h:62
File is not a regular file.
Definition: sbuild-chroot-config.h:64
std::map< std::string, chroot_map > chroot_namespace_map
A map between a chroot namespace and a chroot map object.
Definition: sbuild-chroot-config.h:52
const chroot::ptr find_chroot(std::string const &name) const
Find a chroot by its name.
Definition: sbuild-chroot-config.cc:338
Chroot configuration.
Definition: sbuild-chroot-config.h:42
File is not owned by user root.
Definition: sbuild-chroot-config.h:66
chroot_list get_chroots(std::string const &chroot_namespace) const
Get a list of available chroots.
Definition: sbuild-chroot-config.cc:300
const sbuild::chroot::ptr find_chroot_in_namespace(std::string const &chroot_namespace, std::string const &name) const
Find a chroot by its name in a specific namespace.
Definition: sbuild-chroot-config.cc:366
void load_data(std::string const &chroot_namespace, std::string const &file)
Load a configuration file.
Definition: sbuild-chroot-config.cc:540
custom_error< error_code > error
Exception type.
Definition: sbuild-chroot-config.h:73
chroot_map & find_namespace(std::string const &chroot_namespace)
Find a chroot namespace.
Definition: sbuild-chroot-config.cc:316
Configuration file parser.
Definition: sbuild-basic-keyfile.h:138
static const std::string namespace_separator
Namespace separating character.
Definition: sbuild-chroot-config.h:55
std::string lookup_alias(std::string const &namespace_hint, std::string const &name) const
Find the chroot name referred to by an alias.
Definition: sbuild-chroot-config.cc:410
void add_config_directory(std::string const &chroot_namespace, std::string const &dir)
Add a configuration directory.
Definition: sbuild-chroot-config.cc:143
chroot_config()
The constructor.
Definition: sbuild-chroot-config.cc:91
const chroot::ptr find_alias(std::string const &namespace_hint, std::string const &name) const
Find a chroot by its name or an alias.
Definition: sbuild-chroot-config.cc:385
static void get_namespace(std::string const &name, std::string &chroot_namespace, std::string &chroot_name)
Split a chroot name into a namespace and name.
Definition: sbuild-chroot-config.cc:671
No such namespace.
Definition: sbuild-chroot-config.h:69
virtual void parse_data(std::string const &chroot_namespace, std::istream &stream)
Parse a loaded configuration file.
Definition: sbuild-chroot-config.cc:592
Alias already associated with chroot.
Definition: sbuild-chroot-config.h:60
virtual void load_keyfile(std::string const &chroot_namespace, keyfile &kconfig)
Load a keyfile.
Definition: sbuild-chroot-config.cc:602
std::vector< std::string > string_list
A string vector.
Definition: sbuild-types.h:38
Custom error.
Definition: sbuild-custom-error.h:32
std::shared_ptr< chroot_config > ptr
A shared_ptr to a chroot_config object.
Definition: sbuild-chroot-config.h:76
chroot_map validate_chroots(std::string const &namespace_hint, string_list const &chroots) const
Check that all the chroots specified exist.
Definition: sbuild-chroot-config.cc:514
std::map< std::string, std::string > string_map
A map between key-value string pairs.
Definition: sbuild-chroot-config.h:48
A chroot or alias already exists with this name.
Definition: sbuild-chroot-config.h:63
Common chroot data.
Definition: sbuild-chroot.h:45
virtual ~chroot_config()
The destructor.
Definition: sbuild-chroot-config.cc:112
void add(std::string const &chroot_namespace, std::string const &location)
Add a configuration file or directory.
Definition: sbuild-chroot-config.cc:117
string_list get_alias_list(std::string const &chroot_namespace) const
Get the names (including aliases) of all the available chroots, sorted in alphabetical order...
Definition: sbuild-chroot-config.cc:454
std::map< std::string, chroot::ptr > chroot_map
A map between a chroot name and a chroot object.
Definition: sbuild-chroot-config.h:50
chroot_namespace_map namespaces
A list of chroots (name->chroot mapping).
Definition: sbuild-chroot-config.h:339
error_code
Error codes.
Definition: sbuild-chroot-config.h:58
Invalid name.
Definition: sbuild-chroot-config.h:68
File has write permissions for others.
Definition: sbuild-chroot-config.h:67
void add_config_file(std::string const &chroot_namespace, std::string const &file)
Add a configuration file.
Definition: sbuild-chroot-config.cc:130
std::shared_ptr< chroot > ptr
A shared_ptr to a chroot object.
Definition: sbuild-chroot.h:105
Failed to open file.
Definition: sbuild-chroot-config.h:65
std::vector< chroot::ptr > chroot_list
A list of chroots.
Definition: sbuild-chroot-config.h:46