package_spec_with_install_plan -> PackageSpecWithInstallPlan

This commit is contained in:
Alexander Karatarakis 2017-04-03 16:23:23 -07:00
parent 3992d3ac64
commit c9f4f312ae
5 changed files with 17 additions and 17 deletions

View File

@ -36,9 +36,9 @@ namespace vcpkg::Dependencies
optional<SourceParagraph> source_pgh;
};
struct package_spec_with_install_plan
struct PackageSpecWithInstallPlan
{
package_spec_with_install_plan(const PackageSpec& spec, InstallPlanAction&& plan);
PackageSpecWithInstallPlan(const PackageSpec& spec, InstallPlanAction&& plan);
PackageSpec spec;
InstallPlanAction plan;
@ -73,7 +73,7 @@ namespace vcpkg::Dependencies
remove_plan_action plan;
};
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
std::vector<PackageSpecWithInstallPlan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
}

View File

@ -13,7 +13,7 @@
namespace vcpkg::Commands::Build
{
using Dependencies::package_spec_with_install_plan;
using Dependencies::PackageSpecWithInstallPlan;
using Dependencies::InstallPlanType;
static const std::string OPTION_CHECKS_ONLY = "--checks-only";
@ -144,9 +144,9 @@ namespace vcpkg::Commands::Build
const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), status_db);
if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
{
std::vector<package_spec_with_install_plan> unmet_dependencies = Dependencies::create_install_plan(paths, { spec }, status_db);
std::vector<PackageSpecWithInstallPlan> unmet_dependencies = Dependencies::create_install_plan(paths, { spec }, status_db);
unmet_dependencies.erase(
std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [&spec](const package_spec_with_install_plan& p)
std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [&spec](const PackageSpecWithInstallPlan& p)
{
return (p.spec == spec) || (p.plan.plan_type == InstallPlanType::ALREADY_INSTALLED);
}),
@ -156,7 +156,7 @@ namespace vcpkg::Commands::Build
System::println(System::color::error, "The build command requires all dependencies to be already installed.");
System::println("The following dependencies are missing:");
System::println("");
for (const package_spec_with_install_plan& p : unmet_dependencies)
for (const PackageSpecWithInstallPlan& p : unmet_dependencies)
{
System::println(" %s", p.spec.toString());
}

View File

@ -10,7 +10,7 @@
namespace vcpkg::Commands::CI
{
using Dependencies::package_spec_with_install_plan;
using Dependencies::PackageSpecWithInstallPlan;
using Dependencies::InstallPlanType;
using Build::BuildResult;
@ -36,7 +36,7 @@ namespace vcpkg::Commands::CI
const std::vector<PackageSpec> specs = load_all_package_specs(paths.ports, target_triplet);
StatusParagraphs status_db = database_load_check(paths);
const std::vector<package_spec_with_install_plan> install_plan = Dependencies::create_install_plan(paths, specs, status_db);
const std::vector<PackageSpecWithInstallPlan> install_plan = Dependencies::create_install_plan(paths, specs, status_db);
Checks::check_exit(VCPKG_LINE_INFO, !install_plan.empty(), "Install plan cannot be empty");
std::vector<BuildResult> results;
@ -44,7 +44,7 @@ namespace vcpkg::Commands::CI
const ElapsedTime timer = ElapsedTime::create_started();
size_t counter = 0;
const size_t package_count = install_plan.size();
for (const package_spec_with_install_plan& action : install_plan)
for (const PackageSpecWithInstallPlan& action : install_plan)
{
const ElapsedTime build_timer = ElapsedTime::create_started();
counter++;

View File

@ -11,7 +11,7 @@
namespace vcpkg::Commands::Install
{
using Dependencies::package_spec_with_install_plan;
using Dependencies::PackageSpecWithInstallPlan;
using Dependencies::InstallPlanType;
static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh)
@ -200,7 +200,7 @@ namespace vcpkg::Commands::Install
// create the plan
StatusParagraphs status_db = database_load_check(paths);
std::vector<package_spec_with_install_plan> install_plan = Dependencies::create_install_plan(paths, specs, status_db);
std::vector<PackageSpecWithInstallPlan> install_plan = Dependencies::create_install_plan(paths, specs, status_db);
Checks::check_exit(VCPKG_LINE_INFO, !install_plan.empty(), "Install plan cannot be empty");
// log the plan
@ -213,7 +213,7 @@ namespace vcpkg::Commands::Install
Metrics::track_property("installplan", specs_string);
// execute the plan
for (const package_spec_with_install_plan& action : install_plan)
for (const PackageSpecWithInstallPlan& action : install_plan)
{
try
{

View File

@ -18,7 +18,7 @@ namespace vcpkg::Dependencies
{
}
package_spec_with_install_plan::package_spec_with_install_plan(const PackageSpec& spec, InstallPlanAction&& plan) : spec(spec), plan(std::move(plan))
PackageSpecWithInstallPlan::PackageSpecWithInstallPlan(const PackageSpec& spec, InstallPlanAction&& plan) : spec(spec), plan(std::move(plan))
{
}
@ -35,7 +35,7 @@ namespace vcpkg::Dependencies
{
}
std::vector<package_spec_with_install_plan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db)
std::vector<PackageSpecWithInstallPlan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db)
{
std::unordered_map<PackageSpec, InstallPlanAction> was_examined; // Examine = we have checked its immediate (non-recursive) dependencies
Graphs::Graph<PackageSpec> graph;
@ -92,12 +92,12 @@ namespace vcpkg::Dependencies
}
}
std::vector<package_spec_with_install_plan> ret;
std::vector<PackageSpecWithInstallPlan> ret;
const std::vector<PackageSpec> pkgs = graph.find_topological_sort();
for (const PackageSpec& pkg : pkgs)
{
ret.push_back(package_spec_with_install_plan(pkg, std::move(was_examined[pkg])));
ret.push_back(PackageSpecWithInstallPlan(pkg, std::move(was_examined[pkg])));
}
return ret;
}