mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
Avoid with lib;
at the top level in pkgs/top-level/release-lib.nix
This drops the following attributes: 1. _mapTestOnHelper 2. crossMaintainers 3. mkPkgsFor As they were only used in this file.
This commit is contained in:
parent
c551fc033b
commit
a7cdb7f2b1
@ -7,13 +7,33 @@
|
||||
|
||||
let
|
||||
lib = import ../../lib;
|
||||
in with lib;
|
||||
|
||||
rec {
|
||||
|
||||
pkgs = packageSet (lib.recursiveUpdate { system = "x86_64-linux"; config.allowUnsupportedSystem = true; } nixpkgsArgs);
|
||||
inherit lib;
|
||||
inherit (lib)
|
||||
addMetaAttrs
|
||||
any
|
||||
derivations
|
||||
filter
|
||||
flip
|
||||
genAttrs
|
||||
getAttrFromPath
|
||||
hydraJob
|
||||
id
|
||||
isDerivation
|
||||
lists
|
||||
maintainers
|
||||
mapAttrs
|
||||
mapAttrs'
|
||||
mapAttrsRecursive
|
||||
matchAttrs
|
||||
meta
|
||||
nameValuePair
|
||||
platforms
|
||||
recursiveUpdate
|
||||
subtractLists
|
||||
systems
|
||||
;
|
||||
|
||||
pkgs = packageSet (recursiveUpdate { system = "x86_64-linux"; config.allowUnsupportedSystem = true; } nixpkgsArgs);
|
||||
|
||||
hydraJob' = if scrubJobs then hydraJob else id;
|
||||
|
||||
@ -57,8 +77,8 @@ rec {
|
||||
|
||||
# More poor man's memoisation
|
||||
pkgsForCross = let
|
||||
examplesByConfig = lib.flip lib.mapAttrs'
|
||||
lib.systems.examples
|
||||
examplesByConfig = flip mapAttrs'
|
||||
systems.examples
|
||||
(_: crossSystem: nameValuePair crossSystem.config {
|
||||
inherit crossSystem;
|
||||
pkgsFor = mkPkgsFor crossSystem;
|
||||
@ -68,7 +88,7 @@ rec {
|
||||
candidate = examplesByConfig.${crossSystem.config} or null;
|
||||
in if crossSystem == null
|
||||
then native
|
||||
else if candidate != null && lib.matchAttrs crossSystem candidate.crossSystem
|
||||
else if candidate != null && matchAttrs crossSystem candidate.crossSystem
|
||||
then candidate.pkgsFor
|
||||
else mkPkgsFor crossSystem; # uncached fallback
|
||||
|
||||
@ -80,12 +100,12 @@ rec {
|
||||
# This is written in a funny way so that we only elaborate the systems once.
|
||||
supportedMatches = let
|
||||
supportedPlatforms = map
|
||||
(system: lib.systems.elaborate { inherit system; })
|
||||
(system: systems.elaborate { inherit system; })
|
||||
supportedSystems;
|
||||
in metaPatterns: let
|
||||
anyMatch = platform:
|
||||
lib.any (lib.meta.platformMatch platform) metaPatterns;
|
||||
matchingPlatforms = lib.filter anyMatch supportedPlatforms;
|
||||
any (meta.platformMatch platform) metaPatterns;
|
||||
matchingPlatforms = filter anyMatch supportedPlatforms;
|
||||
in map ({ system, ...}: system) matchingPlatforms;
|
||||
|
||||
|
||||
@ -135,7 +155,6 @@ rec {
|
||||
(path: metaPatterns: testOnCross crossSystem metaPatterns
|
||||
(pkgs: f (getAttrFromPath path pkgs)));
|
||||
|
||||
|
||||
/* Similar to the testOn function, but with an additional 'crossSystem'
|
||||
* parameter for packageSet', defining the target platform for cross builds,
|
||||
* and triggering the build of the host derivation. */
|
||||
@ -148,7 +167,7 @@ rec {
|
||||
packagePlatforms = mapAttrs (name: value:
|
||||
if isDerivation value then
|
||||
value.meta.hydraPlatforms
|
||||
or (lib.subtractLists (value.meta.badPlatforms or [])
|
||||
or (subtractLists (value.meta.badPlatforms or [])
|
||||
(value.meta.platforms or [ "x86_64-linux" ]))
|
||||
else if value.recurseForDerivations or false || value.recurseForRelease or false then
|
||||
packagePlatforms value
|
||||
@ -156,8 +175,24 @@ rec {
|
||||
[]
|
||||
);
|
||||
|
||||
|
||||
in {
|
||||
/* Common platform groups on which to test packages. */
|
||||
inherit (platforms) unix linux darwin cygwin all mesaPlatforms;
|
||||
|
||||
inherit
|
||||
assertTrue
|
||||
forAllSystems
|
||||
forMatchingSystems
|
||||
hydraJob'
|
||||
lib
|
||||
mapTestOn
|
||||
mapTestOnCross
|
||||
packagePlatforms
|
||||
pkgs
|
||||
pkgsFor
|
||||
pkgsForCross
|
||||
supportedMatches
|
||||
testOn
|
||||
testOnCross
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user