@@ -477,19 +477,29 @@ impl SourceBuildSpec {
477477 CommandDispatcherError :: Failed ( SourceBuildError :: CreateWorkDirectory ( err) )
478478 } ) ?;
479479
480+ // Extract the repodata records from the build and host environments.
481+ let build_records = Self :: extract_prefix_repodata ( build_records, build_prefix) ;
482+ let host_records = Self :: extract_prefix_repodata ( host_records, host_prefix) ;
483+
480484 let built_source = command_dispatcher
481485 . backend_source_build ( BackendSourceBuildSpec {
482486 method : BackendSourceBuildMethod :: BuildV1 ( BackendSourceBuildV1Method {
483487 editable : self . editable ( ) ,
484488 build_prefix : BackendSourceBuildPrefix {
485489 platform : self . build_environment . build_platform ,
486490 prefix : directories. build_prefix ,
487- records : build_records. clone ( ) ,
491+ records : build_records
492+ . iter ( )
493+ . map ( |p| p. repodata_record . clone ( ) )
494+ . collect ( ) ,
488495 } ,
489496 host_prefix : BackendSourceBuildPrefix {
490497 platform : self . build_environment . host_platform ,
491498 prefix : directories. host_prefix ,
492- records : host_records. clone ( ) ,
499+ records : host_records
500+ . iter ( )
501+ . map ( |p| p. repodata_record . clone ( ) )
502+ . collect ( ) ,
493503 } ,
494504 variant : output. metadata . variant ,
495505 output_directory : self . output_directory ,
@@ -503,50 +513,52 @@ impl SourceBuildSpec {
503513 . await
504514 . map_err_with ( SourceBuildError :: from) ?;
505515
506- // Little helper function the build a `BuildHostEnvironment` from expected and
507- // installed records.
508- let build_host_environment =
509- |records : Vec < PixiRecord > , prefix : Option < InstallPixiEnvironmentResult > | {
510- let Some ( prefix) = prefix else {
511- return BuildHostEnvironment { packages : vec ! [ ] } ;
512- } ;
513-
514- BuildHostEnvironment {
515- packages : records
516- . into_iter ( )
517- . map ( |record| match record {
518- PixiRecord :: Binary ( repodata_record) => BuildHostPackage {
519- repodata_record,
520- source : None ,
521- } ,
522- PixiRecord :: Source ( source) => {
523- let repodata_record = prefix
524- . resolved_source_records
525- . get ( & source. package_record . name )
526- . cloned ( )
527- . expect (
528- "the source record should be present in the result sources" ,
529- ) ;
530- BuildHostPackage {
531- repodata_record,
532- source : Some ( source. source ) ,
533- }
534- }
535- } )
536- . collect ( ) ,
537- }
538- } ;
539-
540516 Ok ( BuiltPackage {
541517 output_file : built_source. output_file ,
542518 metadata : CachedBuildSourceInfo {
543519 globs : built_source. input_globs ,
544- build : build_host_environment ( build_records, build_prefix) ,
545- host : build_host_environment ( host_records, host_prefix) ,
520+ build : BuildHostEnvironment {
521+ packages : build_records,
522+ } ,
523+ host : BuildHostEnvironment {
524+ packages : host_records,
525+ } ,
546526 } ,
547527 } )
548528 }
549529
530+ /// Little helper function the build a `BuildHostPackage` from expected and
531+ /// installed records.
532+ fn extract_prefix_repodata (
533+ records : Vec < PixiRecord > ,
534+ prefix : Option < InstallPixiEnvironmentResult > ,
535+ ) -> Vec < BuildHostPackage > {
536+ let Some ( prefix) = prefix else {
537+ return vec ! [ ] ;
538+ } ;
539+
540+ records
541+ . into_iter ( )
542+ . map ( |record| match record {
543+ PixiRecord :: Binary ( repodata_record) => BuildHostPackage {
544+ repodata_record,
545+ source : None ,
546+ } ,
547+ PixiRecord :: Source ( source) => {
548+ let repodata_record = prefix
549+ . resolved_source_records
550+ . get ( & source. package_record . name )
551+ . cloned ( )
552+ . expect ( "the source record should be present in the result sources" ) ;
553+ BuildHostPackage {
554+ repodata_record,
555+ source : Some ( source. source ) ,
556+ }
557+ }
558+ } )
559+ . collect ( )
560+ }
561+
550562 async fn solve_dependencies (
551563 & self ,
552564 name : String ,
0 commit comments