From 6f41ca43cd46658dad840fb51d5fb59431ceac67 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 Jan 2023 10:47:20 +0200 Subject: Review --- bpkg/system-package-manager.cxx | 31 ++++++++++++++++++------------- bpkg/utility.hxx | 3 ++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/bpkg/system-package-manager.cxx b/bpkg/system-package-manager.cxx index c170041..e5503f6 100644 --- a/bpkg/system-package-manager.cxx +++ b/bpkg/system-package-manager.cxx @@ -3,8 +3,6 @@ #include -#include // back_inserter - #include #include @@ -77,20 +75,20 @@ namespace bpkg } catch (const invalid_argument& e) { - fail << "invalid VERSION_ID '" << version_id << "' for " << name_id - << " operating system identification data: " << e; + fail << "invalid version '" << version_id << "' for " << name_id + << " operating system: " << e; } // Return those [_]-name distribution values of the - // specified available packages, whose component matches the + // specified available packages whose component matches the // specified distribution name and the component (assumed as "0" // if not present) is less or equal the specified distribution version. - // Suppress the duplicate entries with the same name (so that distribution + // Suppress duplicate entries with the same name (so that distribution // values of the later available package versions are preferred) or value. // using values = vector>; - auto name_vals = [&aps] (const string& n, const semantic_version& v) + auto name_values = [&aps] (const string& n, const semantic_version& v) { values r; for (const auto& a: aps) @@ -101,6 +99,11 @@ namespace bpkg { const string& nm (nv.name); + // @@ TODO + // + // optional + // distribution_name_value::distribution (const string& suffix); + // if (nm.size () > 5 && nm.compare (nm.size () - 5, 5, "-name") == 0) { string dn (nm, 0, nm.size () - 5); // [_] @@ -140,11 +143,13 @@ namespace bpkg } catch (const invalid_argument& e) { - const std::string& s (a.second.database ().string); + // @@ [] + // + const string& db (a.second.database ().string); - fail << "invalid distribution value " << nm << " for package " - << ap->id.name << ' ' << ap->version - << (!s.empty () ? ' ' + s : empty_string) + fail << "invalid distribution version in value " << nm + << " for package " << ap->id.name << ' ' << ap->version + << (!db.empty () ? ' ' + db : empty_string) << " in repository " << a.second.load ()->location << ": " << e; } @@ -170,13 +175,13 @@ namespace bpkg // Collect the -name values that match the name id and refer // to the version which is less or equal than the version id. // - values vs (name_vals (name_id, vid)); + values vs (name_values (name_id, vid)); // If the resulting list is empty and the like id is specified, then // re-collect but now using the like id and "0" version id instead. // if (vs.empty () && !like_id.empty ()) - vs = name_vals (like_id, semantic_version (0, 0, 0)); + vs = name_values (like_id, semantic_version (0, 0, 0)); // Return the values of the collected name/values list. // diff --git a/bpkg/utility.hxx b/bpkg/utility.hxx index 04c7c94..16ad094 100644 --- a/bpkg/utility.hxx +++ b/bpkg/utility.hxx @@ -10,7 +10,7 @@ #include // strcmp(), strchr() #include // move(), forward(), declval(), make_pair() #include // assert() -#include // make_move_iterator() +#include // make_move_iterator(), back_inserter() #include // * #include @@ -33,6 +33,7 @@ namespace bpkg using std::make_pair; using std::make_shared; using std::make_move_iterator; + using std::back_inserter; using std::to_string; using std::strcmp; -- cgit v1.1