From 0e31447976e338956f4aef98930f2f28261d9983 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 12 Nov 2018 14:38:43 +0300 Subject: Add pkg-verify --deep option --- bpkg/pkg-verify.cxx | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'bpkg/pkg-verify.cxx') diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index a372efa..c55fba9 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -20,7 +20,11 @@ using namespace butl; namespace bpkg { package_manifest - pkg_verify (const common_options& co, const path& af, bool iu, bool diag) + pkg_verify (const common_options& co, + const path& af, + bool ev, + bool iu, + bool diag) try { dir_path pd (package_dir (af)); @@ -62,6 +66,52 @@ namespace bpkg throw failed (); } + // Expand the *-file manifest values, if requested. + // + if (ev) + { + // Expand the description-file manifest value. + // + if (m.description && m.description->file) + { + path f (pd / m.description->path); + string s (extract (co, af, f, diag)); + + if (s.empty ()) + { + if (diag) + error << "description-file manifest value in package archive " + << af << " references empty file " << f; + + throw failed (); + } + + m.description = text_file (move (s)); + } + + // Expand the changes-file manifest values. + // + for (auto& c: m.changes) + { + if (c.file) + { + path f (pd / c.path); + string s (extract (co, af, f, diag)); + + if (s.empty ()) + { + if (diag) + error << "changes-file manifest value in package archive " + << af << " references empty file " << f; + + throw failed (); + } + + c = text_file (move (s)); + } + } + } + return m; } @@ -190,7 +240,7 @@ namespace bpkg try { package_manifest m ( - pkg_verify (o, a, o.ignore_unknown (), !o.silent ())); + pkg_verify (o, a, o.deep (), o.ignore_unknown (), !o.silent ())); if (o.manifest ()) { -- cgit v1.1