aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-unpack.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-29 17:30:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-29 17:30:19 +0200
commitcbcf98064cf2dd8a2da80932af799789dc2ca2a9 (patch)
treea9aab352148091f8d45a6abb4814c5a5db4536aa /bpkg/pkg-unpack.cxx
parent203067a2742ad2cbb986369b216b1f1ecfb96458 (diff)
Add --tar, --tar-option options, test with bsdtar
Diffstat (limited to 'bpkg/pkg-unpack.cxx')
-rw-r--r--bpkg/pkg-unpack.cxx30
1 files changed, 21 insertions, 9 deletions
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx
index 84dd5ae..5fc5f0b 100644
--- a/bpkg/pkg-unpack.cxx
+++ b/bpkg/pkg-unpack.cxx
@@ -77,7 +77,10 @@ namespace bpkg
}
static shared_ptr<package>
- pkg_unpack (database& db, const dir_path& c, const string& name)
+ pkg_unpack (const common_options& co,
+ database& db,
+ const dir_path& c,
+ const string& name)
{
tracer trace ("pkg_unpack(pkg)");
tracer_guard tg (db, trace);
@@ -120,19 +123,28 @@ namespace bpkg
//
auto_rm_r arm (d);
- const char* args[] {
- "tar",
- "-C", c.string ().c_str (), // -C/--directory -- change to directory.
- "-xf",
- a.string ().c_str (),
- nullptr};
+ cstrings args {co.tar ().string ().c_str ()};
+
+ // Add extra options.
+ //
+ for (const string& o: co.tar_option ())
+ args.push_back (o.c_str ());
+
+ // -C/--directory -- change to directory.
+ //
+ args.push_back ("-C");
+ args.push_back (c.string ().c_str ());
+
+ args.push_back ("-xf");
+ args.push_back (a.string ().c_str ());
+ args.push_back (nullptr);
if (verb >= 2)
print_process (args);
try
{
- process pr (args);
+ process pr (args.data ());
// While it is reasonable to assuming the child process issued
// diagnostics, tar, specifically, doesn't mention the archive
@@ -194,7 +206,7 @@ namespace bpkg
fail << "package name argument expected" <<
info << "run 'bpkg help pkg-unpack' for more information";
- p = pkg_unpack (db, c, args.next ());
+ p = pkg_unpack (o, db, c, args.next ());
}
if (verb)