diff options
| author | Daniel Shaw <t-dansha@microsoft.com> | 2017-06-26 15:45:31 -0700 |
|---|---|---|
| committer | Daniel Shaw <t-dansha@microsoft.com> | 2017-06-26 15:52:18 -0700 |
| commit | cc06f978914917622904a0326094c1d5fba4118e (patch) | |
| tree | e3cd4ec34180e50ee2cc83f17b5e0e6ba4eb481d | |
| parent | 838e8783d659456037c0e8e89dcc689e626b6816 (diff) | |
| download | vcpkg-cc06f978914917622904a0326094c1d5fba4118e.tar.gz vcpkg-cc06f978914917622904a0326094c1d5fba4118e.zip | |
Merge branch 'master' into create_install_tests
| -rw-r--r-- | toolsrc/src/commands_ci.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/test_install_plan.cpp | 16 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Dependencies.cpp | 61 |
3 files changed, 13 insertions, 68 deletions
diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index 85febd580..5f6fc95b5 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -40,8 +40,8 @@ namespace vcpkg::Commands::CI const std::vector<PackageSpec> specs = load_all_package_specs(paths.get_filesystem(), paths.ports, triplet); StatusParagraphs status_db = database_load_check(paths); - const std::vector<InstallPlanAction> install_plan /* = - Dependencies::create_install_plan(Dependencies::PathsPortFile(paths), specs, status_db)*/; + const std::vector<InstallPlanAction> install_plan = + Dependencies::create_install_plan(Dependencies::PathsPortFile(paths), specs, status_db); Checks::check_exit(VCPKG_LINE_INFO, !install_plan.empty(), "Install plan cannot be empty"); std::vector<BuildResult> results; diff --git a/toolsrc/src/test_install_plan.cpp b/toolsrc/src/test_install_plan.cpp index 90aaa532f..2404e30f7 100644 --- a/toolsrc/src/test_install_plan.cpp +++ b/toolsrc/src/test_install_plan.cpp @@ -19,9 +19,9 @@ namespace UnitTest1 Assert::IsTrue(m_pgh.has_value()); auto& scf = *m_pgh.get(); - auto spec = PackageSpec::from_name_and_triplet(scf.core_paragraph.name, Triplet::X86_WINDOWS); + auto spec = PackageSpec::from_name_and_triplet(scf->core_paragraph->name, Triplet::X86_WINDOWS); Assert::IsTrue(spec.has_value()); - map.emplace(*spec.get(), std::move(*m_pgh.get())); + map.emplace(*spec.get(), std::move(*scf.get())); return PackageSpec{*spec.get()}; }; @@ -49,9 +49,9 @@ namespace UnitTest1 Assert::IsTrue(m_pgh.has_value()); auto& scf = *m_pgh.get(); - auto spec = PackageSpec::from_name_and_triplet(scf.core_paragraph.name, Triplet::X86_WINDOWS); + auto spec = PackageSpec::from_name_and_triplet(scf->core_paragraph->name, Triplet::X86_WINDOWS); Assert::IsTrue(spec.has_value()); - map.emplace(*spec.get(), std::move(*m_pgh.get())); + map.emplace(*spec.get(), std::move(*scf.get())); return PackageSpec{*spec.get()}; }; @@ -103,13 +103,13 @@ namespace UnitTest1 {"Version", "1.2.8"}, {"Architecture", "x86-windows"}, {"Multi-Arch", "same"}, - {"Build-Depends", "k"}, + {"Depends", "k"}, {"Status", "install ok installed"}})); status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "k"}, {"Version", "1.2.8"}, {"Architecture", "x86-windows"}, {"Multi-Arch", "same"}, - {"Build-Depends", ""}, + {"Depends", ""}, {"Status", "install ok installed"}})); std::unordered_map<PackageSpec, SourceControlFile> map; @@ -118,9 +118,9 @@ namespace UnitTest1 Assert::IsTrue(m_pgh.has_value()); auto& scf = *m_pgh.get(); - auto spec = PackageSpec::from_name_and_triplet(scf.core_paragraph.name, Triplet::X86_WINDOWS); + auto spec = PackageSpec::from_name_and_triplet(scf->core_paragraph->name, Triplet::X86_WINDOWS); Assert::IsTrue(spec.has_value()); - map.emplace(*spec.get(), std::move(*m_pgh.get())); + map.emplace(*spec.get(), std::move(*scf.get())); return PackageSpec{*spec.get()}; }; diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index 79f572496..726c147fd 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -158,12 +158,12 @@ namespace vcpkg::Dependencies { return &cache_it->second; } - ExpectedT<SourceControlFile, ParseControlErrorInfo> source_control_file = + Parse::ParseExpected<SourceControlFile> source_control_file = Paragraphs::try_load_port(ports.get_filesystem(), ports.port_dir(spec)); if (auto scf = source_control_file.get()) { - auto it = cache.emplace(spec, std::move(*scf)); + auto it = cache.emplace(spec, std::move(*scf->get())); return &it.first->second; } @@ -201,7 +201,7 @@ namespace vcpkg::Dependencies auto it = status_db.find_installed(spec); if (it != status_db.end()) return InstallPlanAction{spec, {*it->get(), nullopt, nullopt}, request_type}; return InstallPlanAction{ - spec, {nullopt, nullopt, port_file_provider.get_control_file(spec)->core_paragraph}, request_type}; + spec, {nullopt, nullopt, *port_file_provider.get_control_file(spec)->core_paragraph}, request_type}; } }; @@ -216,61 +216,6 @@ namespace vcpkg::Dependencies return toposort; } - std::vector<InstallPlanAction> create_full_install_plan(const VcpkgPaths& paths, - const std::vector<PackageSpec>& specs, - const StatusParagraphs& status_db) - { - struct InstallAdjacencyProvider final : Graphs::AdjacencyProvider<PackageSpec, InstallPlanAction> - { - const VcpkgPaths& paths; - const StatusParagraphs& status_db; - const std::unordered_set<PackageSpec>& specs_as_set; - - InstallAdjacencyProvider(const VcpkgPaths& p, - const StatusParagraphs& s, - const std::unordered_set<PackageSpec>& specs_as_set) - : paths(p), status_db(s), specs_as_set(specs_as_set) - { - } - - std::vector<PackageSpec> adjacency_list(const InstallPlanAction& plan) const override - { - if (plan.any_paragraph.status_paragraph.get()) return std::vector<PackageSpec>{}; - return plan.any_paragraph.dependencies(plan.spec.triplet()); - } - - InstallPlanAction load_vertex_data(const PackageSpec& spec) const override - { - const RequestType request_type = specs_as_set.find(spec) != specs_as_set.end() - ? RequestType::USER_REQUESTED - : RequestType::AUTO_SELECTED; - auto it = status_db.find_installed(spec); - if (it != status_db.end()) return InstallPlanAction{spec, {*it->get(), nullopt, nullopt}, request_type}; - - Expected<BinaryParagraph> maybe_bpgh = Paragraphs::try_load_cached_package(paths, spec); - if (auto bpgh = maybe_bpgh.get()) - return InstallPlanAction{spec, {nullopt, *bpgh, nullopt}, request_type}; - - auto maybe_scf = Paragraphs::try_load_port(paths.get_filesystem(), paths.port_dir(spec)); - if (auto scf = maybe_scf.get()) - return InstallPlanAction{spec, {nullopt, nullopt, *scf->get()->core_paragraph}, request_type}; - - print_error_message(maybe_scf.error()); - Checks::exit_fail(VCPKG_LINE_INFO); - } - }; - - const std::unordered_set<PackageSpec> specs_as_set(specs.cbegin(), specs.cend()); - std::vector<InstallPlanAction> toposort = - Graphs::topological_sort(specs, InstallAdjacencyProvider{paths, status_db, specs_as_set}); - Util::erase_remove_if(toposort, [](const InstallPlanAction& plan) { - return plan.request_type == RequestType::AUTO_SELECTED && - plan.plan_type == InstallPlanType::ALREADY_INSTALLED; - }); - - return toposort; - } - std::vector<RemovePlanAction> create_remove_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db) { |
