From d66e8f5e02f77bd51e3dc545d08c5fcbbf6e4e97 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 16 Jan 2023 16:06:37 +0300 Subject: Review-inspired changes --- libbpkg/manifest.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'libbpkg/manifest.cxx') diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index c4e4ed3..82a11f3 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -3455,15 +3455,17 @@ namespace bpkg auto add_distribution = [&m, &bad_name] (distribution_name_value&& nv, bool unique) { + vector& dvs (m.distribution_values); + if (unique && - find_if (m.distributions.begin (), m.distributions.end (), + find_if (dvs.begin (), dvs.end (), [&nv] (const distribution_name_value& dnv) - {return dnv.name == nv.name;}) != m.distributions.end ()) + {return dnv.name == nv.name;}) != dvs.end ()) { bad_name ("package distribution value redefinition"); } - m.distributions.push_back (move (nv)); + dvs.push_back (move (nv)); }; auto flag = [fl] (package_manifest_flags f) @@ -4313,17 +4315,14 @@ namespace bpkg // if (cv) { - for (distribution_name_value& nv: m.distributions) + for (distribution_name_value& nv: m.distribution_values) { const string& n (nv.name); string& v (nv.value); - // @@ redo by checking no other `-`. - // if (v == "$" && (n.size () > 8 && n.compare (n.size () - 8, 8, "-version") == 0) && - (n.size () <= 22 || - n.compare (n.size () - 22, 22, "-to-downstream-version") != 0)) + n.find ('-') == n.size () - 8) { v = version (default_epoch (m.version), move (m.version.upstream), @@ -5129,7 +5128,7 @@ namespace bpkg for (const path& f: m.buildfile_paths) s.next ("build-file", f.posix_string () + (an ? ".build2" : ".build")); - for (const distribution_name_value& nv: m.distributions) + for (const distribution_name_value& nv: m.distribution_values) s.next (nv.name, nv.value); if (m.location) -- cgit v1.1