release-lib: Adapt to work with new meta.platforms

`packagePlatforms` now filters `supportedSystems` with the new-style
`meta.platforms`, rather than just plopping it in as is.
This commit is contained in:
John Ericson 2018-01-31 16:36:52 -05:00
parent c26252af3e
commit eae19f3c28

View file

@ -98,7 +98,18 @@ rec {
packagePlatforms = mapAttrs (name: value:
let res = builtins.tryEval (
if isDerivation value then
value.meta.hydraPlatforms or (value.meta.platforms or [ "x86_64-linux" ])
# TODO(@Ericson2314) deduplicate with `checkPlatform` in
# `pkgs/stdenv/generic/check-meta.nix`.
value.meta.hydraPlatforms or (let
raw = value.meta.platforms or [ "x86_64-linux" ];
toPattern = x: if builtins.isString x
then { system = x; }
else { parsed = x; };
uniform = map toPattern raw;
pred = hostPlatform:
lib.any (pat: lib.matchAttrs pat hostPlatform) uniform;
pred' = system: pred (lib.systems.elaborate { inherit system; });
in lib.filter pred' supportedSystems)
else if value.recurseForDerivations or false || value.recurseForRelease or false then
packagePlatforms value
else