@@ -292,7 +292,8 @@ namespace vcpkg
292292 PackageGraph (const PortFileProvider& provider,
293293 const CMakeVars::CMakeVarProvider& var_provider,
294294 const StatusParagraphs& status_db,
295- Triplet host_triplet);
295+ Triplet host_triplet,
296+ const Path& packages_dir);
296297 ~PackageGraph () = default ;
297298
298299 void install (Span<const FeatureSpec> specs, UnsupportedPortAction unsupported_port_action);
@@ -306,6 +307,7 @@ namespace vcpkg
306307 const CMakeVars::CMakeVarProvider& m_var_provider;
307308
308309 std::unique_ptr<ClusterGraph> m_graph;
310+ Path m_packages_dir;
309311 std::map<FeatureSpec, PlatformExpression::Expr> m_unsupported_features;
310312 };
311313
@@ -457,6 +459,7 @@ namespace vcpkg
457459
458460 InstallPlanAction::InstallPlanAction (const PackageSpec& spec,
459461 const SourceControlFileAndLocation& scfl,
462+ const Path& packages_dir,
460463 const RequestType& request_type,
461464 Triplet host_triplet,
462465 std::map<std::string, std::vector<FeatureSpec>>&& dependencies,
@@ -469,6 +472,7 @@ namespace vcpkg
469472 , feature_dependencies(std::move(dependencies))
470473 , build_failure_messages(std::move(build_failure_messages))
471474 , host_triplet(host_triplet)
475+ , package_dir(packages_dir / spec.dir())
472476 {
473477 }
474478
@@ -707,7 +711,7 @@ namespace vcpkg
707711 const StatusParagraphs& status_db,
708712 const CreateInstallPlanOptions& options)
709713 {
710- PackageGraph pgraph (port_provider, var_provider, status_db, options.host_triplet );
714+ PackageGraph pgraph (port_provider, var_provider, status_db, options.host_triplet , options. packages_dir );
711715
712716 std::vector<FeatureSpec> feature_specs;
713717 for (const FullPackageSpec& spec : specs)
@@ -719,17 +723,7 @@ namespace vcpkg
719723
720724 pgraph.install (feature_specs, options.unsupported_port_action );
721725
722- auto res = pgraph.serialize (options.randomizer );
723-
724- for (auto && action : res.install_actions )
725- {
726- if (action.source_control_file_and_location .has_value ())
727- {
728- action.package_dir .emplace (options.packages_dir / action.spec .dir ());
729- }
730- }
731-
732- return res;
726+ return pgraph.serialize (options.randomizer );
733727 }
734728
735729 void PackageGraph::mark_for_reinstall (const PackageSpec& first_remove_spec,
@@ -927,7 +921,7 @@ namespace vcpkg
927921 const StatusParagraphs& status_db,
928922 const CreateInstallPlanOptions& options)
929923 {
930- PackageGraph pgraph (port_provider, var_provider, status_db, options.host_triplet );
924+ PackageGraph pgraph (port_provider, var_provider, status_db, options.host_triplet , options. packages_dir );
931925
932926 pgraph.upgrade (specs, options.unsupported_port_action );
933927
@@ -1044,21 +1038,33 @@ namespace vcpkg
10441038 fspecs.insert (fspec);
10451039 continue ;
10461040 }
1041+
10471042 auto && dep_clust = m_graph->get (fspec.spec ());
10481043 const auto & default_features = [&] {
10491044 if (dep_clust.m_install_info .has_value ())
1045+ {
10501046 return dep_clust.get_scfl_or_exit ()
10511047 .source_control_file ->core_paragraph ->default_features ;
1052- if (auto p = dep_clust.m_installed .get ()) return p->ipv .core ->package .default_features ;
1048+ }
1049+
1050+ if (auto p = dep_clust.m_installed .get ())
1051+ {
1052+ return p->ipv .core ->package .default_features ;
1053+ }
1054+
10531055 Checks::unreachable (VCPKG_LINE_INFO);
10541056 }();
1057+
10551058 for (auto && default_feature : default_features)
1059+ {
10561060 fspecs.emplace (fspec.spec (), default_feature);
1061+ }
10571062 }
10581063 computed_edges[kv.first ].assign (fspecs.begin (), fspecs.end ());
10591064 }
10601065 plan.install_actions .emplace_back (p_cluster->m_spec ,
10611066 p_cluster->get_scfl_or_exit (),
1067+ m_packages_dir,
10621068 p_cluster->request_type ,
10631069 m_graph->m_host_triplet ,
10641070 std::move (computed_edges),
@@ -1113,8 +1119,11 @@ namespace vcpkg
11131119 PackageGraph::PackageGraph (const PortFileProvider& port_provider,
11141120 const CMakeVars::CMakeVarProvider& var_provider,
11151121 const StatusParagraphs& status_db,
1116- Triplet host_triplet)
1117- : m_var_provider(var_provider), m_graph(create_feature_install_graph(port_provider, status_db, host_triplet))
1122+ Triplet host_triplet,
1123+ const Path& packages_dir)
1124+ : m_var_provider(var_provider)
1125+ , m_graph(create_feature_install_graph(port_provider, status_db, host_triplet))
1126+ , m_packages_dir(packages_dir)
11181127 {
11191128 }
11201129
@@ -1272,12 +1281,14 @@ namespace vcpkg
12721281 const IBaselineProvider& base_provider,
12731282 const IOverlayProvider& oprovider,
12741283 const CMakeVars::CMakeVarProvider& var_provider,
1275- Triplet host_triplet)
1284+ Triplet host_triplet,
1285+ const Path& packages_dir)
12761286 : m_ver_provider(ver_provider)
12771287 , m_base_provider(base_provider)
12781288 , m_o_provider(oprovider)
12791289 , m_var_provider(var_provider)
12801290 , m_host_triplet(host_triplet)
1291+ , m_packages_dir(packages_dir)
12811292 {
12821293 }
12831294
@@ -1294,6 +1305,7 @@ namespace vcpkg
12941305 const IOverlayProvider& m_o_provider;
12951306 const CMakeVars::CMakeVarProvider& m_var_provider;
12961307 const Triplet m_host_triplet;
1308+ const Path m_packages_dir;
12971309
12981310 struct DepSpec
12991311 {
@@ -1784,6 +1796,7 @@ namespace vcpkg
17841796 : RequestType::AUTO_SELECTED;
17851797 InstallPlanAction ipa (dep.spec ,
17861798 *node.second .scfl ,
1799+ m_packages_dir,
17871800 request,
17881801 m_host_triplet,
17891802 compute_feature_dependencies (node, deps),
@@ -1901,24 +1914,14 @@ namespace vcpkg
19011914 const PackageSpec& toplevel,
19021915 const CreateInstallPlanOptions& options)
19031916 {
1904- VersionedPackageGraph vpg (provider, bprovider, oprovider, var_provider, options.host_triplet );
1917+ VersionedPackageGraph vpg (
1918+ provider, bprovider, oprovider, var_provider, options.host_triplet , options.packages_dir );
19051919 for (auto && o : overrides)
19061920 {
19071921 vpg.add_override (o.name , {o.version , o.port_version });
19081922 }
19091923
19101924 vpg.solve_with_roots (deps, toplevel);
1911- auto ret = vpg.finalize_extract_plan (toplevel, options.unsupported_port_action );
1912- if (auto plan = ret.get ())
1913- {
1914- for (auto && action : plan->install_actions )
1915- {
1916- if (action.source_control_file_and_location .has_value ())
1917- {
1918- action.package_dir .emplace (options.packages_dir / action.spec .dir ());
1919- }
1920- }
1921- }
1922- return ret;
1925+ return vpg.finalize_extract_plan (toplevel, options.unsupported_port_action );
19231926 }
19241927}
0 commit comments