From 6e90b57a442424876b1325b9209f79c8a885a479 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 4 Jul 2017 11:27:47 +0300 Subject: Make use of foreign package objects in build-related functionality --- mod/mod-build-force.cxx | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'mod/mod-build-force.cxx') 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 #include -#include -#include #include @@ -42,9 +40,6 @@ init (scanner& s) options_ = make_shared ( s, unknown_mode::fail, unknown_mode::fail); - database_module::init (static_cast (*options_), - options_->package_db_retry ()); - if (options_->build_config_specified ()) database_module::init (static_cast (*options_), static_cast (*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 p (package_db_->find (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 b (build_db_->find (id)); - if (b == nullptr) - config_expired ("no package configuration"); + package_build pb; + if (!build_db_->query_one ( + query::build::id == id, pb)) + config_expired ("no package build"); + shared_ptr b (pb.build); force_state force (b->state == build_state::built ? force_state::forced : force_state::forcing); -- cgit v1.1