* Nicer notation for Nixpkgs' Hydra jobs. The packages to build are

given as a nested attribute set isomorphic to all-packages.nix,
  where the value for each attribute is a list of platforms on which
  to build the package.  For instance,

    {
      wine = ["i686-linux"];
      xorg = {
        libX11 = ["i686-linux" "x86_64-linux"];
      };
    }

    says that the "wine" attribute in all-packages.nix should be built
    on "i686-linux" only, while the "xorg.libX11" attribute should be
    built on "i686-linux" and "x86_64-linux".

    There are some aliases for common platform groups (currently "all"
    for all supported platforms, "linux" for all supported Linux
    platforms).

svn path=/nixpkgs/trunk/; revision=14496
This commit is contained in:
Eelco Dolstra 2009-03-10 15:23:27 +00:00
parent b53ef57554
commit 731b77ac35

View File

@ -4,76 +4,76 @@ let
pkgs = allPackages {}; pkgs = allPackages {};
/* Perform a job on the given set of platforms. The function `f' is
called by Hydra for each platform, and should return some job
to build on that platform. `f' is passed the Nixpkgs collection
for the platform in question. */
testOn = systems: f: {system ? builtins.currentSystem}: testOn = systems: f: {system ? builtins.currentSystem}:
if pkgs.lib.elem system systems then f (allPackages {inherit system;}) else {}; if pkgs.lib.elem system systems then f (allPackages {inherit system;}) else {};
testOnLinux = testOn ["i686-linux" "x86_64-linux"];
test = testOn ["i686-linux" "x86_64-linux" "i686-darwin" "i686-cygwin"]; /* Map an attribute of the form `foo = [platforms...]' to `testOn
[platforms...] (pkgs: pkgs.foo)'. */
mapTestOn = pkgs.lib.mapAttrsRecursive
(path: value: testOn value (pkgs: pkgs.lib.getAttrFromPath path pkgs));
/* Common platform groups on which to test packages. */
all = ["i686-linux" "x86_64-linux" "i686-darwin" "i686-cygwin"];
linux = ["i686-linux" "x86_64-linux"];
in { in {
tarball = import ./make-tarball.nix; tarball = import ./make-tarball.nix;
/* All the top-level packages that we want to build in the build } // mapTestOn {
farm. The notation is still kinda clumsy. We could use some
meta-programming. E.g. we would want to write
wine = ["i686-linux"];
which would be translated to MPlayer = linux;
apacheHttpd = linux;
wine = testOn ["i686-linux"] (pkgs: pkgs.wine); autoconf = all;
bash = all;
Shouldn't be too hard to make a function that recurses over the firefox3 = linux;
attrset and does this for every attribute. */ gcc = all;
hello = all;
MPlayer = testOnLinux (pkgs: pkgs.MPlayer); libsmbios = linux;
autoconf = test (pkgs: pkgs.autoconf); libtool = all;
bash = test (pkgs: pkgs.bash); pan = linux;
firefox3 = testOnLinux (pkgs: pkgs.firefox3); perl = all;
gcc = test (pkgs: pkgs.gcc); python = all;
hello = test (pkgs: pkgs.hello); thunderbird = linux;
libsmbios = testOnLinux (pkgs: pkgs.libsmbios); vlc = linux;
libtool = test (pkgs: pkgs.libtool); wine = ["i686-linux"];
pan = testOnLinux (pkgs: pkgs.pan);
perl = test (pkgs: pkgs.perl);
python = test (pkgs: pkgs.python);
thunderbird = testOnLinux (pkgs: pkgs.thunderbird);
wine = testOn ["i686-linux"] (pkgs: pkgs.wine);
xorg = {
libX11 = testOnLinux (pkgs: pkgs.xorg.libX11);
};
kde42 = { kde42 = {
kdeadmin = testOnLinux (pkgs: pkgs.kde42.kdeadmin); kdeadmin = linux;
kdeartwork = testOnLinux (pkgs: pkgs.kde42.kdeartwork); kdeartwork = linux;
kdebase = testOnLinux (pkgs: pkgs.kde42.kdebase); kdebase = linux;
kdebase_runtime = testOnLinux (pkgs: pkgs.kde42.kdebase_runtime); kdebase_runtime = linux;
kdebase_workspace = testOnLinux (pkgs: pkgs.kde42.kdebase_workspace); kdebase_workspace = linux;
kdeedu = testOnLinux (pkgs: pkgs.kde42.kdeedu); kdeedu = linux;
kdegames = testOnLinux (pkgs: pkgs.kde42.kdegames); kdegames = linux;
kdegraphics = testOnLinux (pkgs: pkgs.kde42.kdegraphics); kdegraphics = linux;
kdelibs = testOnLinux (pkgs: pkgs.kde42.kdelibs); kdelibs = linux;
kdemultimedia = testOnLinux (pkgs: pkgs.kde42.kdemultimedia); kdemultimedia = linux;
kdenetwork = testOnLinux (pkgs: pkgs.kde42.kdenetwork); kdenetwork = linux;
kdepim = testOnLinux (pkgs: pkgs.kde42.kdepim); kdepim = linux;
kdeplasma_addons = testOnLinux (pkgs: pkgs.kde42.kdeplasma_addons); kdeplasma_addons = linux;
kdesdk = testOnLinux (pkgs: pkgs.kde42.kdesdk); kdesdk = linux;
kdetoys = testOnLinux (pkgs: pkgs.kde42.kdetoys); kdetoys = linux;
kdeutils = testOnLinux (pkgs: pkgs.kde42.kdeutils); kdeutils = linux;
kdewebdev = testOnLinux (pkgs: pkgs.kde42.kdewebdev); kdewebdev = linux;
}; };
kernelPackages_2_6_27 = { kernelPackages_2_6_27 = {
aufs = testOnLinux (pkgs: pkgs.kernelPackages_2_6_27.aufs); aufs = linux;
kernel = testOnLinux (pkgs: pkgs.kernelPackages_2_6_27.kernel); kernel = linux;
}; };
kernelPackages_2_6_28 = { kernelPackages_2_6_28 = {
aufs = testOnLinux (pkgs: pkgs.kernelPackages_2_6_28.aufs); aufs = linux;
kernel = testOnLinux (pkgs: pkgs.kernelPackages_2_6_28.kernel); kernel = linux;
}; };
xorg = {
libX11 = linux;
};
} }