aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-11-07 16:38:49 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2016-11-07 16:38:49 -0800
commit8be5e7c123d241cd4a71d03acdf43ceccf57ded2 (patch)
tree11577074b220ebec94fac7e37a49e89307bbd0bf
parent5c769e462b377ce06ad46998794a189f3a1b55bc (diff)
downloadvcpkg-8be5e7c123d241cd4a71d03acdf43ceccf57ded2.tar.gz
vcpkg-8be5e7c123d241cd4a71d03acdf43ceccf57ded2.zip
Move Dependency-related functions from vcpkg.h to vcpkg_Dependencies.h
-rw-r--r--toolsrc/include/vcpkg.h4
-rw-r--r--toolsrc/include/vcpkg_Dependencies.h3
-rw-r--r--toolsrc/src/commands_installation.cpp2
-rw-r--r--toolsrc/src/vcpkg.cpp44
-rw-r--r--toolsrc/src/vcpkg_Dependencies.cpp46
5 files changed, 50 insertions, 49 deletions
diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h
index 4e284241d..b9d646e70 100644
--- a/toolsrc/include/vcpkg.h
+++ b/toolsrc/include/vcpkg.h
@@ -1,7 +1,6 @@
#pragma once
#include <filesystem>
-#include <vector>
#include <unordered_map>
#include "package_spec.h"
#include "BinaryParagraph.h"
@@ -18,9 +17,6 @@ namespace vcpkg
StatusParagraphs database_load_check(const vcpkg_paths& paths);
- std::vector<std::string> get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db);
- std::vector<std::string> get_unmet_package_build_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db);
-
void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db);
void deinstall_package(const vcpkg_paths& paths, const package_spec& spec, StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h
index 94aa51f99..d8d331f9c 100644
--- a/toolsrc/include/vcpkg_Dependencies.h
+++ b/toolsrc/include/vcpkg_Dependencies.h
@@ -10,4 +10,7 @@ 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::vector<std::string> get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db);
+ std::vector<std::string> get_unmet_package_build_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 b5f4e1a5d..d8ac974b3 100644
--- a/toolsrc/src/commands_installation.cpp
+++ b/toolsrc/src/commands_installation.cpp
@@ -141,7 +141,7 @@ namespace vcpkg
Input::check_triplet(spec.target_triplet(), paths);
// Explicitly load and use the portfile's build dependencies when resolving the build command (instead of a cached package's dependencies).
- auto first_level_deps = get_unmet_package_build_dependencies(paths, spec, status_db);
+ auto first_level_deps = Dependencies::get_unmet_package_build_dependencies(paths, spec, status_db);
std::vector<package_spec> first_level_deps_specs;
for (auto&& dep : first_level_deps)
{
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 3e1f16179..bd02f5424 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -216,50 +216,6 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar
listfile.close();
}
-// TODO: Refactoring between this function and install_package
-std::vector<std::string> vcpkg::get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
-{
- const fs::path packages_dir_control_file_path = paths.package_dir(spec) / "CONTROL";
-
- auto control_contents_maybe = Files::get_contents(packages_dir_control_file_path);
- if (auto control_contents = control_contents_maybe.get())
- {
- std::vector<std::unordered_map<std::string, std::string>> pghs;
- try
- {
- pghs = Paragraphs::parse_paragraphs(*control_contents);
- }
- catch (std::runtime_error)
- {
- }
- Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", packages_dir_control_file_path.string());
- return BinaryParagraph(pghs[0]).depends;
- }
-
- return get_unmet_package_build_dependencies(paths, spec, status_db);
-}
-
-std::vector<std::string> vcpkg::get_unmet_package_build_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
-{
- const fs::path ports_dir_control_file_path = paths.port_dir(spec) / "CONTROL";
- auto control_contents_maybe = Files::get_contents(ports_dir_control_file_path);
- if (auto control_contents = control_contents_maybe.get())
- {
- std::vector<std::unordered_map<std::string, std::string>> pghs;
- try
- {
- pghs = Paragraphs::parse_paragraphs(*control_contents);
- }
- catch (std::runtime_error)
- {
- }
- Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", ports_dir_control_file_path.string());
- return filter_dependencies(SourceParagraph(pghs[0]).depends, spec.target_triplet());
- }
-
- Checks::exit_with_message("Could not find package named %s", spec);
-}
-
void vcpkg::install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db)
{
StatusParagraph spgh;
diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp
index 28c5e291f..2e79a2499 100644
--- a/toolsrc/src/vcpkg_Dependencies.cpp
+++ b/toolsrc/src/vcpkg_Dependencies.cpp
@@ -7,6 +7,8 @@
#include <unordered_set>
#include "vcpkg.h"
#include "vcpkg_Maps.h"
+#include "vcpkg_Files.h"
+#include "Paragraphs.h"
namespace vcpkg { namespace Dependencies
{
@@ -61,4 +63,48 @@ namespace vcpkg { namespace Dependencies
const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, specs, status_db);
return Maps::extract_key_set(dependency_graph.adjacency_list());
}
+
+ // TODO: Refactoring between this function and install_package
+ std::vector<std::string> get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
+ {
+ const fs::path packages_dir_control_file_path = paths.package_dir(spec) / "CONTROL";
+
+ auto control_contents_maybe = Files::get_contents(packages_dir_control_file_path);
+ if (auto control_contents = control_contents_maybe.get())
+ {
+ std::vector<std::unordered_map<std::string, std::string>> pghs;
+ try
+ {
+ pghs = Paragraphs::parse_paragraphs(*control_contents);
+ }
+ catch (std::runtime_error)
+ {
+ }
+ Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", packages_dir_control_file_path.string());
+ return BinaryParagraph(pghs[0]).depends;
+ }
+
+ return get_unmet_package_build_dependencies(paths, spec, status_db);
+ }
+
+ std::vector<std::string> get_unmet_package_build_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
+ {
+ const fs::path ports_dir_control_file_path = paths.port_dir(spec) / "CONTROL";
+ auto control_contents_maybe = Files::get_contents(ports_dir_control_file_path);
+ if (auto control_contents = control_contents_maybe.get())
+ {
+ std::vector<std::unordered_map<std::string, std::string>> pghs;
+ try
+ {
+ pghs = Paragraphs::parse_paragraphs(*control_contents);
+ }
+ catch (std::runtime_error)
+ {
+ }
+ Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", ports_dir_control_file_path.string());
+ return filter_dependencies(SourceParagraph(pghs[0]).depends, spec.target_triplet());
+ }
+
+ Checks::exit_with_message("Could not find package named %s", spec);
+ }
}}