Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wording when a package has no platforms list #774

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

Aleksanaa
Copy link
Member

"This package is not available on any platform" is misleading and confusing, so I changed that.

Related NixOS/nixpkgs#270206
Closes #734

@Aleksanaa
Copy link
Member Author

Wait, I didn't look carefully at how our search works, does it only list x86_64-linux, aarch64-linux, i686-linux, x86_64-darwin and aarch64-darwin? Have we stated this somewhere?

If so, maybe we can change the error message a little better, but I have no idea how.

@dasJ
Copy link
Member

dasJ commented Jun 5, 2024

@garbas this should be ready for merge ;)

@wegank
Copy link
Member

wegank commented Jun 5, 2024

If so, maybe we can change the error message a little better, but I have no idea how.

Maybe try deferring filterPlatforms to have a non-empty item.source.platforms even if it doesn't intersect the five platforms?

diff --git a/frontend/src/Page/Packages.elm b/frontend/src/Page/Packages.elm
index b951294..5bf6eab 100644
--- a/frontend/src/Page/Packages.elm
+++ b/frontend/src/Page/Packages.elm
@@ -492,8 +492,11 @@ viewResultItem nixosChannels channel showInstallDetails show item =
                         (if List.isEmpty item.source.platforms then
                             [ p [] [ text "This package does not list its available platforms." ] ]
 
+                         else if List.isEmpty (filterPlatforms item.source.platforms) then
+                            [ p [] [ text "This package is not available on platforms supported by Hydra." ] ]
+
                          else
-                            [ ul [] (List.map showPlatform (List.sort item.source.platforms)) ]
+                            [ ul [] (List.map showPlatform (List.sort (filterPlatforms item.source.platforms))) ]
                         )
                     )
                 ]
@@ -962,7 +965,7 @@ decodeResultItemSource =
         |> Json.Decode.Pipeline.required "package_longDescription" (Json.Decode.nullable Json.Decode.string)
         |> Json.Decode.Pipeline.required "package_license" (Json.Decode.list decodeResultPackageLicense)
         |> Json.Decode.Pipeline.required "package_maintainers" (Json.Decode.list decodeResultPackageMaintainer)
-        |> Json.Decode.Pipeline.required "package_platforms" (Json.Decode.map filterPlatforms (Json.Decode.list Json.Decode.string))
+        |> Json.Decode.Pipeline.required "package_platforms" (Json.Decode.list Json.Decode.string)
         |> Json.Decode.Pipeline.required "package_position" (Json.Decode.nullable Json.Decode.string)
         |> Json.Decode.Pipeline.required "package_homepage" decodeHomepage
         |> Json.Decode.Pipeline.required "package_system" Json.Decode.string

@tomberek tomberek merged commit 2758f76 into NixOS:main Jun 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wording when a package doesn't specify meta.platforms is misleading.
4 participants