diff options
Diffstat (limited to 'bpkg/pkg-purge.cxx')
-rw-r--r-- | bpkg/pkg-purge.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bpkg/pkg-purge.cxx b/bpkg/pkg-purge.cxx index 449d3c8..e031b6a 100644 --- a/bpkg/pkg-purge.cxx +++ b/bpkg/pkg-purge.cxx @@ -1,5 +1,4 @@ // file : bpkg/pkg-purge.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include <bpkg/pkg-purge.hxx> @@ -16,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<selected_package>& p, bool simulate, @@ -27,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) @@ -50,6 +50,7 @@ namespace bpkg // p->src_root = nullopt; p->manifest_checksum = nullopt; + p->buildfiles_checksum = nullopt; if (archive) { @@ -57,7 +58,7 @@ namespace bpkg { if (!simulate) { - path a (p->archive->absolute () ? *p->archive : c / *p->archive); + path a (p->effective_archive (c)); if (exists (a)) rm (a); @@ -77,14 +78,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<selected_package>& p, bool simulate) @@ -94,11 +95,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 (); @@ -121,7 +121,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<selected_package> p (db.find<selected_package> (n)); @@ -192,7 +192,7 @@ namespace bpkg if (p->purge_archive) { - path a (p->archive->absolute () ? *p->archive : c / *p->archive); + path a (p->effective_archive (c)); if (exists (a)) fail << "archive file of broken package " << n << " still exists" << @@ -202,7 +202,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. |