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