From 5d513688ae07d96910dd1eef83bdad4e9d780373 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 22 Apr 2021 21:57:13 +0300 Subject: Add support for linked configurations --- bpkg/pkg-purge.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'bpkg/pkg-purge.cxx') diff --git a/bpkg/pkg-purge.cxx b/bpkg/pkg-purge.cxx index f6589bb..4fe040e 100644 --- a/bpkg/pkg-purge.cxx +++ b/bpkg/pkg-purge.cxx @@ -15,7 +15,7 @@ using namespace butl; namespace bpkg { void - pkg_purge_fs (const dir_path& c, + pkg_purge_fs (database& db, transaction& t, const shared_ptr& p, bool simulate, @@ -26,9 +26,10 @@ namespace bpkg assert (p->state == package_state::fetched || p->state == package_state::unpacked); - database& db (t.database ()); tracer_guard tg (db, trace); + const dir_path& c (db.config_orig); + try { if (p->purge_src) @@ -76,14 +77,14 @@ namespace bpkg db.update (p); t.commit (); - info << "package " << p->name << " is now broken; " + info << "package " << p->name << db << " is now broken; " << "use 'pkg-purge --force' to remove"; throw; } } void - pkg_purge (const dir_path& c, + pkg_purge (database& db, transaction& t, const shared_ptr& p, bool simulate) @@ -93,11 +94,10 @@ namespace bpkg tracer trace ("pkg_purge"); - database& db (t.database ()); tracer_guard tg (db, trace); assert (!p->out_root); - pkg_purge_fs (c, t, p, simulate, true); + pkg_purge_fs (db, t, p, simulate, true); db.erase (p); t.commit (); @@ -120,7 +120,7 @@ namespace bpkg package_name n (parse_package_name (args.next (), false /* allow_version */)); - database db (open (c, trace)); + database db (c, trace, true /* pre_attach */); transaction t (db); shared_ptr p (db.find (n)); @@ -201,7 +201,7 @@ namespace bpkg else { assert (!p->out_root); - pkg_purge_fs (c, t, p, false /* simulate */, !o.keep ()); + pkg_purge_fs (db, t, p, false /* simulate */, !o.keep ()); } // Finally, update the database state. -- cgit v1.1