From ddf8c2b62fa09eb765afc0c093d0d8908f7b69e4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 10 Oct 2015 17:48:03 +0200 Subject: Complete build command --- bpkg/pkg-unpack.cxx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'bpkg/pkg-unpack.cxx') diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx index 7100809..d6613b5 100644 --- a/bpkg/pkg-unpack.cxx +++ b/bpkg/pkg-unpack.cxx @@ -23,14 +23,16 @@ using namespace butl; namespace bpkg { - static shared_ptr - pkg_unpack (database& db, - const dir_path& c, + shared_ptr + pkg_unpack (const dir_path& c, + transaction& t, const dir_path& d, bool replace, bool purge) { - tracer trace ("pkg_unpack(dir)"); + tracer trace ("pkg_unpack"); + + database& db (t.database ()); tracer_guard tg (db, trace); if (!exists (d)) @@ -52,8 +54,6 @@ namespace bpkg if (ad.sub (ac)) ad = ad.leaf (ac); - transaction t (db.begin ()); - // See if this package already exists in this configuration. // const string& n (m.name); @@ -112,16 +112,17 @@ namespace bpkg return p; } - static shared_ptr + shared_ptr pkg_unpack (const common_options& co, - database& db, const dir_path& c, + transaction& t, const string& name) { - tracer trace ("pkg_unpack(pkg)"); + tracer trace ("pkg_unpack"); + + database& db (t.database ()); tracer_guard tg (db, trace); - transaction t (db.begin ()); shared_ptr p (db.find (name)); if (p == nullptr) @@ -224,6 +225,7 @@ namespace bpkg level4 ([&]{trace << "configuration: " << c;}); database db (open (c, trace)); + transaction t (db.begin ()); shared_ptr p; @@ -236,7 +238,7 @@ namespace bpkg info << "run 'bpkg help pkg-unpack' for more information"; p = pkg_unpack ( - db, c, dir_path (args.next ()), o.replace (), o.purge ()); + c, t, dir_path (args.next ()), o.replace (), o.purge ()); } else { @@ -246,7 +248,7 @@ namespace bpkg fail << "package name argument expected" << info << "run 'bpkg help pkg-unpack' for more information"; - p = pkg_unpack (o, db, c, args.next ()); + p = pkg_unpack (o, c, t, args.next ()); } if (verb) -- cgit v1.1