[vcpkg] Warn instead of fail on tombstone
MODIFY
include/vcpkg/build.h
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

MODIFY
src/vcpkg/build.cpp
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,
+ const Build::BuildPackageOptions build_package_options{
+ Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
Build::CleanPackages::NO,
- Build::DownloadTool::BUILT_IN};
+ 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";
@@ -625,10 +629,18 @@ namespace vcpkg::Build
}
if (fs.exists(archive_tombstone_path))
+ {
+ 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,8 +799,6 @@ 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())
{
@@ -797,7 +807,6 @@ namespace vcpkg::Build
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();
}();

MODIFY
src/vcpkg/commands.ci.cpp
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,
+ const Build::BuildPackageOptions install_plan_options = {
+ Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::YES,
- Build::CleanPackages::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,
+ const Build::BuildPackageOptions install_plan_options = {
+ Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::YES,
- Build::CleanPackages::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;

MODIFY
src/vcpkg/commands.upgrade.cpp
src/vcpkg/commands.upgrade.cpp
#include "pch.h"
-#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/help.h>
#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,
+ const Build::BuildPackageOptions install_plan_options = {
+ Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
Build::CleanPackages::NO,
- Build::DownloadTool::BUILT_IN};
+ 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)

MODIFY
src/vcpkg/export.cpp
src/vcpkg/export.cpp
#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>
#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,
+ static constexpr Build::BuildPackageOptions BUILD_OPTIONS = {
+ Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
Build::CleanPackages::NO,
- Build::DownloadTool::BUILT_IN};
+ Build::DownloadTool::BUILT_IN,
+ Build::BinaryCaching::NO,
+ Build::FailOnTombstone::NO,
+ };
for (const ExportPlanType plan_type : ORDER)
{

MODIFY
src/vcpkg/install.cpp
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;

[vcpkg] Warn instead of fail on tombstone