aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbrep/build.cxx9
-rw-r--r--libbrep/build.hxx21
-rw-r--r--libbrep/build.xml27
-rw-r--r--libbrep/version.hxx.in1
-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
9 files changed, 173 insertions, 70 deletions
diff --git a/libbrep/build.cxx b/libbrep/build.cxx
index 710c0b2..c0b780d 100644
--- a/libbrep/build.cxx
+++ b/libbrep/build.cxx
@@ -33,11 +33,16 @@ namespace brep
// build
//
build::
- build (string pnm, version pvr, string cfg, string mnm, string msm)
- : id (package_id (move (pnm), pvr), move (cfg)),
+ build (string pnm, version pvr,
+ string cfg,
+ string tnm, version tvr,
+ string mnm, string msm)
+ : id (package_id (move (pnm), pvr), move (cfg), tvr),
package_name (id.package.name),
package_version (move (pvr)),
configuration (id.configuration),
+ toolchain_name (move (tnm)),
+ toolchain_version (move (tvr)),
state (build_state::testing),
timestamp (timestamp_type::clock::now ()),
forced (false),
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index d28f5ab..86630a7 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -39,10 +39,14 @@ namespace brep
{
package_id package;
string configuration;
+ canonical_version toolchain_version;
build_id () = default;
- build_id (package_id p, string c)
- : package (move (p)), configuration (move (c)) {}
+ build_id (package_id p, string c, const brep::version& v)
+ : package (move (p)),
+ configuration (move (c)),
+ toolchain_version {
+ v.epoch, v.canonical_upstream, v.canonical_release, v.revision} {}
};
inline bool
@@ -104,15 +108,18 @@ namespace brep
// Create the build object with the testing state, non-existent status,
// the timestamp set to now and the forced flag set to false.
//
- build (string name, version,
+ build (string package_name, version package_version,
string configuration,
+ string toolchain_name, version toolchain_version,
string machine, string machine_summary);
build_id id;
- string& package_name; // Tracks id.package.name.
- upstream_version package_version; // Original of id.package.version.
- string& configuration; // Tracks id.configuration.
+ string& package_name; // Tracks id.package.name.
+ upstream_version package_version; // Original of id.package.version.
+ string& configuration; // Tracks id.configuration.
+ string toolchain_name;
+ upstream_version toolchain_version; // Original of id.toolchain_version.
build_state state;
@@ -150,6 +157,8 @@ namespace brep
#pragma db member(package_version) \
set(this.package_version.init (this.id.package.version, (?)))
#pragma db member(configuration) transient
+ #pragma db member(toolchain_version) \
+ set(this.toolchain_version.init (this.id.toolchain_version, (?)))
#pragma db member(results) id_column("") value_column("")
diff --git a/libbrep/build.xml b/libbrep/build.xml
index 8d9178a..5793de3 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -7,8 +7,15 @@
<column name="package_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="package_version_revision" type="INTEGER" null="false"/>
<column name="configuration" type="TEXT" null="false"/>
+ <column name="toolchain_version_epoch" type="INTEGER" null="false"/>
+ <column name="toolchain_version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="toolchain_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="toolchain_version_revision" type="INTEGER" null="false"/>
<column name="package_version_upstream" type="TEXT" null="false"/>
<column name="package_version_release" type="TEXT" null="true"/>
+ <column name="toolchain_name" type="TEXT" null="false"/>
+ <column name="toolchain_version_upstream" type="TEXT" null="false"/>
+ <column name="toolchain_version_release" type="TEXT" null="true"/>
<column name="state" type="TEXT" null="false"/>
<column name="timestamp" type="BIGINT" null="false"/>
<column name="forced" type="BOOLEAN" null="false"/>
@@ -22,6 +29,10 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_version_epoch"/>
+ <column name="toolchain_version_canonical_upstream"/>
+ <column name="toolchain_version_canonical_release"/>
+ <column name="toolchain_version_revision"/>
</primary-key>
</table>
<table name="build_results" kind="container">
@@ -31,6 +42,10 @@
<column name="package_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="package_version_revision" type="INTEGER" null="false"/>
<column name="configuration" type="TEXT" null="false"/>
+ <column name="toolchain_version_epoch" type="INTEGER" null="false"/>
+ <column name="toolchain_version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="toolchain_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="toolchain_version_revision" type="INTEGER" null="false"/>
<column name="index" type="BIGINT" null="false"/>
<column name="operation" type="TEXT" null="false"/>
<column name="status" type="TEXT" null="false"/>
@@ -42,6 +57,10 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_version_epoch"/>
+ <column name="toolchain_version_canonical_upstream"/>
+ <column name="toolchain_version_canonical_release"/>
+ <column name="toolchain_version_revision"/>
<references table="build">
<column name="package_name"/>
<column name="package_version_epoch"/>
@@ -49,6 +68,10 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_version_epoch"/>
+ <column name="toolchain_version_canonical_upstream"/>
+ <column name="toolchain_version_canonical_release"/>
+ <column name="toolchain_version_revision"/>
</references>
</foreign-key>
<index name="build_results_object_id_i">
@@ -58,6 +81,10 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_version_epoch"/>
+ <column name="toolchain_version_canonical_upstream"/>
+ <column name="toolchain_version_canonical_release"/>
+ <column name="toolchain_version_revision"/>
</index>
<index name="build_results_index_i">
<column name="index"/>
diff --git a/libbrep/version.hxx.in b/libbrep/version.hxx.in
index e3c52ce..437163f 100644
--- a/libbrep/version.hxx.in
+++ b/libbrep/version.hxx.in
@@ -70,5 +70,6 @@ $libstudxml.check(LIBSTUDXML_VERSION, LIBSTUDXML_SNAPSHOT)$
//
#define LIBBREP_VERSION BREP_VERSION
#define LIBBREP_VERSION_STR BREP_VERSION_STR
+#define LIBBREP_VERSION_ID BREP_VERSION_ID
#endif // BREP_VERSION
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;