aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-build-force.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-07-04 11:27:47 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-05 15:22:37 +0300
commit6e90b57a442424876b1325b9209f79c8a885a479 (patch)
treebcdc8ee050c05799e17dcca12d7afc80274840d0 /mod/mod-build-force.cxx
parent17d44ec2c41a5b485cecae51a07396f85a601248 (diff)
Make use of foreign package objects in build-related functionality
Diffstat (limited to 'mod/mod-build-force.cxx')
-rw-r--r--mod/mod-build-force.cxx24
1 files changed, 5 insertions, 19 deletions
diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx
index 325a1c7..a1d424c 100644
--- a/mod/mod-build-force.cxx
+++ b/mod/mod-build-force.cxx
@@ -13,8 +13,6 @@
#include <libbrep/build.hxx>
#include <libbrep/build-odb.hxx>
-#include <libbrep/package.hxx>
-#include <libbrep/package-odb.hxx>
#include <mod/options.hxx>
@@ -42,9 +40,6 @@ init (scanner& s)
options_ = make_shared<options::build_force> (
s, unknown_mode::fail, unknown_mode::fail);
- database_module::init (static_cast<options::package_db> (*options_),
- options_->package_db_retry ());
-
if (options_->build_config_specified ())
database_module::init (static_cast<options::build> (*options_),
static_cast<options::build_db> (*options_),
@@ -145,27 +140,18 @@ handle (request& rq, response& rs)
build_conf_map_->end ())
config_expired ("no configuration");
- // Make sure the package still exists.
- //
- {
- transaction t (package_db_->begin ());
- shared_ptr<package> p (package_db_->find<package> (id.package));
- t.commit ();
-
- if (p == nullptr)
- config_expired ("no package");
- }
-
// Load the package build configuration (if present), set the force flag and
// update the object's persistent state.
//
{
transaction t (build_db_->begin ());
- shared_ptr<build> b (build_db_->find<build> (id));
- if (b == nullptr)
- config_expired ("no package configuration");
+ package_build pb;
+ if (!build_db_->query_one<package_build> (
+ query<package_build>::build::id == id, pb))
+ config_expired ("no package build");
+ shared_ptr<build> b (pb.build);
force_state force (b->state == build_state::built
? force_state::forced
: force_state::forcing);