aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-build-log.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-09-05 21:23:41 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-08 17:44:57 +0300
commit70c1cdfd8f34472761fe5ec97f0713990c1b4f5b (patch)
treef2e631c10563bcc0cde07e4359c11b800a188d86 /mod/mod-build-log.cxx
parent3be834183ae36c321e4b560dce9a63cee846e63d (diff)
Add multi-tenancy support
Diffstat (limited to 'mod/mod-build-log.cxx')
-rw-r--r--mod/mod-build-log.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 57135b6..70e2c7e 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -78,13 +78,22 @@ handle (request& rq, response& rs)
path lpath (rq.path ().leaf (options_->root ()));
+ // If the tenant is not empty then it is contained in the leftmost path
+ // component (see repository_root for details). Strip it if that's the case.
+ //
+ if (!tenant.empty ())
+ {
+ assert (!lpath.empty ());
+ lpath = path (++lpath.begin (), lpath.end ());
+ }
+
+ assert (!lpath.empty ());
+
try
{
auto i (lpath.begin ());
- assert (i != lpath.end ());
package_name name;
-
try
{
name = package_name (*i++);
@@ -127,7 +136,7 @@ handle (request& rq, response& rs)
version toolchain_version (parse_version (*i++, "toolchain version"));
- id = build_id (package_id (move (name), package_version),
+ id = build_id (package_id (tenant, move (name), package_version),
move (config),
toolchain_version);
@@ -164,6 +173,7 @@ handle (request& rq, response& rs)
auto config_expired = [&trace, &lpath, this] (const string& d)
{
l2 ([&]{trace << "package build configuration for " << lpath
+ << (!tenant.empty () ? "(" + tenant + ")" : "")
<< " expired: " << d;});
throw invalid_request (404, "package build configuration expired: " + d);
@@ -204,6 +214,8 @@ handle (request& rq, response& rs)
auto print_header = [&os, &b] ()
{
+ // @@ Should we print the tenant? How to call it if that's the case?
+ //
os << "package: " << b->package_name << endl
<< "version: " << b->package_version << endl
<< "toolchain: " << b->toolchain_name << '-' << b->toolchain_version