message: [vcpkg ci] Add --purge-tombstones flag
diff: @@ -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;
  @@ -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)
  