From 630834173bba497c9f21eb0459ba5cb7264346ee Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 23 Oct 2024 20:58:32 +0200 Subject: Add suppport for build-task tenant_service_type parameter --- mod/mod-build-task.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mod/mod-build-task.cxx') diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index 917017b..2ae1237 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -203,6 +203,41 @@ package_query (bool custom_bot, query::build_repository::id.canonical_name.in_range (rp.begin (), rp.end ()); + // Filter by the types of services associated with the tenants, where the + // empty type denotes tenants without associated service. + // + if (params.tenant_service_type_specified ()) + { + cstrings ts; + bool et (false); + + for (const string& t: params.tenant_service_type ()) + { + if (!t.empty ()) + ts.push_back (t.c_str ()); + else + et = true; + } + + if (!ts.empty () && et) + { + q = q && + (query::build_tenant::service.type.in_range (ts.begin (), ts.end ()) || + query::build_tenant::service.type.is_null ()); + } + else if (!ts.empty ()) + { + q = q && query::build_tenant::service.type.in_range (ts.begin (), + ts.end ()); + } + else + { + assert (et); + + q = q && query::build_tenant::service.type.is_null (); + } + } + // If the interactive mode is false or true, then filter out the respective // packages. // -- cgit v1.1