aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-build-result.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-result.cxx
parent17d44ec2c41a5b485cecae51a07396f85a601248 (diff)
Make use of foreign package objects in build-related functionality
Diffstat (limited to 'mod/mod-build-result.cxx')
-rw-r--r--mod/mod-build-result.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx
index 042114d..1f5eb69 100644
--- a/mod/mod-build-result.cxx
+++ b/mod/mod-build-result.cxx
@@ -215,6 +215,12 @@ handle (request& rq, response&)
// Load the built package (if present).
//
+ // The only way not to deal with 2 databases simultaneously is to pull
+ // another bunch of the package fields into the build_package foreign
+ // object, which is a pain (see build_package.hxx for details). Doesn't seem
+ // worth it here: email members are really secondary and we don't need to
+ // switch transactions back and forth.
+ //
shared_ptr<package> p;
{
transaction t (package_db_->begin ());
@@ -242,11 +248,12 @@ handle (request& rq, response&)
{
transaction t (build_db_->begin ());
- b = build_db_->find<build> (id);
- if (b == nullptr)
- warn_expired ("no package configuration");
- else if (b->state != build_state::building)
+ package_build pb;
+ if (!build_db_->query_one<package_build> (
+ query<package_build>::build::id == id, pb))
+ warn_expired ("no package build");
+ else if ((b = pb.build)->state != build_state::building)
warn_expired ("package configuration state is " + to_string (b->state));
else if (b->timestamp != session_timestamp)
warn_expired ("non-matching timestamp");