diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-23 12:06:55 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-23 12:06:55 -0700 |
| commit | b2f6a769ea015f49c7061e36c8c7125dd53ca01e (patch) | |
| tree | 4b0ffe20033ff206230a75936c9a500d17fbabf4 | |
| parent | 0b59e6c0fb0b1b5f5adae6311553cd2f8fc7c6c8 (diff) | |
| download | vcpkg-b2f6a769ea015f49c7061e36c8c7125dd53ca01e.tar.gz vcpkg-b2f6a769ea015f49c7061e36c8c7125dd53ca01e.zip | |
find_unment_dependencies() now works for a single package
| -rw-r--r-- | toolsrc/include/vcpkg_Dependencies.h | 2 | ||||
| -rw-r--r-- | toolsrc/src/commands_installation.cpp | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Dependencies.cpp | 7 |
3 files changed, 8 insertions, 12 deletions
diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index 94aa51f99..9dc32fc41 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -9,5 +9,5 @@ namespace vcpkg {namespace Dependencies { std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db); - std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db); + std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db); }} diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp index b688b8d5a..0902ba525 100644 --- a/toolsrc/src/commands_installation.cpp +++ b/toolsrc/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<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet); - std::unordered_set<package_spec> 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<package_spec> 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/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index 751b503c0..6ffb4959d 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/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<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db) + std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db) { - const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, specs, status_db); + const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, {spec}, status_db); std::unordered_set<package_spec> key_set = Maps::extract_key_set(dependency_graph.adjacency_list()); - Sets::remove_all(&key_set, specs); - + key_set.erase(spec); return key_set; } }} |
