From a2522b8c176529559ac36fddaa13e4f6006f30b7 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(-) diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx index 1adf67a..bdae356 100644 --- a/mod/mod-build-force.cxx +++ b/mod/mod-build-force.cxx @@ -190,7 +190,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; connection_ptr conn (build_db_->connection ()); { @@ -264,9 +264,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. // @@ -301,7 +300,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, build_state::building, - bhs, + qhs, log_writer_)) update_tenant_service_state (conn, qbs.back ().tenant, f); } diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index 6327252..ccce17f 100644 --- a/mod/mod-build-result.cxx +++ b/mod/mod-build-result.cxx @@ -205,7 +205,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; // Note that if the session authentication fails (probably due to the // authentication settings change), then we log this case with the warning @@ -352,8 +352,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. // @@ -521,7 +521,7 @@ handle (request& rq, response&) if (auto f = tsq->build_queued (ss, qbs, build_state::building, - bhs, + qhs, log_writer_)) update_tenant_service_state (conn, qbs.back ().tenant, f); } @@ -537,7 +537,7 @@ handle (request& rq, response&) const tenant_service& ss (tss->first); const build& b (*tss->second); - if (auto f = tsb->build_built (ss, b, bhs, log_writer_)) + if (auto f = tsb->build_built (ss, b, log_writer_)) update_tenant_service_state (conn, b.tenant, f); } diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index bf6f2dc..07aff8d 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -1032,7 +1032,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); @@ -1104,14 +1104,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 @@ -1898,7 +1898,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); @@ -2138,8 +2138,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); @@ -2153,6 +2151,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); } @@ -2229,7 +2229,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, nullopt /* initial_state */, - bhs, + qhs, log_writer_)) { if (optional data = @@ -2253,7 +2253,7 @@ handle (request& rq, response& rs) if (auto f = tsq->build_queued (ss, qbs, initial_state, - bhs, + qhs, log_writer_)) { if (optional data = diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx index afe6c5c..5974d45 100644 --- a/mod/mod-ci.cxx +++ b/mod/mod-ci.cxx @@ -392,7 +392,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); @@ -436,7 +436,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) @@ -457,7 +456,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 9a59359..1e2ee15 100644 --- a/mod/mod-ci.hxx +++ b/mod/mod-ci.hxx @@ -62,19 +62,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; #endif diff --git a/mod/tenant-service.hxx b/mod/tenant-service.hxx index 8e419a4..61e0a07 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; }; @@ -99,11 +85,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; }; @@ -113,7 +112,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; }; @@ -123,7 +121,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