Unverified Commit 011f7759 authored by Wolfgang Walther's avatar Wolfgang Walther Committed by GitHub
Browse files

ci/eval/compare: ping maintainers of removed packages (#438652)

parents 14798bbe 4126ef7e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ let
  # - values: lists of `packagePlatformPath`s
  diffAttrs = builtins.fromJSON (builtins.readFile "${combinedDir}/combined-diff.json");

  changedPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.changed;
  rebuildsPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.rebuilds;
  removedPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.removed;

  changed-paths =
    let
@@ -115,8 +117,9 @@ let
    );

  maintainers = callPackage ./maintainers.nix { } {
    changedattrs = lib.attrNames (lib.groupBy (a: a.name) rebuildsPackagePlatformAttrs);
    changedattrs = lib.attrNames (lib.groupBy (a: a.name) changedPackagePlatformAttrs);
    changedpathsjson = touchedFilesJson;
    removedattrs = lib.attrNames (lib.groupBy (a: a.name) removedPackagePlatformAttrs);
    inherit byName;
  };
in
+7 −31
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
{
  changedattrs,
  changedpathsjson,
  removedattrs,
  byName ? false,
}:
let
@@ -21,43 +22,18 @@ let

  anyMatchingFiles = files: builtins.any anyMatchingFile files;

  enrichedAttrs = builtins.map (name: {
    path = lib.splitString "." name;
    name = name;
  }) changedattrs;

  validPackageAttributes = builtins.filter (
    pkg:
    if (lib.attrsets.hasAttrByPath pkg.path pkgs) then
      (
        let
          value = lib.attrsets.attrByPath pkg.path null pkgs;
        in
        if (builtins.tryEval value).success then
          if value != null then true else builtins.trace "${pkg.name} exists but is null" false
        else
          builtins.trace "Failed to access ${pkg.name} even though it exists" false
      )
    else
      builtins.trace "Failed to locate ${pkg.name}." false
  ) enrichedAttrs;

  attrsWithPackages = builtins.map (
    pkg: pkg // { package = lib.attrsets.attrByPath pkg.path null pkgs; }
  ) validPackageAttributes;

  attrsWithMaintainers = builtins.map (
    pkg:
    name:
    let
      meta = pkg.package.meta or { };
      package = lib.getAttrFromPath (lib.splitString "." name) pkgs;
    in
    pkg
    // {
    {
      inherit name package;
      # TODO: Refactor this so we can ping entire teams instead of the individual members.
      # Note that this will require keeping track of GH team IDs in "maintainers/teams.nix".
      maintainers = meta.maintainers or [ ];
      maintainers = package.meta.maintainers or [ ];
    }
  ) attrsWithPackages;
  ) (changedattrs ++ removedattrs);

  relevantFilenames =
    drv: