aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-07-18 14:55:38 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-18 14:55:38 +0300
commit732dd69e4d9e1b70edffad9829e34d84155cd91b (patch)
tree4bc1e8b26b1947b982ceb593257c5ab3f1cb268a
parent67d190d15e5a8ad865dbbf21fdf7dcb7b1168cdd (diff)
Adapt to non-optional buildtab target
-rw-r--r--libbrep/build.cxx2
-rw-r--r--libbrep/build.hxx17
-rw-r--r--libbrep/build.xml2
-rw-r--r--mod/build-config.cxx3
-rw-r--r--mod/mod-build-log.cxx3
-rw-r--r--mod/mod-builds.cxx26
-rw-r--r--mod/mod-package-version-details.cxx7
-rw-r--r--mod/options.cli6
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<string> afp, optional<string> ach,
string mnm, string msm,
- optional<butl::target_triplet> 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<butl::target_triplet>;
-
- #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<string> agent_fingerprint,
optional<string> agent_challenge,
string machine, string machine_summary,
- optional<butl::target_triplet> 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<butl::target_triplet> 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 @@
<column name="agent_challenge" type="TEXT" null="true"/>
<column name="machine" type="TEXT" null="false"/>
<column name="machine_summary" type="TEXT" null="false"/>
- <column name="target" type="TEXT" null="true"/>
+ <column name="target" type="TEXT" null="false"/>
<primary-key>
<column name="package_name"/>
<column name="package_version_epoch"/>
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 () : "<default>")
- << 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 (), "<default>")
+ << 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 () : "<default>")
+ << 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<target_triplet>& 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 () : "<default>")
+ << 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 () : "<default>"))
+ 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 () : "<default>"))
+ << 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