aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg/dependencies.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/src/vcpkg/dependencies.cpp')
-rw-r--r--toolsrc/src/vcpkg/dependencies.cpp80
1 files changed, 39 insertions, 41 deletions
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp
index 50c310dbb..c175cc86f 100644
--- a/toolsrc/src/vcpkg/dependencies.cpp
+++ b/toolsrc/src/vcpkg/dependencies.cpp
@@ -108,9 +108,8 @@ namespace vcpkg::Dependencies
static ClusterSource cluster_from_scf(const SourceControlFileLocation& scfl, Triplet t)
{
ClusterSource ret;
- ret.build_edges.emplace("core",
- filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends,
- t));
+ ret.build_edges.emplace("core",
+ filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends, t));
for (const auto& feature : scfl.source_control_file->feature_paragraphs)
ret.build_edges.emplace(feature->name, filter_dependencies_to_specs(feature->depends, t));
@@ -123,22 +122,23 @@ namespace vcpkg::Dependencies
const PortFileProvider& m_provider;
};
- std::string to_output_string(RequestType request_type,
- const CStringView s,
- const Build::BuildPackageOptions& options,
+ 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()))
+ 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);
+ 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);
@@ -152,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);
}
@@ -162,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);
}
@@ -293,7 +293,8 @@ namespace vcpkg::Dependencies
MapPortFileProvider::MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map)
: ports(map)
- {}
+ {
+ }
Optional<const SourceControlFileLocation&> MapPortFileProvider::get_control_file(const std::string& spec) const
{
@@ -304,11 +305,11 @@ namespace vcpkg::Dependencies
std::vector<const SourceControlFileLocation*> MapPortFileProvider::load_all_control_files() const
{
- return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation * { return &kvpair.second; });
+ return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation* { return &kvpair.second; });
}
PathsPortFileProvider::PathsPortFileProvider(const vcpkg::VcpkgPaths& paths,
- const std::vector<std::string>* ports_dirs_paths)
+ const std::vector<std::string>* ports_dirs_paths)
: filesystem(paths.get_filesystem())
{
if (ports_dirs_paths)
@@ -325,7 +326,7 @@ namespace vcpkg::Dependencies
overlay.string());
Checks::check_exit(VCPKG_LINE_INFO,
- fs::stdfs::is_directory(overlay),
+ fs::is_directory(status(overlay)),
"Error: Path \"%s\" must be a directory",
overlay.string());
@@ -354,7 +355,7 @@ namespace vcpkg::Dependencies
{
if (scf->get()->core_paragraph->name == spec)
{
- SourceControlFileLocation scfl{ std::move(*scf), ports_dir };
+ SourceControlFileLocation scfl{std::move(*scf), ports_dir};
auto it = cache.emplace(spec, std::move(scfl));
return it.first->second;
}
@@ -362,9 +363,8 @@ namespace vcpkg::Dependencies
else
{
vcpkg::print_error_message(maybe_scf.error());
- Checks::exit_with_message(VCPKG_LINE_INFO,
- "Error: Failed to load port from %s",
- spec, ports_dir.u8string());
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "Error: Failed to load port from %s", spec, ports_dir.u8string());
}
}
@@ -373,7 +373,7 @@ namespace vcpkg::Dependencies
{
if (scf->get()->core_paragraph->name == spec)
{
- SourceControlFileLocation scfl{ std::move(*scf), ports_dir / spec };
+ SourceControlFileLocation scfl{std::move(*scf), ports_dir / spec};
auto it = cache.emplace(spec, std::move(scfl));
return it.first->second;
}
@@ -399,7 +399,7 @@ namespace vcpkg::Dependencies
auto port_name = scf->get()->core_paragraph->name;
if (cache.find(port_name) == cache.end())
{
- SourceControlFileLocation scfl{ std::move(*scf), ports_dir };
+ SourceControlFileLocation scfl{std::move(*scf), ports_dir};
auto it = cache.emplace(port_name, std::move(scfl));
ret.emplace_back(&it.first->second);
}
@@ -407,9 +407,8 @@ namespace vcpkg::Dependencies
else
{
vcpkg::print_error_message(maybe_scf.error());
- Checks::exit_with_message(VCPKG_LINE_INFO,
- "Error: Failed to load port from %s",
- ports_dir.u8string());
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "Error: Failed to load port from %s", ports_dir.u8string());
}
continue;
}
@@ -421,7 +420,7 @@ namespace vcpkg::Dependencies
auto port_name = scf->core_paragraph->name;
if (cache.find(port_name) == cache.end())
{
- SourceControlFileLocation scfl{ std::move(scf), ports_dir / port_name };
+ SourceControlFileLocation scfl{std::move(scf), ports_dir / port_name};
auto it = cache.emplace(port_name, std::move(scfl));
ret.emplace_back(&it.first->second);
}
@@ -772,9 +771,10 @@ namespace vcpkg::Dependencies
/// <param name="map">Map of all source control files in the current environment.</param>
/// <param name="specs">Feature specifications to resolve dependencies for.</param>
/// <param name="status_db">Status of installed packages in the current environment.</param>
- std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFileLocation>& map,
- const std::vector<FeatureSpec>& specs,
- const StatusParagraphs& status_db)
+ std::vector<AnyAction> create_feature_install_plan(
+ const std::unordered_map<std::string, SourceControlFileLocation>& map,
+ const std::vector<FeatureSpec>& specs,
+ const StatusParagraphs& status_db)
{
MapPortFileProvider provider(map);
return create_feature_install_plan(provider, specs, status_db);
@@ -836,9 +836,8 @@ namespace vcpkg::Dependencies
{
// If it will be transiently uninstalled, we need to issue a full installation command
auto* pscfl = p_cluster->source.value_or_exit(VCPKG_LINE_INFO).scfl;
- Checks::check_exit(VCPKG_LINE_INFO,
- pscfl != nullptr,
- "Error: Expected a SourceControlFileLocation to exist");
+ Checks::check_exit(
+ VCPKG_LINE_INFO, pscfl != nullptr, "Error: Expected a SourceControlFileLocation to exist");
auto&& scfl = *pscfl;
auto dep_specs = Util::fmap(m_graph_plan->install_graph.adjacency_list(p_cluster),
@@ -918,7 +917,9 @@ namespace vcpkg::Dependencies
PackageGraph::~PackageGraph() = default;
- void print_plan(const std::vector<AnyAction>& action_plan, const bool is_recursive, const fs::path& default_ports_dir)
+ 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;
@@ -975,13 +976,10 @@ namespace vcpkg::Dependencies
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())
+ 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, pscfl->source_location, default_ports_dir);
}
return to_output_string(p->request_type, p->displayname(), p->build_options);