aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_installation.cpp
diff options
context:
space:
mode:
authorPatrick Bader <mail@patrickbader.eu>2017-01-06 19:09:17 +0100
committerPatrick Bader <mail@patrickbader.eu>2017-01-06 19:09:17 +0100
commit04f8da985c9acdd090055ad06bcf75eb20af1987 (patch)
tree76ae8c42d498f0c2d607c891eac50f41f06d1269 /toolsrc/src/commands_installation.cpp
parent44c86f56db351da15e5a2b2fcca62656ab8cccbf (diff)
parentff10939203b7694f21d8e8e0464f092dff1b4eb0 (diff)
downloadvcpkg-04f8da985c9acdd090055ad06bcf75eb20af1987.tar.gz
vcpkg-04f8da985c9acdd090055ad06bcf75eb20af1987.zip
Merge branch 'master' of https://github.com/Microsoft/vcpkg
Diffstat (limited to 'toolsrc/src/commands_installation.cpp')
-rw-r--r--toolsrc/src/commands_installation.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp
index 8d940bc9d..c239bf06c 100644
--- a/toolsrc/src/commands_installation.cpp
+++ b/toolsrc/src/commands_installation.cpp
@@ -164,9 +164,8 @@ namespace vcpkg
return output;
}
- void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db)
+ static ImmutableSortedVector<std::string> build_list_of_package_files(const fs::path& package_dir)
{
- const fs::path package_dir = paths.package_dir(binary_paragraph.spec);
const std::vector<fs::path> package_file_paths = Files::recursive_find_all_files_in_dir(package_dir);
std::vector<std::string> package_files;
const size_t package_remove_char_count = package_dir.generic_string().size() + 1; // +1 for the slash
@@ -176,14 +175,27 @@ namespace vcpkg
as_string.erase(0, package_remove_char_count);
return std::move(as_string);
});
- std::sort(package_files.begin(), package_files.end());
- const std::vector<StatusParagraph_and_associated_files>& pgh_and_files = get_installed_files(paths, status_db);
- const triplet& triplet = binary_paragraph.spec.target_triplet();
+ return ImmutableSortedVector<std::string>::create(std::move(package_files));
+ }
+
+ static ImmutableSortedVector<std::string> build_list_of_installed_files(const std::vector<StatusParagraph_and_associated_files>& pgh_and_files, const triplet& triplet)
+ {
std::vector<std::string> installed_files = extract_files_in_triplet(pgh_and_files, triplet);
const size_t installed_remove_char_count = triplet.canonical_name().size() + 1; // +1 for the slash
remove_first_n_chars(&installed_files, installed_remove_char_count);
- std::sort(installed_files.begin(), installed_files.end()); // Should already be sorted
+
+ return ImmutableSortedVector<std::string>::create(std::move(installed_files));
+ }
+
+ void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db)
+ {
+ const fs::path package_dir = paths.package_dir(binary_paragraph.spec);
+ const triplet& triplet = binary_paragraph.spec.target_triplet();
+ const std::vector<StatusParagraph_and_associated_files> pgh_and_files = get_installed_files(paths, status_db);
+
+ const ImmutableSortedVector<std::string> package_files = build_list_of_package_files(package_dir);
+ const ImmutableSortedVector<std::string> installed_files = build_list_of_installed_files(pgh_and_files, triplet);
std::vector<std::string> intersection;
std::set_intersection(package_files.cbegin(), package_files.cend(),