aboutsummaryrefslogtreecommitdiff
path: root/libbrep/package.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep/package.cxx')
-rw-r--r--libbrep/package.cxx98
1 files changed, 70 insertions, 28 deletions
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index e6c543d..37795f0 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -1,5 +1,4 @@
// file : libbrep/package.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <libbrep/package.hxx>
@@ -41,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))
{
}
@@ -59,13 +64,13 @@ 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<url_type> ur,
- optional<url_type> du,
- optional<url_type> su,
- optional<url_type> pu,
+ optional<typed_text> ds,
+ optional<typed_text> pds,
+ optional<typed_text> ch,
+ optional<manifest_url> ur,
+ optional<manifest_url> du,
+ optional<manifest_url> su,
+ optional<manifest_url> pu,
optional<email_type> em,
optional<email_type> pe,
optional<email_type> be,
@@ -73,11 +78,11 @@ namespace brep
optional<email_type> bee,
dependencies_type dp,
requirements_type rq,
- small_vector<dependency, 1> ts,
- small_vector<dependency, 1> es,
- small_vector<dependency, 1> bms,
+ small_vector<test_dependency, 1> ts,
build_class_exprs bs,
build_constraints_type bc,
+ build_auxiliaries_type ac,
+ build_package_configs bcs,
optional<path> lc,
optional<string> fr,
optional<string> sh,
@@ -94,7 +99,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)),
@@ -108,29 +113,56 @@ namespace brep
dependencies (move (dp)),
requirements (move (rq)),
tests (move (ts)),
- examples (move (es)),
- benchmarks (move (bms)),
builds (move (bs)),
- build_constraints (!stub () ? move (bc) : build_constraints_type ()),
+ build_constraints (move (bc)),
+ build_auxiliaries (move (ac)),
+ build_configs (move (bcs)),
internal_repository (move (rp)),
location (move (lc)),
fragment (move (fr)),
- sha256sum (move (sh)),
- buildable (!stub () && internal_repository->buildable)
+ 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)
+ unbuildable_reason = brep::unbuildable_reason::unbuildable;
+
+ buildable = !unbuildable_reason;
+
assert (internal_repository->internal);
}
package::
package (package_name nm,
version_type vr,
+ build_class_exprs bs,
+ build_constraints_type bc,
+ build_auxiliaries_type ac,
+ build_package_configs bcs,
shared_ptr<repository_type> rp)
: id (rp->tenant, move (nm), vr),
tenant (id.tenant),
name (id.name),
version (move (vr)),
- buildable (false)
+ 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));
}
@@ -151,11 +183,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.
//
@@ -163,13 +195,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);
}
}
@@ -180,14 +212,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