aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-build-log.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-log.cxx
parent17d44ec2c41a5b485cecae51a07396f85a601248 (diff)
Make use of foreign package objects in build-related functionality
Diffstat (limited to 'mod/mod-build-log.cxx')
-rw-r--r--mod/mod-build-log.cxx27
1 files changed, 7 insertions, 20 deletions
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 281eec6..f9fb0e5 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -15,8 +15,6 @@
#include <libbrep/build.hxx>
#include <libbrep/build-odb.hxx>
-#include <libbrep/package.hxx>
-#include <libbrep/package-odb.hxx>
#include <mod/options.hxx>
@@ -44,9 +42,6 @@ init (scanner& s)
options_ = make_shared<options::build_log> (
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_),
@@ -174,27 +169,19 @@ 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).
//
shared_ptr<build> b;
{
transaction t (build_db_->begin ());
- b = build_db_->find<build> (id);
- if (b == nullptr)
- config_expired ("no package configuration");
- else if (b->state != build_state::built)
+ package_build pb;
+ if (!build_db_->query_one<package_build> (
+ query<package_build>::build::id == id, pb))
+ config_expired ("no package build");
+
+ b = pb.build;
+ if (b->state != build_state::built)
config_expired ("state is " + to_string (b->state));
else
build_db_->load (*b, b->results_section);