From d452df33a8b702c9992da01e5963e4c4d89f0689 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 10 Mar 2016 11:34:05 +0300 Subject: Make rep_create to convert file-type manifest values to corresponding inline-type ones --- bpkg/rep-create.cxx | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'bpkg/rep-create.cxx') diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index c714445..9c6f275 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -13,8 +13,9 @@ #include #include -#include #include +#include +#include #include #include @@ -110,6 +111,39 @@ namespace bpkg // m.location = a.leaf (root); + dir_path pd (m.name + "-" + m.version.string ()); + + // Expand the description-file manifest value. + // + if (m.description && m.description->file) + { + path f (pd / m.description->path); + string s (extract (o, a, f)); + + if (s.empty ()) + fail << "description-file value in manifest of package archive " + << a << " references empty file " << f; + + 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 (o, a, f)); + + if (s.empty ()) + fail << "changes-file value in manifest of package archive " << a + << " references empty file " << f; + + c = text_file (move (s)); + } + } + package_key k {m.name, m.version}; // Argument evaluation order. auto r (map.emplace (move (k), package_data {a, move (m)})); -- cgit v1.1