diff options
Diffstat (limited to 'mod/database-module.cxx')
-rw-r--r-- | mod/database-module.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/mod/database-module.cxx b/mod/database-module.cxx index 47cf03a..9daff53 100644 --- a/mod/database-module.cxx +++ b/mod/database-module.cxx @@ -20,6 +20,7 @@ namespace brep { using namespace std; using namespace butl; + using namespace bbot; // While currently the user-defined copy constructor is not required (we // don't need to deep copy nullptr's), it is a good idea to keep the @@ -31,7 +32,9 @@ namespace brep retry_ (r.retry_), package_db_ (r.initialized_ ? r.package_db_ : nullptr), build_db_ (r.initialized_ ? r.build_db_ : nullptr), - build_conf_ (r.initialized_ ? r.build_conf_ : nullptr) + build_conf_ (r.initialized_ ? r.build_conf_ : nullptr), + build_conf_names_ (r.initialized_ ? r.build_conf_names_ : nullptr), + build_conf_map_ (r.initialized_ ? r.build_conf_map_ : nullptr) { } @@ -64,6 +67,23 @@ namespace brep throw_generic_error (EIO, os.str ().c_str ()); } + cstrings conf_names; + + using conf_map_type = map<const char*, + const build_config*, + compare_c_string>; + conf_map_type conf_map; + + for (const auto& c: *build_conf_) + { + const char* cn (c.name.c_str ()); + conf_map[cn] = &c; + conf_names.push_back (cn); + } + + build_conf_names_ = make_shared<cstrings> (move (conf_names)); + build_conf_map_ = make_shared<conf_map_type> (move (conf_map)); + build_db_ = shared_database (dbo.build_db_user (), dbo.build_db_password (), dbo.build_db_name (), |