aboutsummaryrefslogtreecommitdiff
path: root/libbrep/package.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep/package.cxx')
-rw-r--r--libbrep/package.cxx89
1 files changed, 75 insertions, 14 deletions
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index 564fec7..4eb6fe8 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -40,9 +40,15 @@ namespace brep
// tenant
//
tenant::
- tenant (string i)
+ tenant (string i,
+ bool p,
+ optional<string> r,
+ optional<tenant_service> s)
: id (move (i)),
- creation_timestamp (timestamp::clock::now ())
+ private_ (p),
+ interactive (move (r)),
+ creation_timestamp (timestamp::clock::now ()),
+ service (move (s))
{
}
@@ -58,9 +64,9 @@ namespace brep
license_alternatives_type la,
small_vector<string, 5> tp,
small_vector<string, 5> kw,
- optional<string> ds,
- optional<text_type> dt,
- string ch,
+ optional<typed_text> ds,
+ optional<typed_text> pds,
+ optional<typed_text> ch,
optional<manifest_url> ur,
optional<manifest_url> du,
optional<manifest_url> su,
@@ -75,6 +81,9 @@ namespace brep
small_vector<test_dependency, 1> ts,
build_class_exprs bs,
build_constraints_type bc,
+ build_auxiliaries_type ac,
+ package_build_bot_keys bk,
+ package_build_configs bcs,
optional<path> lc,
optional<string> fr,
optional<string> sh,
@@ -91,7 +100,7 @@ namespace brep
topics (move (tp)),
keywords (move (kw)),
description (move (ds)),
- description_type (move (dt)),
+ package_description (move (pds)),
changes (move (ch)),
url (move (ur)),
doc_url (move (du)),
@@ -107,11 +116,19 @@ namespace brep
tests (move (ts)),
builds (move (bs)),
build_constraints (move (bc)),
+ build_auxiliaries (move (ac)),
+ build_bot_keys (move (bk)),
+ build_configs (move (bcs)),
internal_repository (move (rp)),
location (move (lc)),
fragment (move (fr)),
sha256sum (move (sh))
{
+ // The default configuration is always added by the package manifest
+ // parser (see libbpkg/manifest.cxx for details).
+ //
+ assert (find ("default", build_configs) != nullptr);
+
if (stub ())
unbuildable_reason = brep::unbuildable_reason::stub;
else if (!internal_repository->buildable)
@@ -119,6 +136,31 @@ namespace brep
buildable = !unbuildable_reason;
+ // If the package is buildable deduce the custom_bot flag.
+ //
+ if (buildable)
+ {
+ for (const package_build_config& bc: build_configs)
+ {
+ bool custom (!bc.effective_bot_keys (build_bot_keys).empty ());
+
+ if (!custom_bot)
+ {
+ custom_bot = custom;
+ }
+ //
+ // If both the custom and default bots are used by the package, then
+ // reset the custom_bot flag to nullopt and bail out from the build
+ // package configurations loop.
+ //
+ else if (*custom_bot != custom)
+ {
+ custom_bot = nullopt;
+ break;
+ }
+ }
+ }
+
assert (internal_repository->internal);
}
@@ -127,6 +169,8 @@ namespace brep
version_type vr,
build_class_exprs bs,
build_constraints_type bc,
+ build_auxiliaries_type ac,
+ package_build_configs bcs,
shared_ptr<repository_type> rp)
: id (rp->tenant, move (nm), vr),
tenant (id.tenant),
@@ -134,11 +178,18 @@ namespace brep
version (move (vr)),
builds (move (bs)),
build_constraints (move (bc)),
+ build_auxiliaries (move (ac)),
+ build_configs (move (bcs)),
buildable (false),
unbuildable_reason (stub ()
? brep::unbuildable_reason::stub
: brep::unbuildable_reason::external)
{
+ // The default configuration is always added by the package manifest
+ // parser (see libbpkg/manifest.cxx for details).
+ //
+ assert (find ("default", build_configs) != nullptr);
+
assert (!rp->internal);
other_repositories.emplace_back (move (rp));
}
@@ -159,11 +210,11 @@ namespace brep
// Probably drop-box would be better as also tells what are
// the available internal repositories.
//
- string k (project.string () + " " + name.string () + " " +
- version.string () + " " + version.string (true));
+ string k (project.string () + ' ' + name.string () + ' ' +
+ version.string () + ' ' + version.string (true));
if (upstream_version)
- k += " " + *upstream_version;
+ k += ' ' + *upstream_version;
// Add licenses to search keywords.
//
@@ -171,13 +222,13 @@ namespace brep
{
for (const auto& l: la)
{
- k += " " + l;
+ k += ' ' + l;
// If license is say LGPLv2 then LGPL is also a search keyword.
//
size_t n (l.size ());
if (n > 2 && l[n - 2] == 'v' && l[n - 1] >= '0' && l[n - 1] <= '9')
- k += " " + string (l, 0, n - 2);
+ k += ' ' + string (l, 0, n - 2);
}
}
@@ -188,14 +239,24 @@ namespace brep
// Add topics to the second-strongest search keywords.
//
for (const auto& t: topics)
- k2 += " " + t;
+ k2 += ' ' + t;
// Add keywords to the second-strongest search keywords.
//
for (const auto& k: keywords)
- k2 += " " + k;
+ k2 += ' ' + k;
+
+ string d (description ? description->text : "");
+
+ if (package_description)
+ {
+ if (description)
+ d += ' ';
+
+ d += package_description->text;
+ }
- return {move (k), move (k2), description ? *description : "", changes};
+ return {move (k), move (k2), move (d), changes ? changes->text : ""};
}
// repository