diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2018-06-29 01:33:54 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-06-30 19:48:25 -0700 |
| commit | 3ff69f138bd4e9d364cf95731e95213b45473084 (patch) | |
| tree | 8cca71d488a39580f92db4629688cdaea44ffeb7 | |
| parent | f9a3a329f2d353bf80b84aee080aea28017c9605 (diff) | |
| download | vcpkg-3ff69f138bd4e9d364cf95731e95213b45473084.tar.gz vcpkg-3ff69f138bd4e9d364cf95731e95213b45473084.zip | |
[vcpkg] Warn instead of fail on tombstone
| -rw-r--r-- | toolsrc/include/vcpkg/build.h | 14 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 45 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp | 26 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.upgrade.cpp | 17 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp | 21 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp | 5 |
6 files changed, 87 insertions, 41 deletions
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index c5e7e8d88..f27e9d67b 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -64,6 +64,18 @@ namespace vcpkg::Build }; const std::string& to_string(DownloadTool tool); + enum class BinaryCaching + { + NO = 0, + YES + }; + + enum class FailOnTombstone + { + NO = 0, + YES + }; + struct BuildPackageOptions { UseHeadVersion use_head_version; @@ -71,6 +83,8 @@ namespace vcpkg::Build CleanBuildtrees clean_buildtrees; CleanPackages clean_packages; DownloadTool download_tool; + BinaryCaching binary_caching; + FailOnTombstone fail_on_tombstone; }; enum class BuildResult diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index bf3fffafe..0659b82cf 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -61,11 +61,15 @@ namespace vcpkg::Build::Command spec.name()); const StatusParagraphs status_db = database_load_check(paths); - const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::CleanBuildtrees::NO, - Build::CleanPackages::NO, - Build::DownloadTool::BUILT_IN}; + const Build::BuildPackageOptions build_package_options{ + Build::UseHeadVersion::NO, + Build::AllowDownloads::YES, + Build::CleanBuildtrees::NO, + Build::CleanPackages::NO, + Build::DownloadTool::BUILT_IN, + GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO, + Build::FailOnTombstone::NO, + }; std::set<std::string> features_as_set(full_spec.features.begin(), full_spec.features.end()); features_as_set.emplace("core"); @@ -450,7 +454,7 @@ namespace vcpkg::Build const PreBuildInfo& pre_build_info, Span<const AbiEntry> dependency_abis) { - if (!GlobalState::g_binary_caching) return nullopt; + if (config.build_package_options.binary_caching == BinaryCaching::NO) return nullopt; auto& fs = paths.get_filesystem(); const Triplet& triplet = config.triplet; @@ -604,7 +608,7 @@ namespace vcpkg::Build const auto abi_tag_and_file = maybe_abi_tag_and_file.get(); - if (GlobalState::g_binary_caching && abi_tag_and_file) + if (config.build_package_options.binary_caching == BinaryCaching::YES && abi_tag_and_file) { const fs::path archives_root_dir = paths.root / "archives"; const std::string archive_name = abi_tag_and_file->tag + ".zip"; @@ -626,8 +630,16 @@ namespace vcpkg::Build if (fs.exists(archive_tombstone_path)) { - System::println("Found failure tombstone: %s", archive_tombstone_path.u8string()); - return BuildResult::BUILD_FAILED; + if (config.build_package_options.fail_on_tombstone == FailOnTombstone::YES) + { + System::println("Found failure tombstone: %s", archive_tombstone_path.u8string()); + return BuildResult::BUILD_FAILED; + } + else + { + System::println( + System::Color::warning, "Found failure tombstone: %s", archive_tombstone_path.u8string()); + } } System::println("Could not locate cached archive: %s", archive_path.u8string()); @@ -787,17 +799,14 @@ namespace vcpkg::Build const std::string triplet_abi_tag = [&]() { static std::map<fs::path, std::string> s_hash_cache; - if (GlobalState::g_binary_caching) + auto it_hash = s_hash_cache.find(triplet_file_path); + if (it_hash != s_hash_cache.end()) { - auto it_hash = s_hash_cache.find(triplet_file_path); - if (it_hash != s_hash_cache.end()) - { - return it_hash->second; - } - auto hash = Commands::Hash::get_file_hash(paths.get_filesystem(), triplet_file_path, "SHA1"); - s_hash_cache.emplace(triplet_file_path, hash); - return hash; + return it_hash->second; } + auto hash = Commands::Hash::get_file_hash(paths.get_filesystem(), triplet_file_path, "SHA1"); + s_hash_cache.emplace(triplet_file_path, hash); + return hash; return std::string(); }(); diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index e2b93dc7e..f34670f4d 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -58,10 +58,15 @@ namespace vcpkg::Commands::CI std::map<PackageSpec, std::string> abi_tag_map; std::set<PackageSpec> will_fail; - const Build::BuildPackageOptions install_plan_options = {Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::CleanBuildtrees::YES, - Build::CleanPackages::YES}; + const Build::BuildPackageOptions install_plan_options = { + Build::UseHeadVersion::NO, + Build::AllowDownloads::YES, + Build::CleanBuildtrees::YES, + Build::CleanPackages::YES, + Build::DownloadTool::BUILT_IN, + GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO, + Build::FailOnTombstone::YES, + }; vcpkg::Cache<Triplet, Build::PreBuildInfo> pre_build_info_cache; @@ -185,10 +190,15 @@ namespace vcpkg::Commands::CI StatusParagraphs status_db = database_load_check(paths); const auto& paths_port_file = Dependencies::PathsPortFileProvider(paths); - const Build::BuildPackageOptions install_plan_options = {Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::CleanBuildtrees::YES, - Build::CleanPackages::YES}; + const Build::BuildPackageOptions install_plan_options = { + Build::UseHeadVersion::NO, + Build::AllowDownloads::YES, + Build::CleanBuildtrees::YES, + Build::CleanPackages::YES, + Build::DownloadTool::BUILT_IN, + GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO, + Build::FailOnTombstone::YES, + }; std::vector<std::map<PackageSpec, BuildResult>> all_known_results; diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp index a902ddeaf..ac52c9332 100644 --- a/toolsrc/src/vcpkg/commands.upgrade.cpp +++ b/toolsrc/src/vcpkg/commands.upgrade.cpp @@ -1,6 +1,5 @@ #include "pch.h" -#include <vcpkg/base/util.h> #include <vcpkg/commands.h> #include <vcpkg/dependencies.h> #include <vcpkg/help.h> @@ -10,6 +9,8 @@ #include <vcpkg/update.h> #include <vcpkg/vcpkglib.h> +#include <vcpkg/base/util.h> + namespace vcpkg::Commands::Upgrade { using Install::KeepGoing; @@ -141,11 +142,15 @@ namespace vcpkg::Commands::Upgrade Checks::check_exit(VCPKG_LINE_INFO, !plan.empty()); - const Build::BuildPackageOptions install_plan_options = {Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::CleanBuildtrees::NO, - Build::CleanPackages::NO, - Build::DownloadTool::BUILT_IN}; + const Build::BuildPackageOptions install_plan_options = { + Build::UseHeadVersion::NO, + Build::AllowDownloads::YES, + Build::CleanBuildtrees::NO, + Build::CleanPackages::NO, + Build::DownloadTool::BUILT_IN, + GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO, + Build::FailOnTombstone::NO, + }; // Set build settings for all install actions for (auto&& action : plan) diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index c444cf3d0..83d08ef77 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -1,8 +1,5 @@ #include "pch.h" -#include <vcpkg/base/stringliteral.h> -#include <vcpkg/base/system.h> -#include <vcpkg/base/util.h> #include <vcpkg/commands.h> #include <vcpkg/dependencies.h> #include <vcpkg/export.h> @@ -13,6 +10,10 @@ #include <vcpkg/paragraphs.h> #include <vcpkg/vcpkglib.h> +#include <vcpkg/base/stringliteral.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> + namespace vcpkg::Export { using Dependencies::ExportPlanAction; @@ -68,11 +69,15 @@ namespace vcpkg::Export { static constexpr std::array<ExportPlanType, 2> ORDER = {ExportPlanType::ALREADY_BUILT, ExportPlanType::NOT_BUILT}; - static constexpr Build::BuildPackageOptions BUILD_OPTIONS = {Build::UseHeadVersion::NO, - Build::AllowDownloads::YES, - Build::CleanBuildtrees::NO, - Build::CleanPackages::NO, - Build::DownloadTool::BUILT_IN}; + static constexpr Build::BuildPackageOptions BUILD_OPTIONS = { + Build::UseHeadVersion::NO, + Build::AllowDownloads::YES, + Build::CleanBuildtrees::NO, + Build::CleanPackages::NO, + Build::DownloadTool::BUILT_IN, + Build::BinaryCaching::NO, + Build::FailOnTombstone::NO, + }; for (const ExportPlanType plan_type : ORDER) { diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 40e696fa0..4bb84831e 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -588,7 +588,10 @@ namespace vcpkg::Install Util::Enum::to_enum<Build::AllowDownloads>(!no_downloads), Build::CleanBuildtrees::NO, Build::CleanPackages::NO, - download_tool}; + download_tool, + GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO, + Build::FailOnTombstone::NO, + }; auto all_ports = Paragraphs::load_all_ports(paths.get_filesystem(), paths.ports); std::unordered_map<std::string, SourceControlFile> scf_map; |
