aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-04-17 08:15:54 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-04-24 15:16:12 +0200
commit45a65278146268fce30e4790c9fb831da876024e (patch)
tree49bb4178dcd8d4c3537a05e8409d51d7326f7a01
parent0a7f176c21075cafac7862226304e2cd0142fa4b (diff)
Also pass build hints to build_building() and build_built()
-rw-r--r--mod/mod-build-force.cxx9
-rw-r--r--mod/mod-build-result.cxx10
-rw-r--r--mod/mod-build-task.cxx18
-rw-r--r--mod/mod-ci.cxx4
-rw-r--r--mod/mod-ci.hxx4
-rw-r--r--mod/tenant-service.hxx31
6 files changed, 42 insertions, 34 deletions
diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx
index bdae356..1adf67a 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<pair<tenant_service, shared_ptr<build>>> tss;
- tenant_service_build_queued::build_queued_hints qhs;
+ tenant_service_base::build_hints bhs;
connection_ptr conn (build_db_->connection ());
{
@@ -264,8 +264,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.
//
@@ -300,7 +301,7 @@ handle (request& rq, response& rs)
if (auto f = tsq->build_queued (ss,
qbs,
build_state::building,
- qhs,
+ bhs,
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 ccce17f..6327252 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<pair<tenant_service, shared_ptr<build>>> tss;
- tenant_service_build_queued::build_queued_hints qhs;
+ tenant_service_base::build_hints bhs;
// 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<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.
//
@@ -521,7 +521,7 @@ handle (request& rq, response&)
if (auto f = tsq->build_queued (ss,
qbs,
build_state::building,
- qhs,
+ bhs,
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, log_writer_))
+ if (auto f = tsb->build_built (ss, b, bhs, 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 07aff8d..bf6f2dc 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<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);
@@ -1104,14 +1104,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
@@ -1898,7 +1898,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);
@@ -2138,6 +2138,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);
@@ -2151,8 +2153,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);
}
@@ -2229,7 +2229,7 @@ handle (request& rq, response& rs)
if (auto f = tsq->build_queued (ss,
qbs,
nullopt /* initial_state */,
- qhs,
+ bhs,
log_writer_))
{
if (optional<string> data =
@@ -2253,7 +2253,7 @@ handle (request& rq, response& rs)
if (auto f = tsq->build_queued (ss,
qbs,
initial_state,
- qhs,
+ bhs,
log_writer_))
{
if (optional<string> data =
diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx
index 5974d45..afe6c5c 100644
--- a/mod/mod-ci.cxx
+++ b/mod/mod-ci.cxx
@@ -392,7 +392,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);
@@ -436,6 +436,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)
@@ -456,6 +457,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 1e2ee15..9a59359 100644
--- a/mod/mod-ci.hxx
+++ b/mod/mod-ci.hxx
@@ -62,17 +62,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;
#endif
diff --git a/mod/tenant-service.hxx b/mod/tenant-service.hxx
index 52860b7..92d8747 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;
};
@@ -83,24 +97,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;
};
@@ -110,6 +111,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;
};
@@ -119,6 +121,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;
};