diff options
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/binaryparagraph.cpp | 27 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 12 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/dependencies.cpp | 8 |
3 files changed, 41 insertions, 6 deletions
diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp index 2e9415dab..88d257e7e 100644 --- a/toolsrc/src/vcpkg/binaryparagraph.cpp +++ b/toolsrc/src/vcpkg/binaryparagraph.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include <vcpkg/base/checks.h> +#include <vcpkg/base/hash.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/binaryparagraph.h> @@ -27,6 +28,32 @@ namespace vcpkg static const std::string EXTERNALFILES = "External-Files"; } + bool BinaryParagraph::is_consistent() const + { + switch (consistency) + { + case ConsistencyState::UNKNOWN : + for (const auto& file_hash : external_files) + { + const auto& realfs = Files::get_real_filesystem(); + + if (realfs.is_regular_file(file_hash.first) && + Hash::get_file_hash(realfs, file_hash.first, "SHA1") != file_hash.second) + { + consistency = ConsistencyState::INCONSISTENT; + return false; + } + } + + consistency = ConsistencyState::CONSISTENT; + return true; + case ConsistencyState::CONSISTENT : return true; + case ConsistencyState::INCONSISTENT : return false; + } + + Checks::unreachable(VCPKG_LINE_INFO); + } + BinaryParagraph::BinaryParagraph() = default; BinaryParagraph::BinaryParagraph(std::unordered_map<std::string, std::string> fields) diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 110a571b0..1f0dda590 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -475,11 +475,15 @@ namespace vcpkg::Build {
hashes.emplace_back(external_file, it_hash->second);
}
- else if (fs.is_regular_file(external_file))
+ else if (Files::get_real_filesystem().is_regular_file(external_file))
{
- auto emp = s_hash_cache.emplace(external_file.u8string(),
- Hash::get_file_hash(fs, external_file, "SHA1"));
- hashes.emplace_back(external_file, emp.first->second);
+ auto emp = s_hash_cache.emplace(
+ external_file.u8string(),
+ Hash::get_file_hash(
+ Files::get_real_filesystem(),
+ external_file, "SHA1"));
+
+ hashes.emplace_back(external_file.u8string(), emp.first->second);
}
else
{
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index b604c9acf..50c310dbb 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -664,13 +664,17 @@ namespace vcpkg::Dependencies if (auto p_installed = cluster.installed.get()) { - if (p_installed->original_features.find(feature) != p_installed->original_features.end()) + if (p_installed->original_features.find(feature) != p_installed->original_features.end() && + p_installed->ipv.core->package.is_consistent()) { return MarkPlusResult::SUCCESS; } } - // This feature was or will be uninstalled, therefore we need to rebuild + //The feature was not previously installed or the external files of the + //port are no longer consistent with the last installation of this port + //(they've either been modified or removed). Mark the cluster + //(aka the entire port) to be removed before re-adding it. mark_minus(cluster, graph, graph_plan, prevent_default_features); return follow_plus_dependencies(feature, cluster, graph, graph_plan, prevent_default_features); |
