diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-02-27 23:06:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-02-28 20:18:39 +0300 |
commit | d4aef182ebc55091c02659b7549487d928eaec28 (patch) | |
tree | 881d1d8bedbc7f88fe22a9437cce6433cfd7122d /mod | |
parent | 8054f2973d453b71806f52f0bb30725cb31d64dd (diff) |
Build packages for different toolchains having same version but different names
Diffstat (limited to 'mod')
-rw-r--r-- | mod/build.cxx | 7 | ||||
-rw-r--r-- | mod/mod-build-force.cxx | 18 | ||||
-rw-r--r-- | mod/mod-build-log.cxx | 16 | ||||
-rw-r--r-- | mod/mod-build-result.cxx | 26 | ||||
-rw-r--r-- | mod/mod-build-task.cxx | 16 | ||||
-rw-r--r-- | mod/mod-builds.cxx | 7 | ||||
-rw-r--r-- | mod/options.cli | 6 |
7 files changed, 68 insertions, 28 deletions
diff --git a/mod/build.cxx b/mod/build.cxx index fb23667..32f3691 100644 --- a/mod/build.cxx +++ b/mod/build.cxx @@ -24,7 +24,8 @@ namespace brep string url (host + tenant_dir (root, b.tenant).representation () + mime_url_encode (b.package_name.string (), false) + '/' + b.package_version.string () + "/log/" + - mime_url_encode (b.configuration, false) + '/' + + mime_url_encode (b.configuration, false /* query */) + '/' + + mime_url_encode (b.toolchain_name, false /* query */) + '/' + b.toolchain_version.string ()); if (op != nullptr) @@ -48,6 +49,8 @@ namespace brep "?build-force&pn=" + mime_url_encode (b.package_name.string ()) + "&pv=" + b.package_version.string () + "&cf=" + mime_url_encode (b.configuration) + - "&tc=" + b.toolchain_version.string () + "&reason="; + "&tn=" + mime_url_encode (b.toolchain_name) + + "&tv=" + b.toolchain_version.string () + + "&reason="; } } diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx index f94cf75..2c6ac64 100644 --- a/mod/mod-build-force.cxx +++ b/mod/mod-build-force.cxx @@ -118,16 +118,22 @@ handle (request& rq, response& rs) version package_version (parse_version (params.version (), "package version")); - version toolchain_version (parse_version (params.toolchain_version (), - "toolchain version")); + string& config (params.configuration ()); - string& c (params.configuration ()); - - if (c.empty ()) + if (config.empty ()) throw invalid_argument ("no configuration name"); + string& toolchain_name (params.toolchain_name ()); + + if (toolchain_name.empty ()) + throw invalid_argument ("no toolchain name"); + + version toolchain_version (parse_version (params.toolchain_version (), + "toolchain version")); + id = build_id (package_id (move (tenant), move (p), package_version), - move (c), + move (config), + move (toolchain_name), toolchain_version); } catch (const invalid_argument& e) diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx index 3dac599..c61ad92 100644 --- a/mod/mod-build-log.cxx +++ b/mod/mod-build-log.cxx @@ -66,13 +66,12 @@ handle (request& rq, response& rs) throw invalid_request (501, "not implemented"); // Parse the HTTP request URL path (without the root directory) to obtain - // the build package name/version, the configuration name and the optional - // operation name. If the operation is not specified then print logs for all - // the operations. + // the build id and optional operation name. If the operation is not + // specified then print logs for all the operations. // // Note that the URL path must be in the following form: // - // <pkg-name>/<pkg-version>/log/<cfg-name>/<toolchain-version>[/<operation>] + // <pkg-name>/<pkg-version>/log/<cfg-name>/<toolchain-name>/<toolchain-version>[/<operation>] // // Also note that the presence of the first 3 components is guaranteed by // the repository_root module. @@ -136,12 +135,21 @@ handle (request& rq, response& rs) throw invalid_argument ("empty configuration name"); if (i == lpath.end ()) + throw invalid_argument ("no toolchain name"); + + string toolchain_name (*i++); + + if (toolchain_name.empty ()) + throw invalid_argument ("empty toolchain name"); + + if (i == lpath.end ()) throw invalid_argument ("no toolchain version"); version toolchain_version (parse_version (*i++, "toolchain version")); id = build_id (package_id (tenant, move (name), package_version), move (config), + move (toolchain_name), toolchain_version); if (i != lpath.end ()) 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; diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index 79ab23b..27f884e 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -204,6 +204,7 @@ handle (request& rq, response& rs) b->package_name.string () + '/' + b->package_version.string () + '/' + b->configuration + '/' + + b->toolchain_name + '/' + b->toolchain_version.string () + '/' + to_string (ts)); @@ -401,9 +402,11 @@ handle (request& rq, response& rs) bld_query::id.configuration.in_range (cfg_names.begin (), cfg_names.end ()) && + bld_query::id.toolchain_name == tqm.toolchain_name && + compare_version_eq (bld_query::id.toolchain_version, toolchain_version, - true) && + true /* revision */) && (bld_query::state == "built" || ((bld_query::force == "forcing" && @@ -489,7 +492,12 @@ handle (request& rq, response& rs) { config_machine& cm (i->second); machine_header_manifest& mh (*cm.machine); - build_id bid (move (id), cm.config->name, toolchain_version); + + build_id bid (move (id), + cm.config->name, + move (tqm.toolchain_name), + toolchain_version); + shared_ptr<build> b (build_db_->find<build> (bid)); optional<string> cl (challenge ()); @@ -503,7 +511,7 @@ handle (request& rq, response& rs) move (bid.package.name), move (bp.version), move (bid.configuration), - move (tqm.toolchain_name), + move (bid.toolchain_name), move (toolchain_version), move (agent_fp), move (cl), @@ -540,7 +548,6 @@ handle (request& rq, response& rs) if (b->force == force_state::forcing) b->force = force_state::forced; - b->toolchain_name = move (tqm.toolchain_name); b->agent_fingerprint = move (agent_fp); b->agent_challenge = move (cl); b->machine = mh.name; @@ -649,7 +656,6 @@ handle (request& rq, response& rs) // b->agent_fingerprint = agent_fp; b->agent_challenge = cl; - b->toolchain_name = tqm.toolchain_name; const machine_header_manifest& mh (*cm.machine); b->machine = mh.name; diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx index 187f9b8..d7bebd0 100644 --- a/mod/mod-builds.cxx +++ b/mod/mod-builds.cxx @@ -149,8 +149,9 @@ build_query (const brep::cstrings* configs, string tn (tc, 0, p); version tv (string (tc, p + 1)); // May throw invalid_argument. - q = q && qb::toolchain_name == tn && - compare_version_eq (qb::id.toolchain_version, tv, true); + q = q && + qb::id.toolchain_name == tn && + compare_version_eq (qb::id.toolchain_version, tv, true); } // Build configuration name. @@ -358,7 +359,7 @@ handle (request& rq, response& rs) toolchains r; for (auto& t: build_db_->query<toolchain> ( (tn ? query::build::id.package.tenant == *tn : query (true)) + - "ORDER BY" + query::build::toolchain_name + + "ORDER BY" + query::build::id.toolchain_name + order_by_version_desc (query::build::id.toolchain_version, false))) r.emplace_back (move (t.name), move (t.version)); diff --git a/mod/options.cli b/mod/options.cli index ae7a00f..01309dc 100644 --- a/mod/options.cli +++ b/mod/options.cli @@ -665,9 +665,13 @@ namespace brep // string configuration | cf; + // Toolchain name. + // + string toolchain_name | tn; + // Toolchain version. May not be url-encoded (see above). // - string toolchain_version | tc; + string toolchain_version | tv; // Package rebuild reason. Must not be empty. // |