From 86c8ca15782026e1927fd36021a8b2b2972b7d71 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 6 Apr 2019 23:58:31 +0300 Subject: Serialize manifests in long lines mode to CI and package submission notification emails --- mod/mod-ci.cxx | 17 +++++++++++------ mod/mod-submit.cxx | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) (limited to 'mod') 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, ¶ms, &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 (); -- cgit v1.1