From d4aef182ebc55091c02659b7549487d928eaec28 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 27 Feb 2019 23:06:46 +0300 Subject: Build packages for different toolchains having same version but different names --- mod/mod-build-result.cxx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'mod/mod-build-result.cxx') diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index 1052b0a..18dc146 100644 --- a/mod/mod-build-result.cxx +++ b/mod/mod-build-result.cxx @@ -109,9 +109,9 @@ handle (request& rq, response&) throw invalid_request (400, e.what ()); } - // Parse the task response session to obtain the build configuration name and - // the timestamp, and to make sure the session matches tenant and the result - // manifest's package name, and version. + // Parse the task response session to obtain the build id and the timestamp, + // and to make sure the session matches tenant and the result manifest's + // package name, and version. // build_id id; timestamp session_timestamp; @@ -173,10 +173,24 @@ handle (request& rq, response&) p = s.find ('/', b); // End of configuration name. if (p == string::npos) - throw invalid_argument ("no toolchain version"); + throw invalid_argument ("no toolchain name"); string config (s, b, p - b); + if (config.empty ()) + throw invalid_argument ("empty configuration name"); + + b = p + 1; // Start of toolchain name. + p = s.find ('/', b); // End of toolchain name. + + if (p == string::npos) + throw invalid_argument ("no toolchain version"); + + string toolchain_name (s, b, p - b); + + if (toolchain_name.empty ()) + throw invalid_argument ("empty toolchain name"); + b = p + 1; // Start of toolchain version. p = s.find ('/', b); // End of toolchain version. @@ -187,11 +201,9 @@ handle (request& rq, response&) id = build_id (package_id (move (tenant), move (name), package_version), move (config), + move (toolchain_name), toolchain_version); - if (id.configuration.empty ()) - throw invalid_argument ("empty configuration name"); - try { size_t tsn; -- cgit v1.1