diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-29 16:08:35 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-01-30 15:53:10 +0300 |
commit | f8851063035424e441259af9f26c28af090542b4 (patch) | |
tree | 8488701f06909d6d9bce3cb3a964bce3116e6f8e /tests/manifest/driver.cxx | |
parent | ec1f115eaed9ec950cacab1b7ded6d35e99afb9d (diff) |
Add package_manifest constructor that translates package version
Also complete ~$/^$ dependency constraints using standard_version_constraint
class.
Diffstat (limited to 'tests/manifest/driver.cxx')
-rw-r--r-- | tests/manifest/driver.cxx | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx index 3bffd4a..5f8a0f5 100644 --- a/tests/manifest/driver.cxx +++ b/tests/manifest/driver.cxx @@ -9,6 +9,7 @@ #include <libbutl/manifest-parser.mxx> #include <libbutl/manifest-serializer.mxx> +#include <libbutl/standard-version.mxx> #include <libbpkg/manifest.hxx> @@ -86,9 +87,25 @@ main (int argc, char* argv[]) cin.exceptions (ios_base::failbit | ios_base::badbit); if (opt == "-p") - pkg_package_manifest (p, - false /* ignore_unknown */, - complete_depends).serialize (s); + package_manifest ( + p, + [] (version& v) + { + // Emulate populating the snapshot information for the latest + // snapshot. + // + if (butl::optional<standard_version> sv = + parse_standard_version (v.string ())) + { + if (sv->latest_snapshot ()) + { + sv->snapshot_sn = 123; + v = version (sv->string ()); + } + } + }, + false /* ignore_unknown */, + complete_depends).serialize (s); else if (opt == "-pp") pkg_package_manifests (p).serialize (s); else if (opt == "-dp") @@ -112,6 +129,11 @@ main (int argc, char* argv[]) cerr << e << endl; return 1; } + catch (const invalid_argument& e) + { + cerr << e << endl; + return 1; + } return 0; } |