diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-07-12 16:59:27 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-07-12 19:55:03 +0300 |
commit | fa9017f87197565b970d22d2d51241fdfa55c916 (patch) | |
tree | 14e0e4e14465a1b81614400077112a35de92ef65 /bpkg/pkg-verify.cxx | |
parent | 6fc547881a3cce4c9a96d371a2b168d68159eb5d (diff) |
Add --manifest option to pkg-verify
Diffstat (limited to 'bpkg/pkg-verify.cxx')
-rw-r--r-- | bpkg/pkg-verify.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index 2711394..69014ac 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -4,8 +4,11 @@ #include <bpkg/pkg-verify.hxx> +#include <iostream> // cout + #include <libbutl/process.mxx> #include <libbutl/manifest-parser.mxx> +#include <libbutl/manifest-serializer.mxx> #include <bpkg/archive.hxx> #include <bpkg/diagnostics.hxx> @@ -189,7 +192,23 @@ namespace bpkg package_manifest m ( pkg_verify (o, a, o.ignore_unknown (), !o.silent ())); - if (verb && !o.silent () && !o.no_result ()) + if (o.manifest ()) + { + try + { + manifest_serializer s (cout, "STDOUT"); + m.serialize (s); + } + catch (const manifest_serialization& e) + { + fail << "unable to serialize manifest: " << e.description; + } + catch (const io_error&) + { + fail << "unable to write to STDOUT"; + } + } + else if (verb && !o.silent () && !o.no_result ()) text << "valid package " << m.name << " " << m.version; return 0; |