aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-04-06 23:58:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-04-08 16:41:06 +0300
commit86c8ca15782026e1927fd36021a8b2b2972b7d71 (patch)
treee10470041f0b7e38e71d8dfa1d7948415b502a62
parentb76f47b910bd924f1384dad71043d39f5dfe1f18 (diff)
Serialize manifests in long lines mode to CI and package submission notification emails
-rw-r--r--mod/mod-ci.cxx17
-rw-r--r--mod/mod-submit.cxx19
2 files changed, 23 insertions, 13 deletions
diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx
index 4572c85..f5efaac 100644
--- a/mod/mod-ci.cxx
+++ b/mod/mod-ci.cxx
@@ -328,11 +328,11 @@ handle (request& rq, response& rs)
&rps,
&params,
&respond_manifest]
- (ostream& os) -> bool
+ (ostream& os, bool long_lines = false) -> bool
{
try
{
- serializer s (os, "request");
+ serializer s (os, "request", long_lines);
// Serialize the submission manifest header.
//
@@ -506,11 +506,12 @@ handle (request& rq, response& rs)
// serialization error log the error description and return false, on the
// stream error pass through the io_error exception, otherwise return true.
//
- auto rsm = [&rvs, &error, &request_id] (ostream& os) -> bool
+ auto rsm = [&rvs, &error, &request_id] (ostream& os,
+ bool long_lines = false) -> bool
{
try
{
- serializer s (os, "result");
+ serializer s (os, "result", long_lines);
for (const manifest_name_value& nv: rvs)
s.next (nv.name, nv.value);
@@ -566,6 +567,8 @@ handle (request& rq, response& rs)
}
// Send email, if configured, and the CI request submission is not simulated.
+ // Use the long lines manifest serialization mode for the convenience of
+ // copying/clicking URLs they contain.
//
// Note that we don't consider the email sending failure to be a submission
// failure as the submission data is successfully persisted and the handler
@@ -591,14 +594,16 @@ handle (request& rq, response& rs)
// Write the submission request manifest.
//
- bool r (rqm (sm.out));
+ bool r (rqm (sm.out, true /* long_lines */));
assert (r); // The serialization succeeded once, so can't fail now.
// Write the submission result manifest.
//
sm.out << "\n\n";
- rsm (sm.out); // We don't care about the result (see above).
+ // We don't care about the result (see above).
+ //
+ rsm (sm.out, true /* long_lines */);
sm.out.close ();
diff --git a/mod/mod-submit.cxx b/mod/mod-submit.cxx
index 9a93492..ac98268 100644
--- a/mod/mod-submit.cxx
+++ b/mod/mod-submit.cxx
@@ -399,11 +399,11 @@ handle (request& rq, response& rs)
timestamp ts (system_clock::now ());
auto rqm = [&a, &sha256sum, &ts, &simulate, &rq, &rps, &respond_manifest]
- (ostream& os) -> bool
+ (ostream& os, bool long_lines = false) -> bool
{
try
{
- serializer s (os, "request");
+ serializer s (os, "request", long_lines);
// Serialize the submission manifest header.
//
@@ -614,11 +614,12 @@ handle (request& rq, response& rs)
// serialization error log the error description and return false, on the
// stream error pass through the io_error exception, otherwise return true.
//
- auto rsm = [&rvs, &error, &ref] (ostream& os) -> bool
+ auto rsm = [&rvs, &error, &ref] (ostream& os,
+ bool long_lines = false) -> bool
{
try
{
- serializer s (os, "result");
+ serializer s (os, "result", long_lines);
for (const manifest_name_value& nv: rvs)
s.next (nv.name, nv.value);
@@ -672,7 +673,9 @@ handle (request& rq, response& rs)
}
}
- // Send email, if configured, and the submission is not simulated.
+ // Send email, if configured, and the submission is not simulated. Use the
+ // long lines manifest serialization mode for the convenience of
+ // copying/clicking URLs they contain.
//
// Note that we don't consider the email sending failure to be a submission
// failure as the submission data is successfully persisted and the handler
@@ -695,14 +698,16 @@ handle (request& rq, response& rs)
// Write the submission request manifest.
//
- bool r (rqm (sm.out));
+ bool r (rqm (sm.out, true /* long_lines */));
assert (r); // The serialization succeeded once, so can't fail now.
// Write the submission result manifest.
//
sm.out << "\n\n";
- rsm (sm.out); // We don't care about the result (see above).
+ // We don't care about the result (see above).
+ //
+ rsm (sm.out, true /* long_lines */);
sm.out.close ();