diff options
| author | Victor Romero <romerosanchezv@gmail.com> | 2019-06-24 12:09:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-24 12:09:48 -0700 |
| commit | 9e565e986789cf273de12fe1b07ce31800d10417 (patch) | |
| tree | 1ad22d5f68627908fe84a2ce1fff9c104938691b | |
| parent | 4f675eafb64afc103f7cb1dc14cbfe07a65559ec (diff) | |
| download | vcpkg-9e565e986789cf273de12fe1b07ce31800d10417.tar.gz vcpkg-9e565e986789cf273de12fe1b07ce31800d10417.zip | |
[--overlay-ports] Show location of overriden ports during install plan (#7002)
* [--overlay-ports] Show source location of overlayed ports during install plan
* Code cleanup
* Code cleanup
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.upgrade.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/dependencies.cpp | 40 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp | 2 |
5 files changed, 41 insertions, 9 deletions
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h index 8c2050b3d..964158026 100644 --- a/toolsrc/include/vcpkg/dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -199,5 +199,7 @@ namespace vcpkg::Dependencies const StatusParagraphs& status_db, const CreateInstallPlanOptions& options = {}); - void print_plan(const std::vector<AnyAction>& action_plan, const bool is_recursive = true); + void print_plan(const std::vector<AnyAction>& action_plan, + const bool is_recursive = true, + const fs::path& default_ports_dir = ""); } diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 8cab79504..c12c26ff7 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -451,7 +451,7 @@ namespace vcpkg::Commands::CI if (is_dry_run) { - Dependencies::print_plan(action_plan); + Dependencies::print_plan(action_plan, true, paths.ports); } else { diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp index 77183ceaf..1e64b2eb6 100644 --- a/toolsrc/src/vcpkg/commands.upgrade.cpp +++ b/toolsrc/src/vcpkg/commands.upgrade.cpp @@ -171,7 +171,7 @@ namespace vcpkg::Commands::Upgrade } } - Dependencies::print_plan(plan, true); + Dependencies::print_plan(plan, true, paths.ports); if (!no_dry_run) { diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index df472515f..b604c9acf 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -123,6 +123,27 @@ namespace vcpkg::Dependencies const PortFileProvider& m_provider; }; + std::string to_output_string(RequestType request_type, + const CStringView s, + const Build::BuildPackageOptions& options, + const fs::path& install_port_path, + const fs::path& default_port_path) + { + if (!default_port_path.empty() + && !Strings::case_insensitive_ascii_starts_with(install_port_path.u8string(), + default_port_path.u8string())) + { + const char* const from_head = options.use_head_version == Build::UseHeadVersion::YES ? " (from HEAD)" : ""; + switch (request_type) + { + case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s -- %s", s, from_head, install_port_path.u8string()); + case RequestType::USER_REQUESTED: return Strings::format(" %s%s -- %s", s, from_head, install_port_path.u8string()); + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + return to_output_string(request_type, s, options); + } + std::string to_output_string(RequestType request_type, const CStringView s, const Build::BuildPackageOptions& options) @@ -131,7 +152,7 @@ namespace vcpkg::Dependencies switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head); + case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head); case RequestType::USER_REQUESTED: return Strings::format(" %s%s", s, from_head); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -141,7 +162,7 @@ namespace vcpkg::Dependencies { switch (request_type) { - case RequestType::AUTO_SELECTED: return Strings::format(" * %s", s); + case RequestType::AUTO_SELECTED: return Strings::format(" * %s", s); case RequestType::USER_REQUESTED: return Strings::format(" %s", s); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -893,7 +914,7 @@ namespace vcpkg::Dependencies PackageGraph::~PackageGraph() = default; - void print_plan(const std::vector<AnyAction>& action_plan, const bool is_recursive) + void print_plan(const std::vector<AnyAction>& action_plan, const bool is_recursive, const fs::path& default_ports_dir) { std::vector<const RemovePlanAction*> remove_plans; std::vector<const InstallPlanAction*> rebuilt_plans; @@ -948,8 +969,17 @@ namespace vcpkg::Dependencies std::sort(already_installed_plans.begin(), already_installed_plans.end(), &InstallPlanAction::compare_by_name); std::sort(excluded.begin(), excluded.end(), &InstallPlanAction::compare_by_name); - static auto actions_to_output_string = [](const std::vector<const InstallPlanAction*>& v) { - return Strings::join("\n", v, [](const InstallPlanAction* p) { + static auto actions_to_output_string = [&](const std::vector<const InstallPlanAction*>& v) { + return Strings::join("\n", v, [&](const InstallPlanAction* p) { + if (auto * pscfl = p->source_control_file_location.get()) + { + return to_output_string(p->request_type, + p->displayname(), + p->build_options, + pscfl->source_location, + default_ports_dir); + } + return to_output_string(p->request_type, p->displayname(), p->build_options); }); }; diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 781629236..de19c360a 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -684,7 +684,7 @@ namespace vcpkg::Install Metrics::g_metrics.lock()->track_property("installplan", specs_string); - Dependencies::print_plan(action_plan, is_recursive); + Dependencies::print_plan(action_plan, is_recursive, paths.ports); if (dry_run) { |
