aboutsummaryrefslogtreecommitdiff
path: root/libbrep/package.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-06-03 22:56:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-06-04 15:24:51 +0300
commit045563bb01a3fb9de9371854cbc16b77860c221b (patch)
tree928225401c145f00d9eb8e5467d92339d63d7d98 /libbrep/package.cxx
parent05d77beb95f52351c16b2f0af74a0099dd5dba27 (diff)
Add support for topics and keywords package manifest values
Diffstat (limited to 'libbrep/package.cxx')
-rw-r--r--libbrep/package.cxx35
1 files changed, 23 insertions, 12 deletions
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index 763cec9..6c6a565 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -57,7 +57,8 @@ namespace brep
priority_type pr,
string sm,
license_alternatives_type la,
- strings tg,
+ strings tp,
+ strings kw,
optional<string> ds,
optional<text_type> dt,
string ch,
@@ -87,7 +88,8 @@ namespace brep
priority (move (pr)),
summary (move (sm)),
license_alternatives (move (la)),
- tags (move (tg)),
+ topics (move (tp)),
+ keywords (move (kw)),
description (move (ds)),
description_type (move (dt)),
changes (move (ch)),
@@ -133,8 +135,8 @@ namespace brep
if (!internal ())
return weighted_text ();
- // Derive keywords from the basic package information: name,
- // version.
+ // Derive search keywords from the basic package information: project,
+ // name, and version.
//
//@@ What about 'stable' from cppget.org/stable? Add path of
// the repository to keywords? Or is it too "polluting" and
@@ -149,12 +151,7 @@ namespace brep
if (upstream_version)
k += " " + *upstream_version;
- // Add tags to keywords.
- //
- for (const auto& t: tags)
- k += " " + t;
-
- // Add licenses to keywords.
+ // Add licenses to search keywords.
//
for (const auto& la: license_alternatives)
{
@@ -162,7 +159,7 @@ namespace brep
{
k += " " + l;
- // If license is say LGPLv2 then LGPL is also a keyword.
+ // 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')
@@ -170,7 +167,21 @@ namespace brep
}
}
- return {move (k), summary, description ? *description : "", changes};
+ // Derive second-strongest search keywords from the package summary.
+ //
+ string k2 (summary);
+
+ // Add topics to the second-strongest search keywords.
+ //
+ for (const auto& t: topics)
+ k2 += " " + t;
+
+ // Add keywords to the second-strongest search keywords.
+ //
+ for (const auto& k: keywords)
+ k2 += " " + k;
+
+ return {move (k), move (k2), description ? *description : "", changes};
}
// repository