aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-build-task.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/mod-build-task.cxx')
-rw-r--r--mod/mod-build-task.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index d75c73d..3e02463 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -7,6 +7,10 @@
#include <map>
#include <chrono>
+#include <odb/database.hxx>
+#include <odb/transaction.hxx>
+#include <odb/schema-catalog.hxx>
+
#include <libbutl/utility.hxx> // compare_c_string
#include <libbutl/filesystem.hxx> // path_match()
#include <libbutl/manifest-parser.hxx>
@@ -15,9 +19,6 @@
#include <libbbot/manifest.hxx>
#include <libbbot/build-config.hxx>
-#include <odb/database.hxx>
-#include <odb/transaction.hxx>
-
#include <web/module.hxx>
#include <libbrep/build.hxx>
@@ -56,10 +57,22 @@ init (scanner& s)
options_->package_db_retry ());
if (options_->build_config_specified ())
+ {
database_module::init (static_cast<options::build> (*options_),
static_cast<options::build_db> (*options_),
options_->build_db_retry ());
+ // Check that the database 'build' schema matches the current one. It's
+ // enough to perform the check in just a single module implementation
+ // (more details in the comment in package_search::init()).
+ //
+ const string ds ("build");
+ if (schema_catalog::current_version (*build_db_, ds) !=
+ build_db_->schema_version (ds))
+ fail << "database 'build' schema differs from the current one (module "
+ << BREP_VERSION_ID << ")";
+ }
+
if (options_->root ().empty ())
options_->root (dir_path ("/"));
}