aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-verify.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-11-12 14:38:43 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-11-13 13:29:12 +0300
commit0e31447976e338956f4aef98930f2f28261d9983 (patch)
tree7518c5c288ff7196e5eae3521e4d17f5dab884f9 /bpkg/pkg-verify.cxx
parente59343b3267e82aff33a8f73ab82b51345913c06 (diff)
Add pkg-verify --deep option
Diffstat (limited to 'bpkg/pkg-verify.cxx')
-rw-r--r--bpkg/pkg-verify.cxx54
1 files changed, 52 insertions, 2 deletions
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 ())
{