lib/meta(availableOn): handle missing meta and empty meta.platform

This commit is contained in:
Adam Joseph 2022-10-09 15:25:46 -07:00 committed by Alyssa Ross
parent 8e0e5f43f1
commit 0b90e548b5

View file

@ -92,12 +92,15 @@ rec {
A package is available on a platform if both
1. One of `meta.platforms` pattern matches the given platform.
1. One of `meta.platforms` pattern matches the given
platform, or `meta.platforms` is not present.
2. None of `meta.badPlatforms` pattern matches the given platform.
*/
availableOn = platform: pkg:
lib.any (platformMatch platform) pkg.meta.platforms &&
if !(pkg?meta) then true else
(!(pkg.meta ? platforms) ||
lib.any (platformMatch platform) pkg.meta.platforms) &&
lib.all (elem: !platformMatch platform elem) (pkg.meta.badPlatforms or []);
/* Get the corresponding attribute in lib.licenses