From 191f303ce2ee5de042a48801273cbc57a6dd0a52 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 12 Oct 2021 21:52:01 +0300 Subject: Adapt to bpkg::version API change --- bpkg/manifest-utility.cxx | 8 ++++---- bpkg/manifest-utility.hxx | 17 ++++++++--------- bpkg/pkg-build.cxx | 14 +++++++------- bpkg/pkg-status.cxx | 2 +- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index bad4659..fc54eba 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -89,7 +89,7 @@ namespace bpkg version parse_package_version (const char* s, bool allow_wildcard, - bool fold_zero_revision) + version::flags fl) { using traits = string::traits_type; @@ -103,7 +103,7 @@ namespace bpkg try { - return extract_package_version (s, fold_zero_revision); + return extract_package_version (s, fl); } catch (const invalid_argument& e) { @@ -118,7 +118,7 @@ namespace bpkg optional parse_package_version_constraint (const char* s, bool allow_wildcard, - bool fold_zero_revision, + version::flags fl, bool version_only) { // Calculate the version specification position as a length of the prefix @@ -139,7 +139,7 @@ namespace bpkg try { return version_constraint ( - parse_package_version (s, allow_wildcard, fold_zero_revision)); + parse_package_version (s, allow_wildcard, fl)); } catch (const invalid_argument& e) { diff --git a/bpkg/manifest-utility.hxx b/bpkg/manifest-utility.hxx index 69d8326..f293ef5 100644 --- a/bpkg/manifest-utility.hxx +++ b/bpkg/manifest-utility.hxx @@ -62,16 +62,14 @@ namespace bpkg version parse_package_version (const char*, bool allow_wildcard = false, - bool fold_zero_revision = true); + version::flags fl = version::fold_zero_revision); inline version parse_package_version (const string& s, bool allow_wildcard = false, - bool fold_zero_revision = true) + version::flags fl = version::fold_zero_revision) { - return parse_package_version (s.c_str (), - allow_wildcard, - fold_zero_revision); + return parse_package_version (s.c_str (), allow_wildcard, fl); } // Extract the package constraint from either [/] or @@ -80,10 +78,11 @@ namespace bpkg // the package name is specified. // optional - parse_package_version_constraint (const char*, - bool allow_wildcard = false, - bool fold_zero_revision = true, - bool version_only = false); + parse_package_version_constraint ( + const char*, + bool allow_wildcard = false, + version::flags = version::fold_zero_revision, + bool version_only = false); // If the passed location is a relative local path, then assume this is a // relative path to the repository directory and complete it based on the diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 29dd1c9..5db599f 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -4181,13 +4181,13 @@ namespace bpkg // Don't fold the zero revision if building the package from source so // that we build the exact X+0 package revision if it is specified. // - auto fold_zero_rev = [] (package_scheme sc) + auto version_flags = [] (package_scheme sc) { - bool r (false); + version::flags r (version::none); switch (sc) { - case package_scheme::none: r = false; break; - case package_scheme::sys: r = true; break; + case package_scheme::none: r = version::none; break; + case package_scheme::sys: r = version::fold_zero_revision; break; } return r; }; @@ -4224,7 +4224,7 @@ namespace bpkg optional vc ( parse_package_version_constraint ( - s, sys, fold_zero_rev (sc), version_only (sc))); + s, sys, version_flags (sc), version_only (sc))); // For system packages not associated with a specific repository // location add the stub package to the imaginary system @@ -4387,7 +4387,7 @@ namespace bpkg optional vc ( parse_package_version_constraint ( - s, sys, fold_zero_rev (sc), version_only (sc))); + s, sys, version_flags (sc), version_only (sc))); // Check if the package is present in the repository and its // complements, recursively. If the version is not specified then @@ -4762,7 +4762,7 @@ namespace bpkg parse_package_version_constraint ( package, false /* allow_wildcard */, - false /* fold_zero_revision */)); + version::none)); pa = arg_package (pdb, package_scheme::none, diff --git a/bpkg/pkg-status.cxx b/bpkg/pkg-status.cxx index 2b05086..2475fa1 100644 --- a/bpkg/pkg-status.cxx +++ b/bpkg/pkg-status.cxx @@ -294,7 +294,7 @@ namespace bpkg package_name pn (parse_package_name (arg)); version pv (parse_package_version (arg, false /* allow_wildcard */, - false /* fold_zero_revision */)); + version::none)); query q (query::name == pn); -- cgit v1.1