From 732dd69e4d9e1b70edffad9829e34d84155cd91b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 18 Jul 2017 14:55:38 +0300 Subject: Adapt to non-optional buildtab target --- libbrep/build.cxx | 2 +- libbrep/build.hxx | 17 +++++------------ libbrep/build.xml | 2 +- mod/build-config.cxx | 3 +-- mod/mod-build-log.cxx | 3 +-- mod/mod-builds.cxx | 26 +++++++++----------------- mod/mod-package-version-details.cxx | 7 ++----- mod/options.cli | 6 +++--- 8 files changed, 23 insertions(+), 43 deletions(-) diff --git a/libbrep/build.cxx b/libbrep/build.cxx index 78a3a2d..10ff792 100644 --- a/libbrep/build.cxx +++ b/libbrep/build.cxx @@ -60,7 +60,7 @@ namespace brep string tnm, version tvr, optional afp, optional ach, string mnm, string msm, - optional trg) + butl::target_triplet trg) : id (package_id (move (pnm), pvr), move (cfg), tvr), package_name (id.package.name), package_version (move (pvr)), diff --git a/libbrep/build.hxx b/libbrep/build.hxx index 7f0aba6..7edf70c 100644 --- a/libbrep/build.hxx +++ b/libbrep/build.hxx @@ -146,13 +146,9 @@ namespace brep // target_triplet // - using optional_target_triplet = optional; - - #pragma db map type(optional_target_triplet) as(optional_string) \ - to((?) ? (?)->string () : brep::optional_string ()) \ - from((?) \ - ? butl::target_triplet (*(?)) \ - : brep::optional_target_triplet ()) + #pragma db map type(butl::target_triplet) as(string) \ + to((?).string ()) \ + from(butl::target_triplet (?)) // operation_results // @@ -176,7 +172,7 @@ namespace brep optional agent_fingerprint, optional agent_challenge, string machine, string machine_summary, - optional target); + butl::target_triplet); build_id id; @@ -206,10 +202,7 @@ namespace brep string machine; string machine_summary; - - // Default for the machine if absent. - // - optional target; + butl::target_triplet target; // Note that the logs are stored as std::string/TEXT which is Ok since // they are UTF-8 and our database is UTF-8. diff --git a/libbrep/build.xml b/libbrep/build.xml index 5b45d6d..e765c00 100644 --- a/libbrep/build.xml +++ b/libbrep/build.xml @@ -24,7 +24,7 @@ - + diff --git a/mod/build-config.cxx b/mod/build-config.cxx index fed2ee9..ecbcf6f 100644 --- a/mod/build-config.cxx +++ b/mod/build-config.cxx @@ -152,8 +152,7 @@ namespace brep const build_config& c) { return path_match (config_pattern, c.name) && - (!target_pattern || - (c.target && path_match (*target_pattern, c.target->string ()))); + (!target_pattern || path_match (*target_pattern, c.target.string ())); } bool diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx index f9fb0e5..b667c08 100644 --- a/mod/mod-build-log.cxx +++ b/mod/mod-build-log.cxx @@ -200,8 +200,7 @@ handle (request& rq, response& rs) << "config: " << b->configuration << endl << "machine: " << b->machine << " (" << b->machine_summary << ")" << endl - << "target: " << (b->target ? b->target->string () : "") - << endl + << "target: " << b->target.string () << endl << "timestamp: "; butl::to_stream (os, b->timestamp, "%Y-%m-%d %H:%M:%S%[.N] %Z", true, true); diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx index 2f436c7..7b806bf 100644 --- a/mod/mod-builds.cxx +++ b/mod/mod-builds.cxx @@ -149,12 +149,8 @@ build_query (const brep::cstrings& configs, const brep::params::builds& params) // Build target. // - const string& tg (params.target ()); - - if (tg != "*") - q = q && (tg.empty () - ? qb::target.is_null () - : qb::target.like (transform (tg))); + if (!params.target ().empty ()) + q = q && qb::target.like (transform (params.target ())); // Build result. // @@ -386,7 +382,7 @@ handle (request& rq, response& rs) << ~TR << TR_INPUT ("machine", "mn", params.machine (), "*") - << TR_INPUT ("target", "tg", params.target (), "") + << TR_INPUT ("target", "tg", params.target (), "*") << TR_SELECT ("result", "rs", params.result (), build_results) << ~TBODY << ~TABLE @@ -456,8 +452,7 @@ handle (request& rq, response& rs) b.toolchain_version.string ()) << TR_VALUE ("config", b.configuration) << TR_VALUE ("machine", b.machine) - << TR_VALUE ("target", - b.target ? b.target->string () : "") + << TR_VALUE ("target", b.target.string ()) << TR_VALUE ("timestamp", ts) << TR_BUILD_RESULT (b, host, root) << ~TBODY @@ -546,10 +541,9 @@ handle (request& rq, response& rs) { if ((pc.empty () || path_match (pc, c.name)) && // Filter by name. - (tg.empty () // Filter by target. - ? !c.target - : tg == "*" || - (c.target && path_match (tg, c.target->string ())))) + // Filter by target. + // + (tg.empty () || path_match (tg, c.target.string ()))) { configs.push_back (&c); @@ -803,8 +797,6 @@ handle (request& rq, response& rs) auto i (build_conf_map_->find (ct.configuration.c_str ())); assert (i != build_conf_map_->end ()); - const optional& tg (i->second->target); - s << TABLE(CLASS="proplist build") << TBODY << TR_NAME (id.name, string (), root) @@ -813,7 +805,7 @@ handle (request& rq, response& rs) string (ct.toolchain_name) + '-' + ct.toolchain_version.string ()) << TR_VALUE ("config", ct.configuration) - << TR_VALUE ("target", tg ? tg->string () : "") + << TR_VALUE ("target", i->second->target.string ()) << ~TBODY << ~TABLE; @@ -851,7 +843,7 @@ handle (request& rq, response& rs) add_filter ("tc", params.toolchain (), "*"); add_filter ("cf", params.configuration ()); add_filter ("mn", params.machine ()); - add_filter ("tg", params.target (), "*"); + add_filter ("tg", params.target ()); add_filter ("rs", params.result (), "*"); s << DIV_PAGER (page, count, page_configs, options_->build_pages (), u) diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index 4da13ab..0138154 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -371,8 +371,7 @@ handle (request& rq, response& rs) b.toolchain_name + '-' + b.toolchain_version.string ()) << TR_VALUE ("config", - b.configuration + " / " + - (b.target ? b.target->string () : "")) + b.configuration + " / " + b.target.string ()) << TR_VALUE ("timestamp", ts) << TR_BUILD_RESULT (b, host, root) << ~TBODY @@ -421,9 +420,7 @@ handle (request& rq, response& rs) { s << TABLE(CLASS="proplist build") << TBODY - << TR_VALUE ("config", - c.name + " / " + - (c.target ? c.target->string () : "")) + << TR_VALUE ("config", c.name + " / " + c.target.string ()) << TR_VALUE ("result", !reason.empty () ? "excluded (" + reason + ')' diff --git a/mod/options.cli b/mod/options.cli index 857c2f3..3f7ec01 100644 --- a/mod/options.cli +++ b/mod/options.cli @@ -523,10 +523,10 @@ namespace brep // string machine | mn; - // Package build target wildcard. If empty, then the default machine - // target is matched. + // Package build target wildcard. An empty value is treated the same way + // as *. // - string target | tg = "*"; + string target | tg; // Package build result. If *, then no build result constraint is // applied. Otherwise the value is supposed to be the one of the -- cgit v1.1