aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-01-16 16:06:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-01-16 16:10:42 +0300
commitd66e8f5e02f77bd51e3dc545d08c5fcbbf6e4e97 (patch)
tree9814467eb6f154e5dfe14be8beedce0e5df5ebb2
parent319fa82477c6304e869bcbff14768408fad211ed (diff)
Review-inspired changes
-rw-r--r--libbpkg/manifest.cxx17
-rw-r--r--libbpkg/manifest.hxx2
-rw-r--r--tests/manifest/testscript2
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<distribution_name_value>& 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<distribution_name_value> distributions;
+ std::vector<distribution_name_value> 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
}