From 130fa279f968ad9661ff4614a2b87f1bb0c5aee2 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 23 Jan 2018 14:14:01 -0800 Subject: [vcpkg] Revert making remove_package() take status_db by const The in-memory database must be updated to communicate to future actions that they need to look at this package's files (or not) --- toolsrc/include/vcpkg/remove.h | 4 ++-- toolsrc/src/vcpkg/install.cpp | 2 +- toolsrc/src/vcpkg/remove.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/toolsrc/include/vcpkg/remove.h b/toolsrc/include/vcpkg/remove.h index 0610bd127..36aeda2ad 100644 --- a/toolsrc/include/vcpkg/remove.h +++ b/toolsrc/include/vcpkg/remove.h @@ -17,10 +17,10 @@ namespace vcpkg::Remove void perform_remove_plan_action(const VcpkgPaths& paths, const Dependencies::RemovePlanAction& action, const Purge purge, - const StatusParagraphs& status_db); + StatusParagraphs* status_db); extern const CommandStructure COMMAND_STRUCTURE; void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, const StatusParagraphs& status_db); + void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); } diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 7a1ba4698..081063633 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -386,7 +386,7 @@ namespace vcpkg::Install } else if (const auto remove_action = action.remove_action.get()) { - Remove::perform_remove_plan_action(paths, *remove_action, Remove::Purge::YES, status_db); + Remove::perform_remove_plan_action(paths, *remove_action, Remove::Purge::YES, &status_db); } else { diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp index 3815c3ce7..3eaf991ce 100644 --- a/toolsrc/src/vcpkg/remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -18,10 +18,10 @@ namespace vcpkg::Remove using Dependencies::RequestType; using Update::OutdatedPackage; - void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, const StatusParagraphs& status_db) + void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db) { auto& fs = paths.get_filesystem(); - auto maybe_ipv = status_db.find_all_installed(spec); + auto maybe_ipv = status_db->find_all_installed(spec); Checks::check_exit( VCPKG_LINE_INFO, maybe_ipv.has_value(), "unable to remove package %s: already removed", spec); @@ -106,6 +106,8 @@ namespace vcpkg::Remove { spgh.state = InstallState::NOT_INSTALLED; write_update(paths, spgh); + + status_db->insert(std::make_unique(std::move(spgh))); } } @@ -143,7 +145,7 @@ namespace vcpkg::Remove void perform_remove_plan_action(const VcpkgPaths& paths, const RemovePlanAction& action, const Purge purge, - const StatusParagraphs& status_db) + StatusParagraphs* status_db) { const std::string display_name = action.spec.to_string(); @@ -285,7 +287,7 @@ namespace vcpkg::Remove for (const RemovePlanAction& action : remove_plan) { - perform_remove_plan_action(paths, action, purge, status_db); + perform_remove_plan_action(paths, action, purge, &status_db); } Checks::exit_success(VCPKG_LINE_INFO); -- cgit v1.2.3