aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-12-21 21:37:02 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-01-17 19:22:38 +0300
commit36115f92a7fdebaf13cb968b1acfe3c9973c0df4 (patch)
tree3b7a518df3f276a06793811d205faef4b38c1692 /mod
parent66e1aa46e47873227295aac41bcabf75f94dbca7 (diff)
Adapt to package manifest requirement classes change
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-package-version-details.cxx45
-rw-r--r--mod/page.cxx34
2 files changed, 55 insertions, 24 deletions
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index e271c45..f1a641b 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -362,32 +362,55 @@ handle (request& rq, response& rs)
<< TABLE(CLASS="proplist", ID="requires")
<< TBODY;
- for (const auto& ras: rm)
+ for (const requirement_alternatives& ras: rm)
{
s << TR(CLASS="requires")
<< TH;
- if (ras.conditional)
- s << "?";
-
if (ras.buildtime)
- s << "*";
-
- if (ras.conditional || ras.buildtime)
- s << " ";
+ s << '*';
s << ~TH
<< TD
<< SPAN(CLASS="value");
- for (const auto& ra: ras)
+ for (const requirement_alternative& ra: ras)
{
if (&ra != &ras[0])
s << " | ";
- assert (ra.size () == 1); // @@ DEP
+ // Should we enclose multiple requirement ids into curly braces as in
+ // the manifest? Somehow feels redundant here, since there can't be
+ // any ambiguity (requirement group version constraint is already
+ // punched into the specific requirements without constraints).
+ //
+ for (const string& r: ra)
+ {
+ if (&r != &ra[0])
+ s << ' ';
+
+ s << r;
+ }
- s << ra[0];
+ if (ra.enable)
+ {
+ if (!ra.simple () || !ra[0].empty ())
+ s << ' ';
+
+ s << '?';
+
+ if (!ra.enable->empty ())
+ {
+ s << " (";
+
+ if (full)
+ s << *ra.enable;
+ else
+ s << "...";
+
+ s << ')';
+ }
+ }
}
s << ~SPAN
diff --git a/mod/page.cxx b/mod/page.cxx
index fb6ba90..8d315e9 100644
--- a/mod/page.cxx
+++ b/mod/page.cxx
@@ -520,20 +520,20 @@ namespace brep
if (&ras != &requirements_[0])
s << ", ";
- if (ras.conditional)
- s << "?";
-
if (ras.buildtime)
- s << "*";
+ s << '*';
- if (ras.empty ())
+ // If this is a simple requirement without id, then print the comment
+ // first word.
+ //
+ if (ras.simple () && ras[0][0].empty ())
{
- // If there is no requirement alternatives specified, then print the
- // comment first word.
- //
const auto& c (ras.comment);
if (!c.empty ())
{
+ if (ras[0].enable)
+ s << "? ";
+
auto n (c.find (' '));
s << string (c, 0, n);
@@ -543,23 +543,31 @@ namespace brep
}
else
{
- bool mult (ras.size () > 1);
+ bool mult (ras.size () > 1 ||
+ (ras.size () == 1 && ras[0].size () > 1));
if (mult)
- s << "(";
+ s << '(';
for (const auto& ra: ras)
{
if (&ra != &ras[0])
s << " | ";
- assert (ra.size () == 1); // @@ DEP
+ for (const string& r: ra)
+ {
+ if (&r != &ra[0])
+ s << ' ';
+
+ s << r;
+ }
- s << ra[0];
+ if (ra.enable)
+ s << " ?";
}
if (mult)
- s << ")";
+ s << ')';
}
}