diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-02-15 13:37:31 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-02-22 11:18:08 +0300 |
commit | 10ab5a9bdc0e27691ec2d09772c8e62587b779a7 (patch) | |
tree | 6060ccdcbc7e5f83863ef233056ab039b1cd3313 /libbrep/build.hxx | |
parent | d4900d85f7a5d791f89821713d02d3dd19361044 (diff) |
Cleanup build queries in monitor
Diffstat (limited to 'libbrep/build.hxx')
-rw-r--r-- | libbrep/build.hxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libbrep/build.hxx b/libbrep/build.hxx index 236f73c..1e9a9fc 100644 --- a/libbrep/build.hxx +++ b/libbrep/build.hxx @@ -127,6 +127,41 @@ namespace brep compare_version_ne (x.toolchain_version, y.toolchain_version, true); } + // Allow comparing the query members with the query parameters bound by + // reference to variables of the build id type (in particular in the + // prepared queries). + // + // Note that it is not operator==() since the query template parameter type + // can not be deduced from the function parameter types and needs to be + // specified explicitly. + // + template <typename T, typename ID> + inline auto + equal (const ID& x, const build_id& y, bool toolchain_version = true) + -> decltype (x.package.tenant == odb::query<T>::_ref (y.package.tenant) && + x.package.name == odb::query<T>::_ref (y.package.name) && + x.package.version.epoch == + odb::query<T>::_ref (y.package.version.epoch) && + x.target_config_name == + odb::query<T>::_ref (y.target_config_name) && + x.toolchain_name == odb::query<T>::_ref (y.toolchain_name) && + x.toolchain_version.epoch == + odb::query<T>::_ref (y.toolchain_version.epoch)) + { + using query = odb::query<T>; + + query r (equal<T> (x.package, y.package) && + x.target == query::_ref (y.target) && + x.target_config_name == query::_ref (y.target_config_name) && + x.package_config_name == query::_ref (y.package_config_name) && + x.toolchain_name == query::_ref (y.toolchain_name)); + + if (toolchain_version) + r = r && equal<T> (x.toolchain_version, y.toolchain_version); + + return r; + } + // build_state // // The queued build state is semantically equivalent to a non-existent |