aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-build-force.cxx44
-rw-r--r--mod/mod-build-log.cxx57
-rw-r--r--mod/mod-build-result.cxx58
-rw-r--r--mod/mod-build-task.cxx18
-rw-r--r--mod/options.cli8
5 files changed, 123 insertions, 62 deletions
diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx
index e0c641e..90e6b92 100644
--- a/mod/mod-build-force.cxx
+++ b/mod/mod-build-force.cxx
@@ -79,7 +79,6 @@ handle (request& rq, response& rs)
throw invalid_request (400, "missing rebuild reason");
build_id id;
- version version; // Keep for logging.
try
{
@@ -93,27 +92,38 @@ handle (request& rq, response& rs)
// the space character (that is otherwise forbidden in version
// representation) to the plus character.
//
- string& v (params.version ());
- replace (v.begin (), v.end (), ' ', '+');
-
- // Intercept exception handling to add the parsing error attribution.
+ // @@ Move to types-parsers.hxx?
//
- try
- {
- version = brep::version (v);
- }
- catch (const invalid_argument& e)
+ auto parse_version = [] (string& v, const char* what) -> version
{
- throw invalid_argument (
- string ("invalid package version: ") + e.what ());
- }
+ replace (v.begin (), v.end (), ' ', '+');
+
+ // Intercept exception handling to add the parsing error attribution.
+ //
+ try
+ {
+ return brep::version (v);
+ }
+ catch (const invalid_argument& e)
+ {
+ throw invalid_argument (string ("invalid ") + what + ": " + e.what ());
+ }
+ };
+
+ version package_version (parse_version (params.version (),
+ "package version"));
+
+ version toolchain_version (parse_version (params.toolchain_version (),
+ "toolchain version"));
string& c (params.configuration ());
if (c.empty ())
throw invalid_argument ("no configuration name");
- id = build_id (package_id (move (p), version), move (c));
+ id = build_id (package_id (move (p), package_version),
+ move (c),
+ toolchain_version);
}
catch (const invalid_argument& e)
{
@@ -172,8 +182,10 @@ handle (request& rq, response& rs)
build_db_->update (b);
l1 ([&]{trace << "force rebuild for "
- << id.package.name << '/' << version << ' '
- << id.configuration << ": " << reason;});
+ << b->package_name << '/' << b->package_version << ' '
+ << b->configuration << ' '
+ << b->toolchain_name << '-' << b->toolchain_version
+ << ": " << reason;});
}
t.commit ();
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 09591b9..bf64ddb 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -71,7 +71,7 @@ handle (request& rq, response& rs)
//
// Note that the URL path must be in the following form:
//
- // <package-name>/<package-version>/log/<config-name>[/<operation>]
+ // <pkg-name>/<pkg-version>/log/<cfg-name>/<toolchain-version>[/<operation>]
//
// Also note that the presence of the first 3 components is guaranteed by
// the repository_root module.
@@ -93,30 +93,41 @@ handle (request& rq, response& rs)
assert (i != lpath.end ());
- version version;
-
- // Intercept exception handling to add the parsing error attribution.
- //
- try
- {
- version = brep::version (*i++);
- }
- catch (const invalid_argument& e)
+ auto parse_version = [] (const string& v, const char* what) -> version
{
- throw invalid_argument (
- string ("invalid package version: ") + e.what ());
- }
+ // Intercept exception handling to add the parsing error attribution.
+ //
+ try
+ {
+ return brep::version (v);
+ }
+ catch (const invalid_argument& e)
+ {
+ throw invalid_argument (string ("invalid ") + what + ": " + e.what ());
+ }
+ };
+
+ version package_version (parse_version (*i++, "package version"));
assert (i != lpath.end () && *i == "log");
if (++i == lpath.end ())
throw invalid_argument ("no configuration name");
- id = build_id (package_id (move (name), version), *i++);
+ string config (*i++);
- if (id.configuration.empty ())
+ if (config.empty ())
throw invalid_argument ("empty configuration name");
+ if (i == lpath.end ())
+ throw invalid_argument ("no toolchain version");
+
+ version toolchain_version (parse_version (*i++, "toolchain version"));
+
+ id = build_id (package_id (move (name), package_version),
+ move (config),
+ toolchain_version);
+
if (i != lpath.end ())
op = *i++;
@@ -199,13 +210,15 @@ handle (request& rq, response& rs)
assert (b->machine && b->machine_summary);
- os << "package: " << b->package_name << endl
- << "version: " << b->package_version << endl
- << "config: " << b->configuration << endl
- << "machine: " << *b->machine << " (" << *b->machine_summary << ")"
- << endl
- << "target: " << (i->target ? i->target->string () : "default") << endl
- << endl;
+ os << "package: " << b->package_name << endl
+ << "version: " << b->package_version << endl
+ << "config: " << b->configuration << endl
+ << "toolchain: " << b->toolchain_name << '-' << b->toolchain_version
+ << endl
+ << "machine: " << *b->machine << " (" << *b->machine_summary << ")"
+ << endl
+ << "target: " << (i->target ? i->target->string () : "default") << endl
+ << endl;
if (op.empty ())
{
diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx
index c6b789a..d8b647a 100644
--- a/mod/mod-build-result.cxx
+++ b/mod/mod-build-result.cxx
@@ -128,30 +128,44 @@ handle (request& rq, response&)
if (p == string::npos)
throw invalid_argument ("no configuration name");
- version version;
-
- // Intercept exception handling to add the parsing error attribution.
- //
- try
- {
- version = brep::version (string (s, b, p - b));
- }
- catch (const invalid_argument& e)
+ auto parse_version = [&s, &b, &p] (const char* what) -> version
{
- throw invalid_argument (
- string ("invalid package version: ") + e.what ());
- }
+ // Intercept exception handling to add the parsing error attribution.
+ //
+ try
+ {
+ return brep::version (string (s, b, p - b));
+ }
+ catch (const invalid_argument& e)
+ {
+ throw invalid_argument (string ("invalid ") + what + ": " + e.what ());
+ }
+ };
- if (version != rqm.result.version)
+ version package_version (parse_version ("package version"));
+
+ if (package_version != rqm.result.version)
throw invalid_argument ("package version mismatch");
b = p + 1; // Start of configuration name.
p = s.find ('/', b); // End of configuration name.
if (p == string::npos)
+ throw invalid_argument ("no toolchain version");
+
+ string config (s, b, p - b);
+
+ b = p + 1; // Start of toolchain version.
+ p = s.find ('/', b); // End of toolchain version.
+
+ if (p == string::npos)
throw invalid_argument ("no timestamp");
- id = build_id (package_id (move (name), version), string (s, b, p - b));
+ version toolchain_version (parse_version ("toolchain version"));
+
+ id = build_id (package_id (move (name), package_version),
+ move (config),
+ toolchain_version);
if (id.configuration.empty ())
throw invalid_argument ("empty configuration name");
@@ -276,7 +290,8 @@ handle (request& rq, response&)
try
{
string subj (to_string (*b->status) + ": " + b->package_name + '/' +
- b->package_version.string () + '/' + b->configuration);
+ b->package_version.string () + '/' + b->configuration + '/' +
+ b->toolchain_name + '-' + b->toolchain_version.string ());
// If the package build address is not specified, then it is assumed to be
// the same as the package email address, if specified, otherwise as the
@@ -317,22 +332,25 @@ handle (request& rq, response&)
// as the build-force URL query part (where it is not encoded by
// design).
//
- const version& ver (b->package_version);
+ const version& pvr (b->package_version);
+ const version& tvr (b->toolchain_version);
ostream& os (sm.out);
assert (b->status);
os << "combined: " << *b->status << endl << endl
- << " " << url << pkg << '/' << ver << "/log/" << cfg << endl << endl;
+ << " " << url << pkg << '/' << pvr << "/log/" << cfg << '/' << tvr
+ << endl << endl;
for (const auto& r: b->results)
os << r.operation << ": " << r.status << endl << endl
- << " " << url << pkg << '/' << ver << "/log/" << cfg << '/'
- << r.operation << endl << endl;
+ << " " << url << pkg << '/' << pvr << "/log/" << cfg << '/'
+ << tvr << '/' << r.operation << endl << endl;
os << "Force rebuild (enter the reason, use '+' instead of spaces):"
<< endl << endl
<< " " << options_->host () << options_->root () << "?build-force&p="
- << pkg << "&v=" << ver << "&c=" << cfg << "&reason=" << endl;
+ << pkg << "&v=" << pvr << "&c=" << cfg << "&t=" << tvr << "&reason="
+ << endl;
}
sm.out.close ();
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index bff5b7e..d75c73d 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -154,7 +154,9 @@ handle (request& rq, response& rs)
b->timestamp.time_since_epoch ()).count ());
string session (b->package_name + '/' + b->package_version.string () +
- '/' + b->configuration + '/' + to_string (ts));
+ '/' + b->configuration +
+ '/' + b->toolchain_version.string () +
+ '/' + to_string (ts));
string result_url (options_->host () + options_->root ().string () +
"?build-result");
@@ -206,6 +208,10 @@ handle (request& rq, response& rs)
timestamp normal_rebuild_expiration (
expiration (options_->build_normal_rebuild_timeout ()));
+ // Convert butl::standard_version type to brep::version.
+ //
+ brep::version toolchain_version (tqm.toolchain_version.string ());
+
// Prepare the package version prepared query.
//
// Note that the number of packages can be large and so, in order not to
@@ -284,6 +290,10 @@ handle (request& rq, response& rs)
bld_query::id.configuration.in_range (cfg_names.begin (),
cfg_names.end ()) &&
+ compare_version_eq (bld_query::id.toolchain_version,
+ toolchain_version,
+ true) &&
+
(bld_query::state == "tested" ||
(bld_query::state == "testing" &&
bld_query::timestamp > build_expiration_ns)));
@@ -358,7 +368,7 @@ handle (request& rq, response& rs)
{
config_machine& cm (configs.begin ()->second);
machine_header_manifest& mh (*cm.machine);
- build_id bid (move (id), cm.config->name);
+ build_id bid (move (id), cm.config->name, toolchain_version);
shared_ptr<build> b (build_db_->find<build> (bid));
// If build configuration doesn't exist then create the new one
@@ -370,6 +380,8 @@ handle (request& rq, response& rs)
b = make_shared<build> (move (bid.package.name),
move (pv.version),
move (bid.configuration),
+ move (tqm.toolchain_name),
+ move (toolchain_version),
mh.name,
move (mh.summary));
@@ -403,6 +415,7 @@ handle (request& rq, response& rs)
b->results.empty ());
b->state = build_state::testing;
+ b->toolchain_name = move (tqm.toolchain_name);
b->machine = mh.name;
b->machine_summary = move (mh.summary);
b->timestamp = timestamp::clock::now ();
@@ -523,6 +536,7 @@ handle (request& rq, response& rs)
// Can't move from, as may need it on the next iteration.
//
+ b->toolchain_name = tqm.toolchain_name;
b->machine_summary = mh.summary;
// Mark the section as loaded, so results are updated.
diff --git a/mod/options.cli b/mod/options.cli
index 46bc3fa..888a591 100644
--- a/mod/options.cli
+++ b/mod/options.cli
@@ -384,8 +384,8 @@ namespace brep
// character). In other words, after url-decoding the space character is
// treated the same way as the plus character.
//
- // @@ Make it of the version type? Maybe after it get moved to libbpkg/types.hxx
- // or at least the second use case appear.
+ // @@ Make it of the version type? Maybe after it get moved to
+ // libbpkg/types.hxx or at least the second use case appear.
//
string version | v;
@@ -393,6 +393,10 @@ namespace brep
//
string configuration | c;
+ // Toolchain version. May not be url-encoded (see above).
+ //
+ string toolchain_version | t;
+
// Package rebuild reason. Must not be empty.
//
string reason;