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 ++++++++--------- libbpkg/manifest.hxx | 2 +- tests/manifest/testscript | 2 ++ 3 files changed, 11 insertions(+), 10 deletions(-) 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) diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index 2d75b20..757fc92 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -1219,7 +1219,7 @@ namespace bpkg // The binary distributions package information. // - std::vector distributions; + std::vector distribution_values; // The following values are only valid in the manifest list (and only for // certain repository types). diff --git a/tests/manifest/testscript b/tests/manifest/testscript index c696be7..e292141 100644 --- a/tests/manifest/testscript +++ b/tests/manifest/testscript @@ -641,6 +641,7 @@ license: OpenSSL fedora-name: openssl-libs openssl-devel fedora-version: $ + fedora-to-downstream-version: $ EOI : 1 name: libcrypto @@ -650,6 +651,7 @@ license: OpenSSL fedora-name: openssl-libs openssl-devel fedora-version: 1.1.1 + fedora-to-downstream-version: $ EOO } -- cgit v1.1