mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 16:12:46 +08:00
[vcpkg ci] Add --purge-tombstones flag
This commit is contained in:
parent
c6552cba45
commit
4202405411
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user