diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-12-03 20:30:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-12-08 16:03:46 +0300 |
commit | 4bc9390c48cee736917ead5d20aa216fe10bae47 (patch) | |
tree | be1736676d0ed13863d7574a1afd089bf708312f /mod | |
parent | 76c2215ff5aa74f53a028112787ec10593d45715 (diff) |
Prepare for supporting multiple dependencies in dependency alternative
Diffstat (limited to 'mod')
-rw-r--r-- | mod/mod-package-version-details.cxx | 32 | ||||
-rw-r--r-- | mod/page.cxx | 46 |
2 files changed, 44 insertions, 34 deletions
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx index 90c33b1..68d43de 100644 --- a/mod/mod-package-version-details.cxx +++ b/mod/mod-package-version-details.cxx @@ -320,31 +320,33 @@ handle (request& rq, response& rs) << TABLE(CLASS="proplist", ID="depends") << TBODY; - for (const auto& da: ds) + for (const auto& das: ds) { s << TR(CLASS="depends") << TH; - if (da.conditional) + if (das.conditional) s << '?'; - if (da.buildtime) + if (das.buildtime) s << '*'; s << ~TH << TD << SPAN(CLASS="value"); - for (const auto& d: da) + for (const auto& da: das) { - if (&d != &da[0]) + if (&da != &das[0]) s << " | "; - print_dependency (d); + assert (da.size () == 1); // @@ DEP + + print_dependency (da[0]); } s << ~SPAN - << SPAN_COMMENT (da.comment) + << SPAN_COMMENT (das.comment) << ~TD << ~TR; } @@ -360,34 +362,34 @@ handle (request& rq, response& rs) << TABLE(CLASS="proplist", ID="requires") << TBODY; - for (const auto& ra: rm) + for (const auto& ras: rm) { s << TR(CLASS="requires") << TH; - if (ra.conditional) + if (ras.conditional) s << "?"; - if (ra.buildtime) + if (ras.buildtime) s << "*"; - if (ra.conditional || ra.buildtime) + if (ras.conditional || ras.buildtime) s << " "; s << ~TH << TD << SPAN(CLASS="value"); - for (const auto& r: ra) + for (const auto& ra: ras) { - if (&r != &ra[0]) + if (&ra != &ras[0]) s << " | "; - s << r; + s << ra; } s << ~SPAN - << SPAN_COMMENT (ra.comment) + << SPAN_COMMENT (ras.comment) << ~TD << ~TR; } diff --git a/mod/page.cxx b/mod/page.cxx index f2f1843..af9c795 100644 --- a/mod/page.cxx +++ b/mod/page.cxx @@ -416,22 +416,26 @@ namespace brep if (!dependencies_.empty ()) s << "; "; - for (const auto& d: dependencies_) + for (const dependency_alternatives& das: dependencies_) { - if (&d != &dependencies_[0]) + if (&das != &dependencies_[0]) s << ", "; - if (d.conditional) + if (das.conditional) s << "?"; - if (d.buildtime) + if (das.buildtime) s << "*"; // Suppress package name duplicates. // set<package_name> names; - for (const auto& da: d) - names.emplace (da.name); + for (const dependency_alternative& da: das) + { + assert (da.size () == 1); // @@ DEP + + names.emplace (da[0].name); + } bool mult (names.size () > 1); @@ -439,9 +443,13 @@ namespace brep s << "("; bool first (true); - for (const auto& da: d) + for (const dependency_alternative& da: das) { - const package_name& n (da.name); + assert (da.size () == 1); // @@ DEP + + const dependency& d (da[0]); + + const package_name& n (d.name); if (names.find (n) != names.end ()) { names.erase (n); @@ -454,9 +462,9 @@ namespace brep // Try to display the dependency as a link if it is resolved. // Otherwise display it as plain text. // - if (da.package != nullptr) + if (d.package != nullptr) { - shared_ptr<package> p (da.package.load ()); + shared_ptr<package> p (d.package.load ()); assert (p->internal () || !p->other_repositories.empty ()); shared_ptr<repository> r ( @@ -507,23 +515,23 @@ namespace brep << SPAN(CLASS="value") << requirements_.size () << "; "; - for (const auto& r: requirements_) + for (const auto& ras: requirements_) { - if (&r != &requirements_[0]) + if (&ras != &requirements_[0]) s << ", "; - if (r.conditional) + if (ras.conditional) s << "?"; - if (r.buildtime) + if (ras.buildtime) s << "*"; - if (r.empty ()) + if (ras.empty ()) { // If there is no requirement alternatives specified, then print the // comment first word. // - const auto& c (r.comment); + const auto& c (ras.comment); if (!c.empty ()) { auto n (c.find (' ')); @@ -535,14 +543,14 @@ namespace brep } else { - bool mult (r.size () > 1); + bool mult (ras.size () > 1); if (mult) s << "("; - for (const auto& ra: r) + for (const auto& ra: ras) { - if (&ra != &r[0]) + if (&ra != &ras[0]) s << " | "; s << ra; |