@@ -825,40 +825,47 @@ final: prev: {
825
825
byVersion = builtins . groupBy ( x : x . pkg-version ) packageTargets ;
826
826
versions = builtins . attrNames byVersion ;
827
827
in if builtins . length versions != 1
828
- then throw "Multiple versions for ${ packageName } ${ builtins . toJSON versions } "
828
+ then let
829
+ err = throw "Multiple versions for ${ packageName } ${ builtins . toJSON versions } " ;
830
+ in {
831
+ isRedirect = true ;
832
+ identifier = { name = packageName ; version = err ; } ;
833
+ components = err ;
834
+ checks = err ;
835
+ }
829
836
else let
830
- componentsByName = builtins . listToAttrs ( map ( x : { name = x . component-name ; value = x . available ; } ) packageTargets ) ;
831
- lookupComponent = collectionName : name : available :
832
- let attrPath =
833
- if collectionName == ""
834
- then "${ packageName } .components.library"
835
- else "${ packageName } .components.${ collectionName } .${ name } " ;
836
- in if builtins . length available != 1
837
- then throw "Multiple avaialble targets for ${ attrPath } "
838
- else if builtins . isString ( builtins . head available )
839
- then throw "${ builtins . head available } looking for ${ attrPath } "
840
- else if collectionName == ""
841
- then config . hsPkgs . ${ ( builtins . head available ) . id } . components . library
842
- else config . hsPkgs . ${ ( builtins . head available ) . id } . components . ${ collectionName } . ${ name } ;
843
- componentsWithPrefix = collectionName : prefix :
844
- final . lib . listToAttrs ( final . lib . concatLists ( final . lib . mapAttrsToList ( n : available :
845
- final . lib . optional ( final . lib . hasPrefix "${ prefix } :" n && ( builtins . length available != 1 || ! builtins . elem ( builtins . head available ) [ "TargetNotBuildable" "TargetNotLocal" ] ) ) (
846
- let
847
- name = final . lib . removePrefix "${ prefix } :" n ;
848
- value = lookupComponent collectionName name available ;
849
- in { inherit name value ; }
850
- ) ) componentsByName ) ) ;
851
- in rec {
852
- identifier = { name = packageName ; version = builtins . head versions ; } ;
853
- components =
854
- final . lib . mapAttrs componentsWithPrefix haskellLib . componentPrefix
855
- // final . lib . optionalAttrs ( componentsByName ? lib ) {
856
- library = lookupComponent "" "" componentsByName . lib ;
857
- } ;
858
- checks = final . recurseIntoAttrs ( builtins . mapAttrs
859
- ( _ : d : haskellLib . check d )
860
- ( final . lib . filterAttrs ( _ : d : d . config . doCheck ) components . tests ) ) ;
861
- } )
837
+ componentsByName = builtins . listToAttrs ( map ( x : { name = x . component-name ; value = x . available ; } ) packageTargets ) ;
838
+ lookupComponent = collectionName : name : available :
839
+ let attrPath =
840
+ if collectionName == ""
841
+ then "${ packageName } .components.library"
842
+ else "${ packageName } .components.${ collectionName } .${ name } " ;
843
+ in if builtins . length available != 1
844
+ then throw "Multiple avaialble targets for ${ attrPath } "
845
+ else if builtins . isString ( builtins . head available )
846
+ then throw "${ builtins . head available } looking for ${ attrPath } "
847
+ else if collectionName == ""
848
+ then config . hsPkgs . ${ ( builtins . head available ) . id } . components . library
849
+ else config . hsPkgs . ${ ( builtins . head available ) . id } . components . ${ collectionName } . ${ name } ;
850
+ componentsWithPrefix = collectionName : prefix :
851
+ final . lib . listToAttrs ( final . lib . concatLists ( final . lib . mapAttrsToList ( n : available :
852
+ final . lib . optional ( final . lib . hasPrefix "${ prefix } :" n && ( builtins . length available != 1 || ! builtins . elem ( builtins . head available ) [ "TargetNotBuildable" "TargetNotLocal" ] ) ) (
853
+ let
854
+ name = final . lib . removePrefix "${ prefix } :" n ;
855
+ value = lookupComponent collectionName name available ;
856
+ in { inherit name value ; }
857
+ ) ) componentsByName ) ) ;
858
+ in rec {
859
+ identifier = { name = packageName ; version = builtins . head versions ; } ;
860
+ components =
861
+ final . lib . mapAttrs componentsWithPrefix haskellLib . componentPrefix
862
+ // final . lib . optionalAttrs ( componentsByName ? lib ) {
863
+ library = lookupComponent "" "" componentsByName . lib ;
864
+ } ;
865
+ checks = final . recurseIntoAttrs ( builtins . mapAttrs
866
+ ( _ : d : haskellLib . check d )
867
+ ( final . lib . filterAttrs ( _ : d : d . config . doCheck ) components . tests ) ) ;
868
+ } )
862
869
( builtins . groupBy ( x : x . pkg-name ) plan-json . targets ) ) config . preExistingPkgs ;
863
870
} )
864
871
] ;
0 commit comments