diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-17 13:31:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-01-17 13:31:53 +0300 |
commit | e9fadc9dc3f75131d8765e4d1c621f26909fd5b6 (patch) | |
tree | b34ef978869d80cb5bd4bd65afd86197e279deb3 | |
parent | 7a572b703b7207bb9bc7b2d8d3443152aac42d19 (diff) |
Review-inspired changes
-rw-r--r-- | bpkg/database.cxx | 1 | ||||
-rw-r--r-- | bpkg/system-package-manager.cxx | 28 |
2 files changed, 8 insertions, 21 deletions
diff --git a/bpkg/database.cxx b/bpkg/database.cxx index 6b135fc..65e3af8 100644 --- a/bpkg/database.cxx +++ b/bpkg/database.cxx @@ -349,7 +349,6 @@ namespace bpkg else config_orig = config; - string = '[' + config_orig.representation () + ']'; try diff --git a/bpkg/system-package-manager.cxx b/bpkg/system-package-manager.cxx index 3d5bda7..215ea47 100644 --- a/bpkg/system-package-manager.cxx +++ b/bpkg/system-package-manager.cxx @@ -101,17 +101,10 @@ namespace bpkg for (const distribution_name_value& nv: ap->distribution_values) { - const string& nm (nv.name); - - // @@ TODO - // - // optional<string> - // distribution_name_value::distribution (const string& suffix); - // - if (nm.size () > 5 && nm.compare (nm.size () - 5, 5, "-name") == 0) + if (optional<string> d = nv.distribution ("-name")) { - string dn (nm, 0, nm.size () - 5); // <name>[_<version>] - size_t p (dn.rfind ('_')); // Version-separating underscore. + string dn (move (*d)); // <name>[_<version>] + size_t p (dn.rfind ('_')); // Version-separating underscore. // If '_' separator is present, then make sure that the right-hand // part looks like a version (not empty and only contains digits @@ -147,15 +140,10 @@ namespace bpkg } catch (const invalid_argument& e) { - // @@ [] - // - const string& db (a.second.database ().string); - - fail << "invalid distribution version in value " << nm + fail << "invalid distribution version in value " << nv.name << " for package " << ap->id.name << ' ' << ap->version - << (!db.empty () ? ' ' + db : empty_string) - << " in repository " << a.second.load ()->location << ": " - << e; + << a.second.database () << " in repository " + << a.second.load ()->location << ": " << e; } dn.resize (p); @@ -163,8 +151,8 @@ namespace bpkg if (dn == n && dv <= v && find_if (r.begin (), r.end (), - [&nm, &nv] (const distribution_name_value& v) - {return v.name == nm || v.value == nv.value;}) == + [&nv] (const distribution_name_value& v) + {return v.name == nv.name || v.value == nv.value;}) == r.end ()) { r.push_back (nv); |