-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Checked maintainers #82461
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
Merged
Merged
Checked maintainers #82461
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d3ac6de
maintainer-list: Fix attribute names
infinisil f9e94b9
maintainer-list: Fix missing githubId's
infinisil f9eb3d1
lib/strings: Introduce escapeNixIdentifier
infinisil 124cccb
lib/options: Use escapeNixIdentifier for showOption
infinisil 0bc7f34
lib/tests/modules.sh: Don't depend on $PWD
infinisil a90d8de
lib/tests/release.nix: Avoid importing nixpkgs into the store
infinisil f579564
lib/maintainer-list: Implement validity checks
infinisil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # to run these tests: | ||
| # nix-build nixpkgs/lib/tests/maintainers.nix | ||
| # If nothing is output, all tests passed | ||
| { pkgs ? import ../.. {} }: | ||
|
|
||
| let | ||
| inherit (pkgs) lib; | ||
| inherit (lib) types; | ||
|
|
||
| maintainerModule = { config, ... }: { | ||
| options = { | ||
| name = lib.mkOption { | ||
| type = types.str; | ||
| }; | ||
| email = lib.mkOption { | ||
| type = types.str; | ||
| }; | ||
| github = lib.mkOption { | ||
| type = types.nullOr types.str; | ||
| default = null; | ||
| }; | ||
| githubId = lib.mkOption { | ||
| type = types.nullOr types.ints.unsigned; | ||
| default = null; | ||
| }; | ||
| keys = lib.mkOption { | ||
| type = types.listOf (types.submodule { | ||
| options.longkeyid = lib.mkOption { type = types.str; }; | ||
| options.fingerprint = lib.mkOption { type = types.str; }; | ||
| }); | ||
| default = []; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| checkMaintainer = handle: uncheckedAttrs: | ||
| let | ||
| prefix = [ "lib" "maintainers" handle ]; | ||
| checkedAttrs = (lib.modules.evalModules { | ||
| inherit prefix; | ||
| modules = [ | ||
| maintainerModule | ||
| { | ||
| _file = toString ../../maintainers/maintainer-list.nix; | ||
| config = uncheckedAttrs; | ||
| } | ||
| ]; | ||
| }).config; | ||
|
|
||
| checkGithubId = lib.optional (checkedAttrs.github != null && checkedAttrs.githubId == null) '' | ||
| echo ${lib.escapeShellArg (lib.showOption prefix)}': If `github` is specified, `githubId` must be too.' | ||
| # Calling this too often would hit non-authenticated API limits, but this | ||
| # shouldn't happen since such errors will get fixed rather quickly | ||
| info=$(curl -sS https://api.github.com/users/${checkedAttrs.github}) | ||
| id=$(jq -r '.id' <<< "$info") | ||
| echo "The GitHub ID for GitHub user ${checkedAttrs.github} is $id:" | ||
| echo -e " githubId = $id;\n" | ||
| ''; | ||
| in lib.deepSeq checkedAttrs checkGithubId; | ||
|
|
||
| missingGithubIds = lib.concatLists (lib.mapAttrsToList checkMaintainer lib.maintainers); | ||
|
|
||
| success = pkgs.runCommandNoCC "checked-maintainers-success" {} ">$out"; | ||
|
|
||
| failure = pkgs.runCommandNoCC "checked-maintainers-failure" { | ||
| nativeBuildInputs = [ pkgs.curl pkgs.jq ]; | ||
| outputHash = "sha256:${lib.fakeSha256}"; | ||
| outputHAlgo = "sha256"; | ||
| outputHashMode = "flat"; | ||
| SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; | ||
| } '' | ||
| ${lib.concatStringsSep "\n" missingGithubIds} | ||
| exit 1 | ||
| ''; | ||
| in if missingGithubIds == [] then success else failure | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.