[Dependencies] User-requested vs autos-elected info is now in a separate enum
MODIFY
include/vcpkg_Dependencies.h
include/vcpkg_Dependencies.h
namespace vcpkg::Dependencies
{
+ enum class request_type
+ {
+ USER_REQUESTED,
+ AUTO_SELECTED
+ };
+
enum class install_plan_type
{
BUILD_AND_INSTALL,
@@ -29,13 +35,13 @@ namespace vcpkg::Dependencies
enum class remove_plan_type
{
NOT_INSTALLED,
- REMOVE_AUTO_SELECTED,
- REMOVE_USER_REQUESTED
+ REMOVE
};
struct remove_plan_action
{
- remove_plan_type type;
+ remove_plan_type plan_type;
+ request_type request_type;
std::unique_ptr<StatusParagraph> status_pgh;
};

MODIFY
src/commands_remove.cpp
src/commands_remove.cpp
@@ -114,13 +114,13 @@ namespace vcpkg::Commands::Remove
for (const package_spec_with_remove_plan& i : plan)
{
- if (i.plan.type == remove_plan_type::NOT_INSTALLED)
+ if (i.plan.plan_type == remove_plan_type::NOT_INSTALLED)
{
not_installed.push_back(&i);
continue;
}
- if (i.plan.type == remove_plan_type::REMOVE_AUTO_SELECTED || i.plan.type == remove_plan_type::REMOVE_USER_REQUESTED)
+ if (i.plan.plan_type == remove_plan_type::REMOVE)
{
remove.push_back(&i);
continue;
@@ -145,15 +145,17 @@ namespace vcpkg::Commands::Remove
System::println("The following packages will be removed:\n%s",
Strings::Joiner::on("\n").join(remove, [](const package_spec_with_remove_plan* p)
{
- switch (p->plan.type)
+ if (p->plan.request_type == Dependencies::request_type::AUTO_SELECTED)
{
- case remove_plan_type::REMOVE_USER_REQUESTED:
- return " " + p->spec.toString();
- case remove_plan_type::REMOVE_AUTO_SELECTED:
return " * " + p->spec.toString();
- default:
- Checks::unreachable();
}
+
+ if (p->plan.request_type == Dependencies::request_type::USER_REQUESTED)
+ {
+ return " " + p->spec.toString();
+ }
+
+ Checks::unreachable();
}));
}
}
@@ -178,7 +180,7 @@ namespace vcpkg::Commands::Remove
const bool has_non_user_requested_packages = std::find_if(remove_plan.cbegin(), remove_plan.cend(), [](const package_spec_with_remove_plan& package)-> bool
{
- return package.plan.type == remove_plan_type::REMOVE_AUTO_SELECTED;
+ return package.plan.plan_type == remove_plan_type::REMOVE_AUTO_SELECTED;
}) != remove_plan.cend();
if (has_non_user_requested_packages && !isRecursive)
@@ -191,11 +193,11 @@ namespace vcpkg::Commands::Remove
for (const package_spec_with_remove_plan& action : remove_plan)
{
- if (action.plan.type == remove_plan_type::NOT_INSTALLED)
+ if (action.plan.plan_type == remove_plan_type::NOT_INSTALLED)
{
System::println(System::color::success, "Package %s is not installed", action.spec);
}
- else if (action.plan.type == remove_plan_type::REMOVE_AUTO_SELECTED || action.plan.type == remove_plan_type::REMOVE_USER_REQUESTED)
+ else if (action.plan.plan_type == remove_plan_type::REMOVE_AUTO_SELECTED || action.plan.plan_type == remove_plan_type::REMOVE_USER_REQUESTED)
{
const std::string display_name = action.spec.display_name();
System::println("Removing package %s... ", display_name);

MODIFY
src/vcpkg_Dependencies.cpp
src/vcpkg_Dependencies.cpp
@@ -93,7 +93,7 @@ namespace vcpkg::Dependencies
auto it = status_db.find(spec);
if (it == status_db.end() || (*it)->state == install_state_t::not_installed)
{
- was_examined.emplace(spec, remove_plan_action{remove_plan_type::NOT_INSTALLED, nullptr});
+ was_examined.emplace(spec, remove_plan_action{remove_plan_type::NOT_INSTALLED, request_type::USER_REQUESTED, nullptr});
continue;
}
@@ -114,8 +114,8 @@ namespace vcpkg::Dependencies
examine_stack.push_back(an_installed_package.get()->package.spec);
}
- const remove_plan_type type = specs_as_set.find(spec) != specs_as_set.end() ? remove_plan_type::REMOVE_USER_REQUESTED : remove_plan_type::REMOVE_AUTO_SELECTED;
- was_examined.emplace(spec, remove_plan_action{type, std::make_unique<StatusParagraph>(std::move(**it))});
+ const request_type request_type = specs_as_set.find(spec) != specs_as_set.end() ? request_type::USER_REQUESTED : request_type::AUTO_SELECTED;
+ was_examined.emplace(spec, remove_plan_action{remove_plan_type::REMOVE, request_type,std::make_unique<StatusParagraph>(std::move(**it))});
}
std::vector<package_spec_with_remove_plan> ret;

[Dependencies] User-requested vs autos-elected info is now in a separate enum