aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-04-24 23:23:01 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-04-24 23:28:38 +0300
commit7e8fb49f7c5829ed5a6ac4a46deb54a3e65dfad5 (patch)
tree281f12a774c07db49b53059d8c821de18b2cbbc5
parent0cde847a1bb31f2b6c66e3d557a8bacc0e9186c4 (diff)
Adjust build result logs page
-rw-r--r--brep/build9
-rw-r--r--brep/build.cxx6
-rw-r--r--brep/build.xml2
-rw-r--r--mod/mod-build-log.cxx19
-rw-r--r--mod/mod-build-task.cxx30
5 files changed, 53 insertions, 13 deletions
diff --git a/brep/build b/brep/build
index 42798bb..43ca230 100644
--- a/brep/build
+++ b/brep/build
@@ -104,7 +104,9 @@ 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, string configuration);
+ build (string name, version,
+ string configuration,
+ string machine, string machine_summary);
build_id id;
@@ -126,6 +128,11 @@ namespace brep
//
optional<result_status> status;
+ // Present only if the state is 'testing' or 'tested'.
+ //
+ optional<string> machine;
+ optional<string> machine_summary;
+
// 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/brep/build.cxx b/brep/build.cxx
index 48235f5..d795ba6 100644
--- a/brep/build.cxx
+++ b/brep/build.cxx
@@ -33,14 +33,16 @@ namespace brep
// build
//
build::
- build (string pnm, version pvr, string cfg)
+ build (string pnm, version pvr, string cfg, string mnm, string msm)
: id (package_id (move (pnm), pvr), move (cfg)),
package_name (id.package.name),
package_version (move (pvr)),
configuration (id.configuration),
state (build_state::testing),
timestamp (timestamp_type::clock::now ()),
- forced (false)
+ forced (false),
+ machine (move (mnm)),
+ machine_summary (move (msm))
{
}
}
diff --git a/brep/build.xml b/brep/build.xml
index 2a222f4..8d9178a 100644
--- a/brep/build.xml
+++ b/brep/build.xml
@@ -13,6 +13,8 @@
<column name="timestamp" type="BIGINT" null="false"/>
<column name="forced" type="BOOLEAN" null="false"/>
<column name="status" type="TEXT" null="true"/>
+ <column name="machine" type="TEXT" null="true"/>
+ <column name="machine_summary" type="TEXT" null="true"/>
<primary-key>
<column name="package_name"/>
<column name="package_version_epoch"/>
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 5342e3e..543292a 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -197,9 +197,25 @@ handle (request& rq, response& rs)
//
ostream& os (rs.content (200, "text/plain;charset=utf-8", false));
+ 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;
+
if (op.empty ())
{
for (const auto& r: b->results)
+ os << r.operation << ": " << r.status << endl;
+
+ os << endl;
+
+ for (const auto& r: b->results)
os << r.log;
}
else
@@ -213,7 +229,8 @@ handle (request& rq, response& rs)
if (i == r.end ())
config_expired ("no operation");
- os << i->log;
+ os << op << ": " << i->status << endl << endl
+ << i->log;
}
return true;
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index 63ea327..1c88759 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -106,7 +106,7 @@ handle (request& rq, response& rs)
struct config_machine
{
const build_config* config;
- const machine_header_manifest* machine;
+ machine_header_manifest* machine;
};
using config_machines = map<const char*, config_machine, compare_c_string>;
@@ -346,6 +346,7 @@ handle (request& rq, response& rs)
if (!configs.empty ())
{
config_machine& cm (configs.begin ()->second);
+ machine_header_manifest& mh (*cm.machine);
build_id bid (move (id), cm.config->name);
shared_ptr<build> b (build_db_->find<build> (bid));
@@ -357,7 +358,9 @@ handle (request& rq, response& rs)
{
b = make_shared<build> (move (bid.package.name),
move (pv.version),
- move (bid.configuration));
+ move (bid.configuration),
+ mh.name,
+ move (mh.summary));
build_db_->persist (b);
}
@@ -389,6 +392,8 @@ handle (request& rq, response& rs)
b->results.empty ());
b->state = build_state::testing;
+ b->machine = mh.name;
+ b->machine_summary = move (mh.summary);
b->timestamp = timestamp::clock::now ();
build_db_->update (b);
@@ -474,6 +479,14 @@ handle (request& rq, response& rs)
? forced_rebuild_expiration
: normal_rebuild_expiration))
{
+ auto i (cfg_machines.find (b->id.configuration.c_str ()));
+
+ // Only actual package configurations are loaded (see above).
+ //
+ assert (i != cfg_machines.end ());
+ const config_machine& cm (i->second);
+ const machine_header_manifest& mh (*cm.machine);
+
// Load the package (if still present).
//
transaction pt (package_db_->begin (), false);
@@ -495,6 +508,11 @@ handle (request& rq, response& rs)
assert (b->status);
b->state = build_state::testing;
+ b->machine = mh.name;
+
+ // Can't move from, as may need it on the next iteration.
+ //
+ b->machine_summary = mh.summary;
// Mark the section as loaded, so results are updated.
//
@@ -505,13 +523,7 @@ handle (request& rq, response& rs)
build_db_->update (b);
- auto i (cfg_machines.find (b->id.configuration.c_str ()));
-
- // Only actual package configurations are loaded (see above).
- //
- assert (i != cfg_machines.end ());
-
- tsm = task (move (b), move (p), i->second);
+ tsm = task (move (b), move (p), cm);
}
}