aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest/driver.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-01-29 16:08:35 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-01-30 15:53:10 +0300
commitf8851063035424e441259af9f26c28af090542b4 (patch)
tree8488701f06909d6d9bce3cb3a964bce3116e6f8e /tests/manifest/driver.cxx
parentec1f115eaed9ec950cacab1b7ded6d35e99afb9d (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.cxx28
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;
}