Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / maintainers / scripts / check-hydra-by-maintainer.nix
blobc40729a3974ed5afeb570e2eaa6f4209a16a7252
1 { maintainer }:
2 let
3   pkgs = import ./../../default.nix {
4     config.allowAliases = false;
5   };
6   inherit (pkgs) lib;
7   maintainer_ = pkgs.lib.maintainers.${maintainer};
8   packagesWith = cond: return: prefix: set:
9     (lib.flatten
10       (lib.mapAttrsToList
11         (name: pkg:
12           let
13             result = builtins.tryEval
14               (
15                 if lib.isDerivation pkg && cond name pkg then
16                 # Skip packages whose closure fails on evaluation.
17                 # This happens for pkgs like `python27Packages.djangoql`
18                 # that have disabled Python pkgs as dependencies.
19                   builtins.seq pkg.outPath
20                     [ (return "${prefix}${name}") ]
21                 else if pkg.recurseForDerivations or false || pkg.recurseForRelease or false
22                 # then packagesWith cond return pkg
23                 then packagesWith cond return "${name}." pkg
24                 else [ ]
25               );
26           in
27           if result.success then result.value
28           else [ ]
29         )
30         set
31       )
32     );
34   packages = packagesWith
35     (name: pkg:
36       (
37         if builtins.hasAttr "meta" pkg && builtins.hasAttr "maintainers" pkg.meta
38         then
39           (
40             if builtins.isList pkg.meta.maintainers
41             then builtins.elem maintainer_ pkg.meta.maintainers
42             else maintainer_ == pkg.meta.maintainers
43           )
44         else false
45       )
46     )
47     (name: name)
48     ""
49     pkgs;
52 pkgs.stdenv.mkDerivation {
53   name = "nixpkgs-update-script";
54   buildInputs = [ pkgs.hydra-check ];
55   buildCommand = ''
56     echo ""
57     echo "----------------------------------------------------------------"
58     echo ""
59     echo "nix-shell maintainers/scripts/check-hydra-by-maintainer.nix --argstr maintainer SuperSandro2000"
60     echo ""
61     echo "----------------------------------------------------------------"
62     exit 1
63   '';
64   shellHook = ''
65     unset shellHook # do not contaminate nested shells
66     echo "Please stand by"
67     echo nix-shell -p hydra-check --run "hydra-check ${builtins.concatStringsSep " " packages}"
68     nix-shell -p hydra-check --run "hydra-check ${builtins.concatStringsSep " " packages}"
69     exit $?
70   '';