diff options
-rw-r--r-- | mod/mod-build-force.cxx | 9 | ||||
-rw-r--r-- | mod/mod-build-result.cxx | 10 | ||||
-rw-r--r-- | mod/mod-build-task.cxx | 18 | ||||
-rw-r--r-- | mod/mod-ci.cxx | 4 | ||||
-rw-r--r-- | mod/mod-ci.hxx | 4 | ||||
-rw-r--r-- | mod/tenant-service.hxx | 31 |
6 files changed, 42 insertions, 34 deletions
diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx index ea921e9..780bd40 100644 --- a/mod/mod-build-force.cxx +++ b/mod/mod-build-force.cxx @@ -188,7 +188,7 @@ handle (request& rq, response& rs) // const tenant_service_build_queued* tsq (nullptr); optional<pair<tenant_service, shared_ptr<build>>> tss; - tenant_service_build_queued::build_queued_hints qhs; + tenant_service_base::build_hints bhs; // Acquire the database connection for the subsequent transactions. // @@ -269,8 +269,9 @@ handle (request& rq, response& rs) shared_ptr<build_package> p ( build_db_->load<build_package> (b->id.package)); - qhs = tenant_service_build_queued::build_queued_hints { - tpc == 1, p->configs.size () == 1}; + bhs = + tenant_service_base::build_hints {tpc == 1, + p->configs.size () == 1}; // Set the package tenant's queued timestamp. // @@ -311,7 +312,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, build_state::building, - qhs, + bhs, log_writer_)) { conn = build_db_->connection (); diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index 3ba18e1..3ee1f57 100644 --- a/mod/mod-build-result.cxx +++ b/mod/mod-build-result.cxx @@ -203,7 +203,7 @@ handle (request& rq, response&) const tenant_service_build_built* tsb (nullptr); const tenant_service_build_queued* tsq (nullptr); optional<pair<tenant_service, shared_ptr<build>>> tss; - tenant_service_build_queued::build_queued_hints qhs; + tenant_service_base::build_hints bhs; // Acquire the database connection for the subsequent transactions. // @@ -357,8 +357,8 @@ handle (request& rq, response&) shared_ptr<build_package> p ( build_db_->load<build_package> (b->id.package)); - qhs = tenant_service_build_queued::build_queued_hints { - tpc == 1, p->configs.size () == 1}; + bhs = tenant_service_base::build_hints {tpc == 1, + p->configs.size () == 1}; // Set the package tenant's queued timestamp. // @@ -531,7 +531,7 @@ handle (request& rq, response&) if (auto f = tsq->build_queued (ss, qbs, build_state::building, - qhs, + bhs, log_writer_)) { conn = build_db_->connection (); @@ -555,7 +555,7 @@ handle (request& rq, response&) // conn.reset (); - if (auto f = tsb->build_built (ss, b, log_writer_)) + if (auto f = tsb->build_built (ss, b, bhs, log_writer_)) { conn = build_db_->connection (); update_tenant_service_state (conn, b.tenant, f); diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index 917017b..73bbed5 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -1109,7 +1109,7 @@ handle (request& rq, response& rs) const tenant_service_build_queued* tsq (nullptr); optional<pair<tenant_service, shared_ptr<build>>> tss; vector<build> qbs; - tenant_service_build_queued::build_queued_hints qhs; + tenant_service_base::build_hints bhs; optional<build_state> initial_state; bool rebuild_forced_build (false); bool rebuild_interrupted_rebuild (false); @@ -1181,14 +1181,14 @@ handle (request& rq, response& rs) return r; }; - auto queue_hints = [this] (const build_package& p) + auto build_hints = [this] (const build_package& p) { buildable_package_count tpc ( build_db_->query_value<buildable_package_count> ( query<buildable_package_count>::build_tenant::id == p.id.tenant)); - return tenant_service_build_queued::build_queued_hints { - tpc == 1, p.configs.size () == 1}; + return tenant_service_base::build_hints {tpc == 1, + p.configs.size () == 1}; }; // Collect the auxiliary machines required for testing of the specified @@ -1976,7 +1976,7 @@ handle (request& rq, response& rs) (*initial_state != build_state::queued && !rebuild_forced_build)) { - qhs = queue_hints (*p); + bhs = build_hints (*p); t->queued_timestamp = system_clock::now (); build_db_->update (t); @@ -2216,6 +2216,8 @@ handle (request& rq, response& rs) tsb = dynamic_cast<const tenant_service_build_building*> (s); tsq = dynamic_cast<const tenant_service_build_queued*> (s); + bhs = build_hints (*p); + if (tsq != nullptr) { qbs = queue_builds (*p, *b); @@ -2229,8 +2231,6 @@ handle (request& rq, response& rs) // if (!qbs.empty () || !rebuild_interrupted_rebuild) { - qhs = queue_hints (*p); - t->queued_timestamp = system_clock::now (); build_db_->update (t); } @@ -2318,7 +2318,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, nullopt /* initial_state */, - qhs, + bhs, log_writer_)) { conn = build_db_->connection (); @@ -2350,7 +2350,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, initial_state, - qhs, + bhs, log_writer_)) { conn = build_db_->connection (); diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx index 8c47bc4..30e3648 100644 --- a/mod/mod-ci.cxx +++ b/mod/mod-ci.cxx @@ -426,7 +426,7 @@ function<optional<string> (const brep::tenant_service&)> brep::ci:: build_queued (const tenant_service&, const vector<build>& bs, optional<build_state> initial_state, - const build_queued_hints& hints, + const build_hints& hints, const diag_epilogue& log_writer) const noexcept { NOTIFICATION_DIAG (log_writer); @@ -470,6 +470,7 @@ build_queued (const tenant_service&, function<optional<string> (const brep::tenant_service&)> brep::ci:: build_building (const tenant_service&, const build& b, + const build_hints&, const diag_epilogue&) const noexcept { return [&b] (const tenant_service& ts) @@ -490,6 +491,7 @@ build_building (const tenant_service&, function<optional<string> (const brep::tenant_service&)> brep::ci:: build_built (const tenant_service&, const build& b, + const build_hints&, const diag_epilogue&) const noexcept { return [&b] (const tenant_service& ts) diff --git a/mod/mod-ci.hxx b/mod/mod-ci.hxx index bd91e99..d7617f4 100644 --- a/mod/mod-ci.hxx +++ b/mod/mod-ci.hxx @@ -75,17 +75,19 @@ namespace brep build_queued (const tenant_service&, const vector<build>&, optional<build_state> initial_state, - const build_queued_hints&, + const build_hints&, const diag_epilogue& log_writer) const noexcept override; virtual function<optional<string> (const tenant_service&)> build_building (const tenant_service&, const build&, + const build_hints&, const diag_epilogue& log_writer) const noexcept override; virtual function<optional<string> (const tenant_service&)> build_built (const tenant_service&, const build&, + const build_hints&, const diag_epilogue& log_writer) const noexcept override; #ifdef BREP_CI_TENANT_SERVICE_UNLOADED diff --git a/mod/tenant-service.hxx b/mod/tenant-service.hxx index d0cd6ea..c9d0fa9 100644 --- a/mod/tenant-service.hxx +++ b/mod/tenant-service.hxx @@ -18,6 +18,20 @@ namespace brep class tenant_service_base { public: + + // The build_hints can be used to omit certain components from the build + // id. If single_package_version is true, then this tenant contains a + // single (non-test) package version and this package name and package + // version can be omitted. If single_package_config is true, then the + // package version being built only has the default package configuration + // and thus it can be omitted. + // + struct build_hints + { + bool single_package_version; + bool single_package_config; + }; + virtual ~tenant_service_base () = default; }; @@ -84,24 +98,11 @@ namespace brep // the function name suffix (_queued, _building, _built) signify the // logical end state. // - // The build_queued_hints can be used to omit certain components from the - // build id. If single_package_version is true, then this tenant contains - // a single (non-test) package version and this package name and package - // version can be omitted. If single_package_config is true, then the - // package version being built only has the default package configuration - // and thus it can be omitted. - // - struct build_queued_hints - { - bool single_package_version; - bool single_package_config; - }; - virtual function<optional<string> (const tenant_service&)> build_queued (const tenant_service&, const vector<build>&, optional<build_state> initial_state, - const build_queued_hints&, + const build_hints&, const diag_epilogue& log_writer) const noexcept = 0; }; @@ -111,6 +112,7 @@ namespace brep virtual function<optional<string> (const tenant_service&)> build_building (const tenant_service&, const build&, + const build_hints&, const diag_epilogue& log_writer) const noexcept = 0; }; @@ -120,6 +122,7 @@ namespace brep virtual function<optional<string> (const tenant_service&)> build_built (const tenant_service&, const build&, + const build_hints&, const diag_epilogue& log_writer) const noexcept = 0; }; |