From d807892d1f42210129f9fc18f81e5f828150cf4d Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Thu, 1 May 2025 15:25:48 -0300 Subject: [PATCH 1/2] check-meta: wrap maintainers attribute to include team members This is a work-around that resolves the issues that spawned from #400458 by adding the team members from teams declared in `meta.teams` to `meta.maintainers`, effectively restoring the original behaviour of the `maintainers` attribute, and thus allowing downstreams to keep consuming `meta.maintainers` without any extra changes to support `meta.teams`. Follow-up to #394797. Signed-off-by: Fernando Rodrigues --- pkgs/stdenv/generic/check-meta.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index f5e4dc5fe3c7..550aa2c02ffc 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -594,6 +594,11 @@ let // optionalAttrs (pos != null) { position = pos.file + ":" + toString pos.line; } + // { + maintainers = + attrs.meta.maintainers or [ ] + ++ concatMap (team: team.members or [ ]) attrs.meta.teams or [ ]; + } // { # Expose the result of the checks for everyone to see. unfree = hasUnfreeLicense attrs; From 92bd743239823dc7c80572539528398f722a9278 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Mon, 5 May 2025 23:32:00 -0700 Subject: [PATCH 2/2] ci/eval: use correct maintainer and team positions We need to pass through the maintainers and teams positions from the original meta so pings work correctly, since check-meta clobbers the original attribute positions in them. Tested with `maintainers/scripts/get-maintainer-pings-between.sh` on a handful of major packages maintained by both individuals and teams. --- ci/eval/compare/maintainers.nix | 7 +++---- pkgs/stdenv/generic/check-meta.nix | 12 ++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index 8fb43be4d8e7..9b641d6ec60f 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -53,9 +53,7 @@ let // { # 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 [ ])); + maintainers = meta.maintainers or [ ]; } ) attrsWithPackages; @@ -64,7 +62,8 @@ let (lib.lists.unique ( builtins.map (pos: lib.strings.removePrefix (toString ../..) pos.file) ( builtins.filter (x: x != null) [ - (builtins.unsafeGetAttrPos "maintainers" (drv.meta or { })) + ((drv.meta or { }).maintainersPosition or null) + ((drv.meta or { }).teamsPosition or null) (builtins.unsafeGetAttrPos "src" drv) # broken because name is always set by stdenv: # # A hack to make `nix-env -qa` and `nix search` ignore broken packages. diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 550aa2c02ffc..57cbc175d201 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -411,6 +411,10 @@ let isFcitxEngine = bool; isIbusEngine = bool; isGutenprint = bool; + + # Used for the original location of the maintainer and team attributes to assist with pings. + maintainersPosition = any; + teamsPosition = any; }; checkMetaAttr = @@ -589,12 +593,20 @@ let ) ] ++ optional (hasOutput "man") "man"; } + // { + # CI scripts look at these to determine pings. + maintainersPosition = builtins.unsafeGetAttrPos "maintainers" (attrs.meta or { }); + teamsPosition = builtins.unsafeGetAttrPos "teams" (attrs.meta or { }); + } // attrs.meta or { } # Fill `meta.position` to identify the source location of the package. // optionalAttrs (pos != null) { position = pos.file + ":" + toString pos.line; } // { + # Maintainers should be inclusive of teams. + # Note that there may be external consumers of this API (repology, for instance) - + # if you add a new maintainer or team attribute please ensure that this expectation is still met. maintainers = attrs.meta.maintainers or [ ] ++ concatMap (team: team.members or [ ]) attrs.meta.teams or [ ];