mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
Merge master into staging-next
This commit is contained in:
@@ -74,9 +74,38 @@ let
|
||||
{
|
||||
attrdiff: {
|
||||
added: ["package1"],
|
||||
changed: ["package2", "package3"],
|
||||
changed: ["package2", "package3", "package4"],
|
||||
removed: ["package4"],
|
||||
},
|
||||
attrdiffByKernel: {
|
||||
darwin: {
|
||||
added: [],
|
||||
changed: ["package2", "package4"],
|
||||
removed: ["package4"],
|
||||
},
|
||||
linux: {
|
||||
added: ["package1"],
|
||||
changed: ["package3", "package4"],
|
||||
removed: [],
|
||||
},
|
||||
},
|
||||
attrdiffByPlatform: {
|
||||
aarch64-darwin: {
|
||||
added: [],
|
||||
changed: ["package2"],
|
||||
removed: ["package4"],
|
||||
},
|
||||
aarch64-linux: {
|
||||
added: ["package1"],
|
||||
changed: ["package3"],
|
||||
removed: [],
|
||||
},
|
||||
x86_64-linux: {
|
||||
added: [],
|
||||
changed: ["package4"],
|
||||
removed: [],
|
||||
},
|
||||
},
|
||||
labels: {
|
||||
"10.rebuild-darwin: 1-10": true,
|
||||
"10.rebuild-linux: 1-10": true
|
||||
@@ -113,6 +142,8 @@ let
|
||||
inherit (import ./utils.nix { inherit lib; })
|
||||
groupByKernel
|
||||
convertToPackagePlatformAttrs
|
||||
groupAttrdiffByKernel
|
||||
groupAttrdiffByPlatform
|
||||
groupByPlatform
|
||||
extractPackageNames
|
||||
getLabels
|
||||
@@ -127,6 +158,15 @@ let
|
||||
|
||||
changed-paths =
|
||||
let
|
||||
attrdiff = lib.mapAttrs (_: extractPackageNames) {
|
||||
inherit (diffAttrs) added changed removed;
|
||||
};
|
||||
attrdiffByPlatform = groupAttrdiffByPlatform {
|
||||
inherit (diffAttrs) added changed removed;
|
||||
};
|
||||
attrdiffByKernel = groupAttrdiffByKernel {
|
||||
inherit (diffAttrs) added changed removed;
|
||||
};
|
||||
rebuildsByPlatform = groupByPlatform rebuildsPackagePlatformAttrs;
|
||||
rebuildsByKernel = groupByKernel rebuildsPackagePlatformAttrs;
|
||||
rebuildCountByKernel = lib.mapAttrs (
|
||||
@@ -135,7 +175,7 @@ let
|
||||
in
|
||||
writeText "changed-paths.json" (
|
||||
builtins.toJSON {
|
||||
attrdiff = lib.mapAttrs (_: extractPackageNames) { inherit (diffAttrs) added changed removed; };
|
||||
inherit attrdiff attrdiffByKernel attrdiffByPlatform;
|
||||
inherit
|
||||
rebuildsByPlatform
|
||||
rebuildsByKernel
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
}:
|
||||
let
|
||||
fun = import ./maintainers.nix { inherit lib; };
|
||||
utils = import ./utils.nix { inherit lib; };
|
||||
|
||||
mockPkgs =
|
||||
{
|
||||
@@ -226,6 +227,83 @@ let
|
||||
];
|
||||
};
|
||||
};
|
||||
testGroupAttrdiffByPlatform = {
|
||||
expr = utils.groupAttrdiffByPlatform {
|
||||
added = [
|
||||
"new-tool.aarch64-linux"
|
||||
"new-tool.x86_64-darwin"
|
||||
];
|
||||
changed = [
|
||||
"updated-tool.x86_64-darwin"
|
||||
"shared-tool.x86_64-darwin"
|
||||
];
|
||||
removed = [
|
||||
"removed-tool.aarch64-darwin"
|
||||
"shared-tool.aarch64-darwin"
|
||||
];
|
||||
};
|
||||
expected = {
|
||||
aarch64-darwin = {
|
||||
added = [ ];
|
||||
changed = [ ];
|
||||
removed = [
|
||||
"removed-tool"
|
||||
"shared-tool"
|
||||
];
|
||||
};
|
||||
aarch64-linux = {
|
||||
added = [ "new-tool" ];
|
||||
changed = [ ];
|
||||
removed = [ ];
|
||||
};
|
||||
x86_64-darwin = {
|
||||
added = [ "new-tool" ];
|
||||
changed = [
|
||||
"shared-tool"
|
||||
"updated-tool"
|
||||
];
|
||||
removed = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
testGroupAttrdiffByKernel = {
|
||||
expr =
|
||||
let
|
||||
grouped = utils.groupAttrdiffByKernel {
|
||||
added = [
|
||||
"new-tool.aarch64-linux"
|
||||
"new-tool.x86_64-darwin"
|
||||
];
|
||||
changed = [
|
||||
"updated-tool.x86_64-darwin"
|
||||
"shared-tool.x86_64-darwin"
|
||||
];
|
||||
removed = [
|
||||
"removed-tool.aarch64-darwin"
|
||||
"shared-tool.aarch64-darwin"
|
||||
];
|
||||
};
|
||||
in
|
||||
lib.mapAttrs (_: diff: lib.mapAttrs (_: lib.sort lib.lessThan) diff) grouped;
|
||||
expected = {
|
||||
darwin = {
|
||||
added = [ "new-tool" ];
|
||||
changed = [
|
||||
"shared-tool"
|
||||
"updated-tool"
|
||||
];
|
||||
removed = [
|
||||
"removed-tool"
|
||||
"shared-tool"
|
||||
];
|
||||
};
|
||||
linux = {
|
||||
added = [ "new-tool" ];
|
||||
changed = [ ];
|
||||
removed = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
@@ -150,6 +150,50 @@ rec {
|
||||
in
|
||||
lib.genAttrs [ "linux" "darwin" ] filterKernel;
|
||||
|
||||
/*
|
||||
Group an attrdiff-style mapping by a derived key such as platform or kernel.
|
||||
|
||||
Turns
|
||||
{
|
||||
added = [ "new-tool.aarch64-linux" "new-tool.x86_64-darwin" ];
|
||||
changed = [ "updated-tool.x86_64-darwin" "shared-tool.x86_64-darwin" ];
|
||||
removed = [ "removed-tool.aarch64-darwin" "shared-tool.aarch64-darwin" ];
|
||||
}
|
||||
into
|
||||
{
|
||||
aarch64-darwin = {
|
||||
added = [ ];
|
||||
changed = [ ];
|
||||
removed = [ "removed-tool" "shared-tool" ];
|
||||
};
|
||||
aarch64-linux = {
|
||||
added = [ "new-tool" ];
|
||||
changed = [ ];
|
||||
removed = [ ];
|
||||
};
|
||||
x86_64-darwin = {
|
||||
added = [ "new-tool" ];
|
||||
changed = [ "shared-tool" "updated-tool" ];
|
||||
removed = [ ];
|
||||
};
|
||||
}
|
||||
when used with `groupByPlatform`.
|
||||
*/
|
||||
groupAttrdiffBy =
|
||||
grouper: attrdiff:
|
||||
let
|
||||
groupedByKind = lib.mapAttrs (
|
||||
_: packagePlatformPaths:
|
||||
grouper (convertToPackagePlatformAttrs (uniqueStrings packagePlatformPaths))
|
||||
) attrdiff;
|
||||
groups = uniqueStrings (lib.flatten (map builtins.attrNames (lib.attrValues groupedByKind)));
|
||||
in
|
||||
lib.genAttrs groups (group: lib.mapAttrs (_: byGroup: byGroup.${group} or [ ]) groupedByKind);
|
||||
|
||||
groupAttrdiffByPlatform = groupAttrdiffBy groupByPlatform;
|
||||
|
||||
groupAttrdiffByKernel = groupAttrdiffBy groupByKernel;
|
||||
|
||||
/*
|
||||
Maps an attrs of `kernel - rebuild counts` mappings to an attrs of labels
|
||||
|
||||
|
||||
@@ -25,6 +25,16 @@ async function checkTargetBranch({ github, context, core, dry }) {
|
||||
* changed: string[],
|
||||
* removed: string[],
|
||||
* },
|
||||
* attrdiffByKernel: Record<string, {
|
||||
* added: string[],
|
||||
* changed: string[],
|
||||
* removed: string[],
|
||||
* }>,
|
||||
* attrdiffByPlatform: Record<string, {
|
||||
* added: string[],
|
||||
* changed: string[],
|
||||
* removed: string[],
|
||||
* }>,
|
||||
* labels: Record<string, boolean>,
|
||||
* rebuildCountByKernel: Record<string, number>,
|
||||
* rebuildsByKernel: Record<string, string[]>,
|
||||
|
||||
Reference in New Issue
Block a user