2424#include " mamba/solver/libsolv/repo_info.hpp"
2525#include " mamba/specs/error.hpp"
2626#include " mamba/specs/package_info.hpp"
27+ #include " mamba/specs/version.hpp"
28+
29+ #include " utils.hpp"
2730
2831namespace mamba
2932{
@@ -235,7 +238,8 @@ namespace mamba
235238 std::size_t subdir_idx,
236239 std::set<std::string>& loaded_subdirs_with_shards,
237240 const SubdirDownloadParams& subdir_params,
238- const std::vector<solver::libsolv::Priorities>& priorities
241+ const std::vector<solver::libsolv::Priorities>& priorities,
242+ std::optional<specs::Version> python_minor_version_for_prefilter
239243 )
240244 {
241245 auto & subdir = subdirs[subdir_idx];
@@ -253,7 +257,8 @@ namespace mamba
253257 subdirs,
254258 subdir_idx,
255259 loaded_subdirs_with_shards,
256- priorities
260+ priorities,
261+ python_minor_version_for_prefilter
257262 );
258263
259264 if (!res)
@@ -434,7 +439,8 @@ namespace mamba
434439 const std::vector<solver::libsolv::Priorities>& priorities,
435440 const SubdirDownloadParams& subdir_params,
436441 bool is_retry,
437- std::vector<mamba_error>& error_list
442+ std::vector<mamba_error>& error_list,
443+ std::optional<specs::Version> python_minor_version_for_prefilter
438444 )
439445 {
440446 std::set<std::string> loaded_subdirs_with_shards;
@@ -475,7 +481,8 @@ namespace mamba
475481 i,
476482 loaded_subdirs_with_shards,
477483 subdir_params,
478- priorities
484+ priorities,
485+ python_minor_version_for_prefilter
479486 );
480487
481488 if (result)
@@ -556,7 +563,11 @@ namespace mamba
556563 continue ;
557564 }
558565 SubdirIndexLoader subdir_index_loader = std::move (subdir_index_loader_result).value ();
559- if (subdir_index_loader.valid_cache_found () && Console::can_report_status ())
566+
567+ // Only show flat repodata cache status if we're not using shards and we have a
568+ // valid cache
569+ if (!ctx.repodata_use_shards && subdir_index_loader.valid_cache_found ()
570+ && Console::can_report_status ())
560571 {
561572 Console::stream ()
562573 << fmt::format (" {:<50} {:>20}" , subdir_index_loader.name (), " Using cache" );
@@ -641,7 +652,8 @@ namespace mamba
641652 std::vector<SubdirIndexLoader>& subdirs,
642653 std::size_t subdir_idx,
643654 std::set<std::string>& loaded_subdirs_with_shards,
644- const std::vector<solver::libsolv::Priorities>& priorities
655+ const std::vector<solver::libsolv::Priorities>& priorities,
656+ std::optional<specs::Version> python_minor_version_for_prefilter
645657 ) -> expected_t<solver::libsolv::RepoInfo>
646658 {
647659 auto & subdir = subdirs[subdir_idx];
@@ -670,6 +682,15 @@ namespace mamba
670682 LOG_DEBUG << " Shard index fetched for " << subdir.name ();
671683 const auto & channel = subdir.channel ();
672684 std::string current_repodata_url = subdir.repodata_url ().str ();
685+ if (python_minor_version_for_prefilter.has_value ())
686+ {
687+ LOG_DEBUG << " Shard prefilter on python minor version enabled with "
688+ << python_minor_version_for_prefilter.value ().to_string ();
689+ }
690+ else
691+ {
692+ LOG_DEBUG << " Shard prefilter on python minor version disabled." ;
693+ }
673694
674695 // For all subdirs sharing the same channel URL, fetch their shard indices and build
675696 // a Shards instance per subdir; collect them into a RepodataSubset.
@@ -702,7 +723,8 @@ namespace mamba
702723 ctx.authentication_info (),
703724 ctx.remote_fetch_params ,
704725 normalize_to_affinity_concurrency (static_cast <int >(ctx.repodata_shards_threads )),
705- std::cref (ctx.mirrors )
726+ std::cref (ctx.mirrors ),
727+ python_minor_version_for_prefilter
706728 );
707729 url_to_subdir_idx[sdir_url] = j;
708730 }
@@ -761,7 +783,8 @@ namespace mamba
761783 solver::libsolv::Database& database,
762784 MultiPackageCache& package_caches,
763785 const std::vector<std::string>& root_packages,
764- bool is_retry
786+ bool is_retry,
787+ std::optional<specs::Version> python_minor_version_for_prefilter
765788 )
766789 {
767790 std::vector<SubdirIndexLoader> subdirs;
@@ -808,7 +831,8 @@ namespace mamba
808831 priorities,
809832 subdir_params,
810833 is_retry,
811- error_list
834+ error_list,
835+ python_minor_version_for_prefilter
812836 );
813837
814838 if (loading_failed)
@@ -824,7 +848,8 @@ namespace mamba
824848 database,
825849 package_caches,
826850 root_packages,
827- retry
851+ retry,
852+ python_minor_version_for_prefilter
828853 );
829854 }
830855 error_list.emplace_back (
@@ -843,11 +868,20 @@ namespace mamba
843868 ChannelContext& channel_context,
844869 solver::libsolv::Database& database,
845870 MultiPackageCache& package_caches,
846- const std::vector<std::string>& root_packages
871+ const std::vector<std::string>& root_packages,
872+ std::optional<specs::Version> python_minor_version_for_prefilter
847873 ) -> expected_t<void, mamba_aggregated_error>
848874 {
849875 bool retry = false ;
850- return load_channels_impl (ctx, channel_context, database, package_caches, root_packages, retry);
876+ return load_channels_impl (
877+ ctx,
878+ channel_context,
879+ database,
880+ package_caches,
881+ root_packages,
882+ retry,
883+ std::move (python_minor_version_for_prefilter)
884+ );
851885 }
852886
853887 void init_channels (Context& context, ChannelContext& channel_context)
0 commit comments