-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
check-meta: wrap maintainers attribute to include team members #402991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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,11 +593,24 @@ 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 [ ]; | ||||||||||||||
|
Comment on lines
+610
to
+612
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add this? Unsure if it's common enough to be worth the complexity, though... probably not.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw it come up in a couple of the places I tried. Another idea is a listToAttrs, but that'll probably be slightly heavier on memory since we'll just throw out the attrset anyway. May be worth a shot, though, since it's not N^2 at least?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, we could always just punt it back onto the consumer -- we already had this potential duplication pre-
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that this change introduced duplication in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that Nix has tracing support, it'll be interesting to use it to test dedup while computing meta. It's what I was mostly missing here. |
||||||||||||||
| } | ||||||||||||||
| // { | ||||||||||||||
| # Expose the result of the checks for everyone to see. | ||||||||||||||
| unfree = hasUnfreeLicense attrs; | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not
? Ideally we wouldn't add (slight!) extra eval overhead just for CI scripts (which AFAIU check-meta will do).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new maintainers attribute was actually clobbering the original one's position, so it would return check-meta.nix every time rather than the real declaring file. I needed a way to pull the location of the original maintainers (pre-teams concatenation) out of there, and just did the same with teams. If it's written this way, it'll return a position pointing to check-meta.nix.
check-meta.nix is a little counterintuitive, but it's a bunch of // attrset updates that both prefers certain things in the meta and overrides other things in it. Maintainers is written as one of the overrides so I made sure we're holding onto the original.