From b1398f09b4dedd19435460e02b49c42fa8bf7a1e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 23 Sep 2016 12:06:55 -0700 Subject: [PATCH] find_unment_dependencies() now works for a single package --- include/vcpkg_Dependencies.h | 2 +- src/commands_installation.cpp | 11 ++++------- src/vcpkg_Dependencies.cpp | 7 +++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/vcpkg_Dependencies.h b/include/vcpkg_Dependencies.h index 94aa51f99..9dc32fc41 100644 --- a/include/vcpkg_Dependencies.h +++ b/include/vcpkg_Dependencies.h @@ -9,5 +9,5 @@ namespace vcpkg {namespace Dependencies { std::vector create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); - std::unordered_set find_unmet_dependencies(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); + std::unordered_set find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db); }} diff --git a/src/commands_installation.cpp b/src/commands_installation.cpp index b688b8d5a..0902ba525 100644 --- a/src/commands_installation.cpp +++ b/src/commands_installation.cpp @@ -113,14 +113,14 @@ namespace vcpkg void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { - // Currently the code won't work for multiple packages if one of them depends on another. + // Installing multiple packages leads to unintuitive behavior if one of them depends on another. // Allowing only 1 package for now. args.check_max_args(1); StatusParagraphs status_db = database_load_check(paths); - std::vector specs = args.parse_all_arguments_as_package_specs(default_target_triplet); - std::unordered_set unmet_dependencies = Dependencies::find_unmet_dependencies(paths, specs, status_db); + const package_spec spec = args.parse_all_arguments_as_package_specs(default_target_triplet).at(0); + std::unordered_set unmet_dependencies = Dependencies::find_unmet_dependencies(paths, spec, status_db); if (!unmet_dependencies.empty()) { System::println(System::color::error, "The build command requires all dependencies to be already installed."); @@ -135,10 +135,7 @@ namespace vcpkg } Environment::ensure_utilities_on_path(paths); - for (const package_spec& spec : specs) - { - build_internal(spec, paths); - } + build_internal(spec, paths); exit(EXIT_SUCCESS); } diff --git a/src/vcpkg_Dependencies.cpp b/src/vcpkg_Dependencies.cpp index 751b503c0..6ffb4959d 100644 --- a/src/vcpkg_Dependencies.cpp +++ b/src/vcpkg_Dependencies.cpp @@ -57,12 +57,11 @@ namespace vcpkg { namespace Dependencies return build_dependency_graph(paths, specs, status_db).find_topological_sort(); } - std::unordered_set find_unmet_dependencies(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db) + std::unordered_set find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db) { - const Graphs::Graph dependency_graph = build_dependency_graph(paths, specs, status_db); + const Graphs::Graph dependency_graph = build_dependency_graph(paths, {spec}, status_db); std::unordered_set key_set = Maps::extract_key_set(dependency_graph.adjacency_list()); - Sets::remove_all(&key_set, specs); - + key_set.erase(spec); return key_set; } }}