aboutsummaryrefslogtreecommitdiff
path: root/mod/build-config.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-14 00:37:16 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-15 20:37:43 +0300
commit5163436b00711318baea4fc0ad43a4de8222354a (patch)
treea05c06693bda84dd9a9b365a50c227126a5ec05f /mod/build-config.cxx
parent2ebf9de408f3fd629126a20b21221e186195813c (diff)
Implement builds page
Diffstat (limited to 'mod/build-config.cxx')
-rw-r--r--mod/build-config.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/mod/build-config.cxx b/mod/build-config.cxx
index 9cbd1bf..5fd540f 100644
--- a/mod/build-config.cxx
+++ b/mod/build-config.cxx
@@ -6,8 +6,11 @@
#include <map>
+#include <web/mime-url-encoding.hxx>
+
namespace brep
{
+ using namespace web;
using namespace bbot;
shared_ptr<const build_configs>
@@ -28,4 +31,43 @@ namespace brep
configs[p] = c;
return c;
}
+
+ string
+ build_log_url (const string& host, const dir_path& root,
+ const build& b,
+ const string* op)
+ {
+ // Note that '+' is the only package version character that potentially
+ // needs to be url-encoded, and only in the query part of the URL. We embed
+ // the package version into the URL path part and so don't encode it.
+ //
+ string url (host + root.representation () +
+ mime_url_encode (b.package_name) + '/' +
+ b.package_version.string () + "/log/" +
+ mime_url_encode (b.configuration) + '/' +
+ b.toolchain_version.string ());
+
+ if (op != nullptr)
+ {
+ url += '/';
+ url += *op;
+ }
+
+ return url;
+ }
+
+ string
+ force_rebuild_url (const string& host, const dir_path& root, const build& b)
+ {
+ // 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 embed the package version into the URL query part, where it is not
+ // encoded by design.
+ //
+ return host + root.string () +
+ "?build-force&p=" + mime_url_encode (b.package_name) +
+ "&v=" + b.package_version.string () +
+ "&c=" + mime_url_encode (b.configuration) +
+ "&t=" + b.toolchain_version.string () + "&reason=";
+ }
}