aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/lib.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-09-30 16:49:47 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2016-09-30 16:49:47 -0700
commitd31498d0e7c22251b22594763d91c9f36a32629a (patch)
tree5e198a4e3d7997b7bd8078bf9840571cd614eb90 /toolsrc/src/lib.cpp
parent8becbe15a2a7f229041b70d0333ffc96522efb6f (diff)
parentcddc4f612ee605788928dafcb6366c6478fdb401 (diff)
downloadvcpkg-d31498d0e7c22251b22594763d91c9f36a32629a.tar.gz
vcpkg-d31498d0e7c22251b22594763d91c9f36a32629a.zip
Merge branch 'master' of https://github.com/Microsoft/vcpkg
Diffstat (limited to 'toolsrc/src/lib.cpp')
-rw-r--r--toolsrc/src/lib.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/toolsrc/src/lib.cpp b/toolsrc/src/lib.cpp
index e9f12cd1b..2a9b06d4a 100644
--- a/toolsrc/src/lib.cpp
+++ b/toolsrc/src/lib.cpp
@@ -213,35 +213,40 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar
std::vector<std::string> vcpkg::get_unmet_package_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
{
std::vector<std::unordered_map<std::string, std::string>> pghs;
- const fs::path packages_dir_control_file_path = paths.package_dir(spec) / "CONTROL";
+ {
+ 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())
+ {
+ try
+ {
+ pghs = 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;
+ }
+ }
- if (fs::exists(packages_dir_control_file_path))
+ 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())
{
try
{
- pghs = get_paragraphs(packages_dir_control_file_path);
+ pghs = parse_paragraphs(*control_contents);
}
catch (std::runtime_error)
{
- // ??
}
-
- Checks::check_throw(pghs.size() == 1, "Invalid control file for package");
- return BinaryParagraph(pghs[0]).depends;
- }
-
- const fs::path ports_dir_control_file_path = paths.port_dir(spec) / "CONTROL";
- try
- {
- pghs = get_paragraphs(ports_dir_control_file_path);
- }
- catch (std::runtime_error)
- {
- // ??
+ Checks::check_exit(pghs.size() == 1, "Invalid control file at %s", ports_dir_control_file_path.string());
+ return SourceParagraph(pghs[0]).depends;
}
- Checks::check_exit(pghs.size() == 1, "Invalid control file for package %s", spec);
- return SourceParagraph(pghs[0]).depends;
+ 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)