aboutsummaryrefslogtreecommitdiff
path: root/mod/build.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/build.cxx')
-rw-r--r--mod/build.cxx53
1 files changed, 53 insertions, 0 deletions
diff --git a/mod/build.cxx b/mod/build.cxx
new file mode 100644
index 0000000..6ad2b93
--- /dev/null
+++ b/mod/build.cxx
@@ -0,0 +1,53 @@
+// file : mod/build.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <mod/build.hxx>
+
+#include <web/mime-url-encoding.hxx>
+
+#include <mod/utility.hxx>
+
+namespace brep
+{
+ using namespace web;
+
+ 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 + 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) + '/' +
+ b.toolchain_version.string ());
+
+ if (op != nullptr)
+ {
+ url += '/';
+ url += *op;
+ }
+
+ return url;
+ }
+
+ string
+ build_force_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 + tenant_dir (root, b.tenant).string () +
+ "?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=";
+ }
+}