Unverified Commit 88f02766 authored by Tristan Ross's avatar Tristan Ross Committed by GitHub
Browse files

check-meta: add a teams attribute (#394797)

parents be653cb6 0173b120
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
  beforeResultDir,
  afterResultDir,
  touchedFilesJson,
  byName ? false,
}:
let
  /*
@@ -119,6 +120,7 @@ let
  maintainers = import ./maintainers.nix {
    changedattrs = lib.attrNames (lib.groupBy (a: a.name) rebuildsPackagePlatformAttrs);
    changedpathsjson = touchedFilesJson;
    inherit byName;
  };
in
runCommand "compare"
+19 −3
Original line number Diff line number Diff line
# Almost directly vendored from https://github.com/NixOS/ofborg/blob/5a4e743f192fb151915fcbe8789922fa401ecf48/ofborg/src/maintainers.nix
{ changedattrs, changedpathsjson }:
{
  changedattrs,
  changedpathsjson,
  byName ? false,
}:
let
  pkgs = import ../../.. {
    system = "x86_64-linux";
@@ -41,7 +45,18 @@ let
  ) validPackageAttributes;

  attrsWithMaintainers = builtins.map (
    pkg: pkg // { maintainers = (pkg.package.meta or { }).maintainers or [ ]; }
    pkg:
    let
      meta = pkg.package.meta or { };
    in
    pkg
    // {
      # 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 [ ]
        ++ lib.flatten (map (team: team.members or [ ]) (meta.teams or [ ]));
    }
  ) attrsWithPackages;

  relevantFilenames =
@@ -83,12 +98,13 @@ let
    pkg:
    builtins.map (maintainer: {
      id = maintainer.githubId;
      inherit (maintainer) github;
      packageName = pkg.name;
      dueToFiles = pkg.filenames;
    }) pkg.maintainers
  ) attrsWithModifiedFiles;

  byMaintainer = lib.groupBy (ping: toString ping.id) listToPing;
  byMaintainer = lib.groupBy (ping: toString ping.${if byName then "github" else "id"}) listToPing;

  packagesPerMaintainer = lib.attrsets.mapAttrs (
    maintainer: packages: builtins.map (pkg: pkg.packageName) packages
+3 −0
Original line number Diff line number Diff line
@@ -431,6 +431,9 @@
  "typst-package-scope-and-usage": [
    "index.html#typst-package-scope-and-usage"
  ],
  "var-meta-teams": [
    "index.html#var-meta-teams"
  ],
  "variables-specifying-dependencies": [
    "index.html#variables-specifying-dependencies"
  ],
+4 −0
Original line number Diff line number Diff line
@@ -91,6 +91,10 @@ For details, see [Source provenance](#sec-meta-sourceProvenance).

A list of the maintainers of this Nix expression. Maintainers are defined in [`nixpkgs/maintainers/maintainer-list.nix`](https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix). There is no restriction to becoming a maintainer, just add yourself to that list in a separate commit titled “maintainers: add alice” in the same pull request, and reference maintainers with `maintainers = with lib.maintainers; [ alice bob ]`.

### `teams` {#var-meta-teams}

A list of the teams of this Nix expression. Teams are defined in [`nixpkgs/maintainers/team-list.nix`](https://github.com/NixOS/nixpkgs/blob/master/maintainers/team-list.nix), and can be defined in a package with `meta.teams = with lib.teams; [ team1 team2 ]`.

### `mainProgram` {#var-meta-mainProgram}

The name of the main binary for the package. This affects the binary `nix run` executes. Example: `"rg"`
+11 −0
Original line number Diff line number Diff line
@@ -57,6 +57,17 @@ The maintainer is designated by a `selector` which must be one of:

[`maintainer-list.nix`]: ../maintainer-list.nix

### `get-maintainer-pings-between.sh`

Gets which maintainers would be pinged between two Nixpkgs revisions.
Outputs a JSON object on stdout mapping GitHub usernames to the attributes
that they would be getting pinged for.

Example:

```sh
maintainers/scripts/get-maintainer-pings-between.sh HEAD^ HEAD
```

## Conventions

Loading