From e253cd97c6a8d55a5be19731d58769f4663ab2d1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 6 Oct 2021 22:16:46 +0300 Subject: Add support for applying backward compatibility workarounds to packages.manifest file generated by rep-create --- bpkg/types-parsers.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'bpkg/types-parsers.cxx') diff --git a/bpkg/types-parsers.cxx b/bpkg/types-parsers.cxx index d5ddb28..97ebafe 100644 --- a/bpkg/types-parsers.cxx +++ b/bpkg/types-parsers.cxx @@ -92,6 +92,35 @@ namespace bpkg } } + void parser:: + parse (butl::standard_version& x, bool& xs, scanner& s) + { + using butl::standard_version; + + xs = true; + + const char* o (s.next ()); + + if (!s.more ()) + throw missing_value (o); + + const char* v (s.next ()); + + try + { + // Note that we allow all kinds of versions, so that the caller can + // restrict them as they wish after the parsing. + // + x = standard_version (v, + standard_version::allow_earliest | + standard_version::allow_stub); + } + catch (const invalid_argument& e) + { + throw invalid_value (o, v, e.what ()); + } + } + void parser:: parse (auth& x, bool& xs, scanner& s) { -- cgit v1.1