aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2018-10-23 14:44:35 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2018-10-23 20:44:47 -0700
commit420240541120c986d0a953f684ad9e296afea2c0 (patch)
tree78effb05d0861971ccc4e73989bdaff435e4bfc3
parentc6552cba450d8fc3425e03cffeba6347b375506c (diff)
downloadvcpkg-420240541120c986d0a953f684ad9e296afea2c0.tar.gz
vcpkg-420240541120c986d0a953f684ad9e296afea2c0.zip
[vcpkg ci] Add --purge-tombstones flag
-rw-r--r--toolsrc/src/vcpkg/commands.ci.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp
index 59a07cce2..551eee27b 100644
--- a/toolsrc/src/vcpkg/commands.ci.cpp
+++ b/toolsrc/src/vcpkg/commands.ci.cpp
@@ -28,6 +28,7 @@ namespace vcpkg::Commands::CI
static constexpr StringLiteral OPTION_DRY_RUN = "--dry-run";
static constexpr StringLiteral OPTION_EXCLUDE = "--exclude";
+ static constexpr StringLiteral OPTION_PURGE_TOMBSTONES = "--purge-tombstones";
static constexpr StringLiteral OPTION_XUNIT = "--x-xunit";
static constexpr std::array<CommandSetting, 2> CI_SETTINGS = {{
@@ -35,8 +36,10 @@ namespace vcpkg::Commands::CI
{OPTION_XUNIT, "File to output results in XUnit format (internal)"},
}};
- static constexpr std::array<CommandSwitch, 1> CI_SWITCHES = {
- {{OPTION_DRY_RUN, "Print out plan without execution"}}};
+ static constexpr std::array<CommandSwitch, 2> CI_SWITCHES = {{
+ {OPTION_DRY_RUN, "Print out plan without execution"},
+ {OPTION_PURGE_TOMBSTONES, "Purge failure tombstones and retry building the ports"},
+ }};
const CommandStructure COMMAND_STRUCTURE = {
Help::create_example_string("ci x64-windows"),
@@ -56,7 +59,8 @@ namespace vcpkg::Commands::CI
static UnknownCIPortsResults find_unknown_ports_for_ci(const VcpkgPaths& paths,
const std::set<std::string>& exclusions,
const Dependencies::PortFileProvider& provider,
- const std::vector<FeatureSpec>& fspecs)
+ const std::vector<FeatureSpec>& fspecs,
+ const bool purge_tombstones)
{
UnknownCIPortsResults ret;
@@ -77,7 +81,7 @@ namespace vcpkg::Commands::CI
vcpkg::Cache<Triplet, Build::PreBuildInfo> pre_build_info_cache;
- auto action_plan = Dependencies::create_feature_install_plan(provider, fspecs, StatusParagraphs{});
+ auto action_plan = Dependencies::create_feature_install_plan(provider, fspecs, StatusParagraphs {});
for (auto&& action : action_plan)
{
@@ -89,7 +93,7 @@ namespace vcpkg::Commands::CI
{
auto triplet = p->spec.triplet();
- const Build::BuildPackageConfig build_config{
+ const Build::BuildPackageConfig build_config {
*scf, triplet, paths.port_dir(p->spec), install_plan_options, p->feature_list};
auto dependency_abis =
@@ -126,9 +130,16 @@ namespace vcpkg::Commands::CI
auto archive_path = archives_root_dir / archive_subpath;
auto archive_tombstone_path = archives_root_dir / "fail" / archive_subpath;
+ if (purge_tombstones)
+ {
+ std::error_code ec;
+ fs.remove(archive_tombstone_path, ec); // Ignore error
+ }
+
bool b_will_build = false;
- ret.features.emplace(p->spec, std::vector<std::string>{p->feature_list.begin(), p->feature_list.end()});
+ ret.features.emplace(p->spec,
+ std::vector<std::string> {p->feature_list.begin(), p->feature_list.end()});
if (Util::Sets::contains(exclusions, p->spec.name()))
{
@@ -183,7 +194,8 @@ namespace vcpkg::Commands::CI
exclusions_set.insert(exclusions.begin(), exclusions.end());
}
- auto is_dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN);
+ const auto is_dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN);
+ const auto purge_tombstones = Util::Sets::contains(options.switches, OPTION_PURGE_TOMBSTONES);
std::vector<Triplet> triplets;
for (const std::string& triplet : args.command_arguments)
@@ -222,7 +234,8 @@ namespace vcpkg::Commands::CI
std::vector<PackageSpec> specs = PackageSpec::to_package_specs(all_ports, triplet);
// Install the default features for every package
auto all_fspecs = Util::fmap(specs, [](auto& spec) { return FeatureSpec(spec, ""); });
- auto split_specs = find_unknown_ports_for_ci(paths, exclusions_set, paths_port_file, all_fspecs);
+ auto split_specs =
+ find_unknown_ports_for_ci(paths, exclusions_set, paths_port_file, all_fspecs, purge_tombstones);
auto fspecs = FullPackageSpec::to_feature_specs(split_specs.unknown);
for (auto&& fspec : fspecs)
@@ -292,7 +305,7 @@ namespace vcpkg::Commands::CI
for (auto&& result : known_result)
{
xunit_doc +=
- Install::InstallSummary::xunit_result(result.first, Chrono::ElapsedTime{}, result.second);
+ Install::InstallSummary::xunit_result(result.first, Chrono::ElapsedTime {}, result.second);
}
}