aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-create.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-03-10 11:34:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-03-11 21:10:44 +0300
commitd452df33a8b702c9992da01e5963e4c4d89f0689 (patch)
tree6d3d06f94d76dd6191502fd64d89d5aef8bd78d7 /bpkg/rep-create.cxx
parent6d036eb95b33b9968e5e95e3e3e9b5a42ba99cc9 (diff)
Make rep_create to convert file-type manifest values to corresponding inline-type ones
Diffstat (limited to 'bpkg/rep-create.cxx')
-rw-r--r--bpkg/rep-create.cxx36
1 files changed, 35 insertions, 1 deletions
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 <bpkg/manifest>
#include <bpkg/manifest-serializer>
-#include <bpkg/checksum>
#include <bpkg/fetch>
+#include <bpkg/archive>
+#include <bpkg/checksum>
#include <bpkg/diagnostics>
#include <bpkg/pkg-verify>
@@ -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)}));