Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 47d3f10ecd53
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5bb50fb9f6b8
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 20, 2018

  1. release-lib: Filter supportedSystems with meta.platforms-style patt…

    …erns
    
    Instead of intersecting system strings, we filter with the sort of
    patterns used in `meta.platforms`.
    
    Indicating this change `forTheseSystems` has been renamed to
    `forMatchingSystems`, since the given list is now patterns to match, and
    not the systems themselves. [Just as with `meta.platforms`, systems
    strings are also supported for backwards compatibility.]
    
    This is more flexible, and makes the `forMatchingSystems` and
    packagePlatforms` cases more analogous.
    Ericson2314 committed Mar 20, 2018
    Copy the full SHA
    192f414 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b9a720c View commit details
  3. Copy the full SHA
    5bb50fb View commit details
Showing with 57 additions and 38 deletions.
  1. +25 −25 nixos/release.nix
  2. +1 −1 pkgs/top-level/release-cross.nix
  3. +31 −12 pkgs/top-level/release-lib.nix
50 changes: 25 additions & 25 deletions nixos/release.nix
Original file line number Diff line number Diff line change
@@ -17,14 +17,14 @@ let
} // args);

# Note: only supportedSystems are considered.
callTestOnTheseSystems = systems: fn: args:
forTheseSystems
callTestOnMatchingSystems = systems: fn: args:
forMatchingSystems
(intersectLists supportedSystems systems)
(system: hydraJob (importTest fn args system));
callTest = callTestOnTheseSystems supportedSystems;
callTest = callTestOnMatchingSystems supportedSystems;

callSubTests = callSubTestsOnTheseSystems supportedSystems;
callSubTestsOnTheseSystems = systems: fn: args: let
callSubTests = callSubTestsOnMatchingSystems supportedSystems;
callSubTestsOnMatchingSystems = systems: fn: args: let
discover = attrs: let
subTests = filterAttrs (const (hasAttr "test")) attrs;
in mapAttrs (const (t: hydraJob t.test)) subTests;
@@ -127,7 +127,7 @@ in rec {
# Build the initial ramdisk so Hydra can keep track of its size over time.
initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk);

netboot = forTheseSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot {
netboot = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (system: makeNetboot {
inherit system;
modules = [
./modules/installer/netboot/netboot-minimal.nix
@@ -141,23 +141,23 @@ in rec {
inherit system;
});

iso_graphical = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
iso_graphical = forMatchingSystems [ "x86_64-linux" ] (system: makeIso {
module = ./modules/installer/cd-dvd/installation-cd-graphical-kde.nix;
type = "graphical";
inherit system;
});

# A variant with a more recent (but possibly less stable) kernel
# that might support more hardware.
iso_minimal_new_kernel = forTheseSystems [ "x86_64-linux" ] (system: makeIso {
iso_minimal_new_kernel = forMatchingSystems [ "x86_64-linux" ] (system: makeIso {
module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
type = "minimal-new-kernel";
inherit system;
});


# A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
ova = forTheseSystems [ "x86_64-linux" ] (system:
ova = forMatchingSystems [ "x86_64-linux" ] (system:

with import nixpkgs { inherit system; };

@@ -233,9 +233,9 @@ in rec {
tests.boot-stage1 = callTest tests/boot-stage1.nix {};
tests.borgbackup = callTest tests/borgbackup.nix {};
tests.buildbot = callTest tests/buildbot.nix {};
tests.cadvisor = callTestOnTheseSystems ["x86_64-linux"] tests/cadvisor.nix {};
tests.ceph = callTestOnTheseSystems ["x86_64-linux"] tests/ceph.nix {};
tests.chromium = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {};
tests.cadvisor = callTestOnMatchingSystems ["x86_64-linux"] tests/cadvisor.nix {};
tests.ceph = callTestOnMatchingSystems ["x86_64-linux"] tests/ceph.nix {};
tests.chromium = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/chromium.nix {}).stable or {};
tests.cjdns = callTest tests/cjdns.nix {};
tests.cloud-init = callTest tests/cloud-init.nix {};
tests.containers-ipv4 = callTest tests/containers-ipv4.nix {};
@@ -249,21 +249,21 @@ in rec {
tests.containers-hosts = callTest tests/containers-hosts.nix {};
tests.containers-macvlans = callTest tests/containers-macvlans.nix {};
tests.couchdb = callTest tests/couchdb.nix {};
tests.docker = callTestOnTheseSystems ["x86_64-linux"] tests/docker.nix {};
tests.docker-tools = callTestOnTheseSystems ["x86_64-linux"] tests/docker-tools.nix {};
tests.docker-edge = callTestOnTheseSystems ["x86_64-linux"] tests/docker-edge.nix {};
tests.docker = callTestOnMatchingSystems ["x86_64-linux"] tests/docker.nix {};
tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {};
tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {};
tests.dovecot = callTest tests/dovecot.nix {};
tests.dnscrypt-proxy = callTestOnTheseSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
tests.ecryptfs = callTest tests/ecryptfs.nix {};
tests.etcd = callTestOnTheseSystems ["x86_64-linux"] tests/etcd.nix {};
tests.ec2-nixops = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {};
tests.ec2-config = (callSubTestsOnTheseSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {};
tests.elk = callSubTestsOnTheseSystems ["x86_64-linux"] tests/elk.nix {};
tests.etcd = callTestOnMatchingSystems ["x86_64-linux"] tests/etcd.nix {};
tests.ec2-nixops = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-nixops or {};
tests.ec2-config = (callSubTestsOnMatchingSystems ["x86_64-linux"] tests/ec2.nix {}).boot-ec2-config or {};
tests.elk = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/elk.nix {};
tests.env = callTest tests/env.nix {};
tests.ferm = callTest tests/ferm.nix {};
tests.firefox = callTest tests/firefox.nix {};
tests.firewall = callTest tests/firewall.nix {};
tests.fleet = callTestOnTheseSystems ["x86_64-linux"] tests/fleet.nix {};
tests.fleet = callTestOnMatchingSystems ["x86_64-linux"] tests/fleet.nix {};
tests.fwupd = callTest tests/fwupd.nix {};
#tests.gitlab = callTest tests/gitlab.nix {};
tests.gitolite = callTest tests/gitolite.nix {};
@@ -296,7 +296,7 @@ in rec {
tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {};
tests.kernel-latest = callTest tests/kernel-latest.nix {};
tests.kernel-lts = callTest tests/kernel-lts.nix {};
tests.kubernetes = callSubTestsOnTheseSystems ["x86_64-linux"] tests/kubernetes/default.nix {};
tests.kubernetes = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/kubernetes/default.nix {};
tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; };
tests.ldap = callTest tests/ldap.nix {};
#tests.lightdm = callTest tests/lightdm.nix {};
@@ -326,14 +326,14 @@ in rec {
tests.nginx = callTest tests/nginx.nix { };
tests.nghttpx = callTest tests/nghttpx.nix { };
tests.nix-ssh-serve = callTest tests/nix-ssh-serve.nix { };
tests.novacomd = callTestOnTheseSystems ["x86_64-linux"] tests/novacomd.nix { };
tests.novacomd = callTestOnMatchingSystems ["x86_64-linux"] tests/novacomd.nix { };
tests.leaps = callTest tests/leaps.nix { };
tests.nsd = callTest tests/nsd.nix {};
tests.openssh = callTest tests/openssh.nix {};
tests.openldap = callTest tests/openldap.nix {};
tests.owncloud = callTest tests/owncloud.nix {};
tests.pam-oath-login = callTest tests/pam-oath-login.nix {};
#tests.panamax = callTestOnTheseSystems ["x86_64-linux"] tests/panamax.nix {};
#tests.panamax = callTestOnMatchingSystems ["x86_64-linux"] tests/panamax.nix {};
tests.peerflix = callTest tests/peerflix.nix {};
tests.php-pcre = callTest tests/php-pcre.nix {};
tests.postgresql = callSubTests tests/postgresql.nix {};
@@ -366,7 +366,7 @@ in rec {
tests.tomcat = callTest tests/tomcat.nix {};
tests.udisks2 = callTest tests/udisks2.nix {};
tests.vault = callTest tests/vault.nix {};
tests.virtualbox = callSubTestsOnTheseSystems ["x86_64-linux"] tests/virtualbox.nix {};
tests.virtualbox = callSubTestsOnMatchingSystems ["x86_64-linux"] tests/virtualbox.nix {};
tests.wordpress = callTest tests/wordpress.nix {};
tests.xautolock = callTest tests/xautolock.nix {};
tests.xfce = callTest tests/xfce.nix {};
2 changes: 1 addition & 1 deletion pkgs/top-level/release-cross.nix
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ in
f (["buildPackages"] ++ path) { inherit system crossSystem; }
);

testEqual = path: systems: forTheseSystems systems (testEqualOne path);
testEqual = path: systems: forMatchingSystems systems (testEqualOne path);

mapTestEqual = lib.mapAttrsRecursive testEqual;

43 changes: 31 additions & 12 deletions pkgs/top-level/release-lib.nix
Original file line number Diff line number Diff line change
@@ -48,48 +48,71 @@ rec {
pkgs_x86_64_cygwin = allPackages { system = "x86_64-cygwin"; };


# Given a list of 'meta.platforms'-style patterns, return the sublist of
# `supportedSystems` containing systems that matches at least one of the given
# patterns.
#
# 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; })
supportedSystems;
in metaPatterns: let
anyMatch = platform:
lib.any (lib.meta.platformMatch platform) metaPatterns;
matchingPlatforms = lib.filter anyMatch supportedPlatforms;
in map ({ system, ...}: system) matchingPlatforms;


assertTrue = bool:
if bool
then pkgs.runCommand "evaluated-to-true" {} "touch $out"
else pkgs.runCommand "evaluated-to-false" {} "false";


/* The working or failing mails for cross builds will be sent only to
the following maintainers, as most package maintainers will not be
interested in the result of cross building a package. */
crossMaintainers = [ maintainers.viric ];


# Generate attributes for all supported systems.
forAllSystems = genAttrs supportedSystems;
forTheseSystems = systems: f:
genAttrs (filter (x: elem x supportedSystems) systems) f;


# Generate attributes for all sytems matching at least one of the given
# patterns
forMatchingSystems = metaPatterns: genAttrs (supportedMatches metaPatterns);


/* Build a package on the given set of platforms. The function `f'
is called for each supported platform with Nixpkgs for that
platform as an argument . We return an attribute set containing
a derivation for each supported platform, i.e. ‘{ x86_64-linux =
f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }’. */
testOn = systems: f: forTheseSystems systems
testOn = metaPatterns: f: forMatchingSystems metaPatterns
(system: hydraJob' (f (pkgsFor system)));


/* Similar to the testOn function, but with an additional
'crossSystem' parameter for allPackages, defining the target
platform for cross builds. */
testOnCross = crossSystem: systems: f: forTheseSystems systems
testOnCross = crossSystem: metaPatterns: f: forMatchingSystems metaPatterns
(system: hydraJob' (f (allPackages { inherit system crossSystem; })));


/* Given a nested set where the leaf nodes are lists of platforms,
map each leaf node to `testOn [platforms...] (pkgs:
pkgs.<attrPath>)'. */
mapTestOn = mapAttrsRecursive
(path: systems: testOn systems (pkgs: getAttrFromPath path pkgs));
(path: metaPatterns: testOn metaPatterns (pkgs: getAttrFromPath path pkgs));


/* Similar to the testOn function, but with an additional 'crossSystem'
* parameter for allPackages, defining the target platform for cross builds,
* and triggering the build of the host derivation (cross built - crossDrv). */
mapTestOnCross = crossSystem: mapAttrsRecursive
(path: systems: testOnCross crossSystem systems
(path: metaPatterns: testOnCross crossSystem metaPatterns
(pkgs: addMetaAttrs { maintainers = crossMaintainers; } (getAttrFromPath path pkgs)));


@@ -98,12 +121,8 @@ rec {
packagePlatforms = mapAttrs (name: value:
let res = builtins.tryEval (
if isDerivation value then
value.meta.hydraPlatforms or (let
linuxDefaulted = value.meta.platforms or [ "x86_64-linux" ];
pred = system: lib.any
(lib.meta.platformMatch (lib.systems.elaborate { inherit system; }))
linuxDefaulted;
in lib.filter pred supportedSystems)
value.meta.hydraPlatforms
or supportedMatches (value.meta.platforms or [ "x86_64-linux" ])
else if value.recurseForDerivations or false || value.recurseForRelease or false then
packagePlatforms value
else