From 5163436b00711318baea4fc0ad43a4de8222354a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sun, 14 May 2017 00:37:16 +0300 Subject: Implement builds page --- mod/mod-build-result.cxx | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) (limited to 'mod/mod-build-result.cxx') diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index d8b647a..0574996 100644 --- a/mod/mod-build-result.cxx +++ b/mod/mod-build-result.cxx @@ -4,7 +4,8 @@ #include -#include // find_if() +#include +#include #include #include @@ -13,11 +14,7 @@ #include -#include -#include - #include -#include #include #include @@ -25,11 +22,11 @@ #include #include +#include // *_url() using namespace std; using namespace butl; using namespace bbot; -using namespace web; using namespace brep::cli; using namespace odb::core; @@ -207,12 +204,8 @@ handle (request& rq, response&) // Make sure the build configuration still exists. // - auto i ( - find_if ( - build_conf_->begin (), build_conf_->end (), - [&id] (const build_config& c) {return c.name == id.configuration;})); - - if (i == build_conf_->end ()) + if (build_conf_map_->find (id.configuration.c_str ()) == + build_conf_map_->end ()) { warn_expired ("no build configuration"); return true; @@ -322,35 +315,23 @@ handle (request& rq, response&) sm.out << "No operations results available." << endl; else { - string url (options_->host () + options_->root ().representation ()); - string pkg (mime_url_encode (b->package_name)); - string cfg (mime_url_encode (b->configuration)); - - // Note that '+' is the only package version character that potentially - // needs to be url-encoded, and only in the query part of the URL. - // However, we print the package version either as part of URL path or - // as the build-force URL query part (where it is not encoded by - // design). - // - const version& pvr (b->package_version); - const version& tvr (b->toolchain_version); + const string& host (options_->host ()); + const dir_path& root (options_->root ()); + ostream& os (sm.out); assert (b->status); os << "combined: " << *b->status << endl << endl - << " " << url << pkg << '/' << pvr << "/log/" << cfg << '/' << tvr - << endl << endl; + << " " << build_log_url (host, root, *b) << endl << endl; for (const auto& r: b->results) os << r.operation << ": " << r.status << endl << endl - << " " << url << pkg << '/' << pvr << "/log/" << cfg << '/' - << tvr << '/' << r.operation << endl << endl; + << " " << build_log_url (host, root, *b, &r.operation) + << endl << endl; os << "Force rebuild (enter the reason, use '+' instead of spaces):" << endl << endl - << " " << options_->host () << options_->root () << "?build-force&p=" - << pkg << "&v=" << pvr << "&c=" << cfg << "&t=" << tvr << "&reason=" - << endl; + << " " << force_rebuild_url (host, root, *b) << endl; } sm.out.close (); -- cgit v1.1