summary refs log tree commit diff
path: root/maintainers/scripts
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2020-10-26 03:13:52 +0100
committerSandro Jäckel <sandro.jaeckel@gmail.com>2020-11-26 23:31:43 +0100
commit3cac0987e1bfbe9568417b94e78dd98b0e4573b9 (patch)
treeaad9a7bba7e27b37e61388eea9999e1aa98ce38f /maintainers/scripts
parentbb7b1b59c860a23010473b0408f56c91f7d0c810 (diff)
downloadnixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.tar
nixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.tar.gz
nixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.tar.bz2
nixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.tar.lz
nixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.tar.xz
nixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.tar.zst
nixpkgs-3cac0987e1bfbe9568417b94e78dd98b0e4573b9.zip
maintainer scripts: init check-hydra-by-maintainer.nix
Diffstat (limited to 'maintainers/scripts')
-rw-r--r--maintainers/scripts/check-hydra-by-maintainer.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/maintainers/scripts/check-hydra-by-maintainer.nix b/maintainers/scripts/check-hydra-by-maintainer.nix
new file mode 100644
index 00000000000..cecf65ec66d
--- /dev/null
+++ b/maintainers/scripts/check-hydra-by-maintainer.nix
@@ -0,0 +1,67 @@
+{ maintainer }:
+let
+  pkgs = import ./../../default.nix { };
+  maintainer_ = pkgs.lib.maintainers.${maintainer};
+  packagesWith = cond: return: prefix: set:
+    (pkgs.lib.flatten
+      (pkgs.lib.mapAttrsToList
+        (name: pkg:
+          let
+            result = builtins.tryEval
+              (
+                if pkgs.lib.isDerivation pkg && cond name pkg then
+                # Skip packages whose closure fails on evaluation.
+                # This happens for pkgs like `python27Packages.djangoql`
+                # that have disabled Python pkgs as dependencies.
+                  builtins.seq pkg.outPath
+                    [ (return "${prefix}${name}") ]
+                else if pkg.recurseForDerivations or false || pkg.recurseForRelease or false
+                # then packagesWith cond return pkg
+                then packagesWith cond return "${name}." pkg
+                else [ ]
+              );
+          in
+          if result.success then result.value
+          else [ ]
+        )
+        set
+      )
+    );
+
+  packages = packagesWith
+    (name: pkg:
+      (
+        if builtins.hasAttr "meta" pkg && builtins.hasAttr "maintainers" pkg.meta
+        then
+          (
+            if builtins.isList pkg.meta.maintainers
+            then builtins.elem maintainer_ pkg.meta.maintainers
+            else maintainer_ == pkg.meta.maintainers
+          )
+        else false
+      )
+    )
+    (name: name)
+    ("")
+    pkgs;
+
+in
+pkgs.stdenv.mkDerivation {
+  name = "nixpkgs-update-script";
+  buildCommand = ''
+    echo ""
+    echo "----------------------------------------------------------------"
+    echo ""
+    echo "nix-shell maintainers/scripts/check-hydra-by-maintainer.nix --argstr maintainer SuperSandro2000"
+    echo ""
+    echo "----------------------------------------------------------------"
+    exit 1
+  '';
+  shellHook = ''
+    unset shellHook # do not contaminate nested shells
+    echo "Please stand by"
+    echo nix-shell -p hydra-check --run "hydra-check ${builtins.concatStringsSep " " packages}"
+    nix-shell -p hydra-check --run "hydra-check ${builtins.concatStringsSep " " packages}"
+    exit $?
+  '';
+}