From c16410d19ea96e82a8adb164635411df54a8be53 Mon Sep 17 00:00:00 2001 From: Francois Kritzinger Date: Wed, 24 Apr 2024 09:49:23 +0200 Subject: Revert "Also pass build hints to build_building() and build_built()" This reverts commit 9aa7ca59da55089e6f00733476356ef90bef25d2. --- mod/mod-build-force.cxx | 9 ++++----- mod/mod-build-result.cxx | 10 +++++----- mod/mod-build-task.cxx | 18 +++++++++--------- mod/mod-ci.cxx | 4 +--- mod/mod-ci.hxx | 4 +--- mod/tenant-service.hxx | 31 ++++++++++++++----------------- 6 files changed, 34 insertions(+), 42 deletions(-) (limited to 'mod') diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx index 780bd40..ea921e9 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>> tss; - tenant_service_base::build_hints bhs; + tenant_service_build_queued::build_queued_hints qhs; // Acquire the database connection for the subsequent transactions. // @@ -269,9 +269,8 @@ handle (request& rq, response& rs) shared_ptr p ( build_db_->load (b->id.package)); - bhs = - tenant_service_base::build_hints {tpc == 1, - p->configs.size () == 1}; + qhs = tenant_service_build_queued::build_queued_hints { + tpc == 1, p->configs.size () == 1}; // Set the package tenant's queued timestamp. // @@ -312,7 +311,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, build_state::building, - bhs, + qhs, log_writer_)) { conn = build_db_->connection (); diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index 3ee1f57..3ba18e1 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>> tss; - tenant_service_base::build_hints bhs; + tenant_service_build_queued::build_queued_hints qhs; // Acquire the database connection for the subsequent transactions. // @@ -357,8 +357,8 @@ handle (request& rq, response&) shared_ptr p ( build_db_->load (b->id.package)); - bhs = tenant_service_base::build_hints {tpc == 1, - p->configs.size () == 1}; + qhs = tenant_service_build_queued::build_queued_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, - bhs, + qhs, log_writer_)) { conn = build_db_->connection (); @@ -555,7 +555,7 @@ handle (request& rq, response&) // conn.reset (); - if (auto f = tsb->build_built (ss, b, bhs, log_writer_)) + if (auto f = tsb->build_built (ss, b, 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 73bbed5..917017b 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>> tss; vector qbs; - tenant_service_base::build_hints bhs; + tenant_service_build_queued::build_queued_hints qhs; optional initial_state; bool rebuild_forced_build (false); bool rebuild_interrupted_rebuild (false); @@ -1181,14 +1181,14 @@ handle (request& rq, response& rs) return r; }; - auto build_hints = [this] (const build_package& p) + auto queue_hints = [this] (const build_package& p) { buildable_package_count tpc ( build_db_->query_value ( query::build_tenant::id == p.id.tenant)); - return tenant_service_base::build_hints {tpc == 1, - p.configs.size () == 1}; + return tenant_service_build_queued::build_queued_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)) { - bhs = build_hints (*p); + qhs = queue_hints (*p); t->queued_timestamp = system_clock::now (); build_db_->update (t); @@ -2216,8 +2216,6 @@ handle (request& rq, response& rs) tsb = dynamic_cast (s); tsq = dynamic_cast (s); - bhs = build_hints (*p); - if (tsq != nullptr) { qbs = queue_builds (*p, *b); @@ -2231,6 +2229,8 @@ 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 */, - bhs, + qhs, 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, - bhs, + qhs, log_writer_)) { conn = build_db_->connection (); diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx index 30e3648..8c47bc4 100644 --- a/mod/mod-ci.cxx +++ b/mod/mod-ci.cxx @@ -426,7 +426,7 @@ function (const brep::tenant_service&)> brep::ci:: build_queued (const tenant_service&, const vector& bs, optional initial_state, - const build_hints& hints, + const build_queued_hints& hints, const diag_epilogue& log_writer) const noexcept { NOTIFICATION_DIAG (log_writer); @@ -470,7 +470,6 @@ build_queued (const tenant_service&, function (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) @@ -491,7 +490,6 @@ build_building (const tenant_service&, function (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 d7617f4..bd91e99 100644 --- a/mod/mod-ci.hxx +++ b/mod/mod-ci.hxx @@ -75,19 +75,17 @@ namespace brep build_queued (const tenant_service&, const vector&, optional initial_state, - const build_hints&, + const build_queued_hints&, const diag_epilogue& log_writer) const noexcept override; virtual function (const tenant_service&)> build_building (const tenant_service&, const build&, - const build_hints&, const diag_epilogue& log_writer) const noexcept override; virtual function (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 3f1896b..c46cb7b 100644 --- a/mod/tenant-service.hxx +++ b/mod/tenant-service.hxx @@ -18,20 +18,6 @@ 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; }; @@ -100,11 +86,24 @@ 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 (const tenant_service&)> build_queued (const tenant_service&, const vector&, optional initial_state, - const build_hints&, + const build_queued_hints&, const diag_epilogue& log_writer) const noexcept = 0; }; @@ -114,7 +113,6 @@ namespace brep virtual function (const tenant_service&)> build_building (const tenant_service&, const build&, - const build_hints&, const diag_epilogue& log_writer) const noexcept = 0; }; @@ -124,7 +122,6 @@ namespace brep virtual function (const tenant_service&)> build_built (const tenant_service&, const build&, - const build_hints&, const diag_epilogue& log_writer) const noexcept = 0; }; -- cgit v1.1