Fixup formatting

This commit is contained in:
Graham Christensen 2019-01-02 22:26:58 -05:00
parent 07a5a145a1
commit 5c04e88375
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -22,89 +22,86 @@ let
})
changedattrs;
validPackageAttributes = builtins.filter
(pkg:
if (pkgs.lib.attrsets.hasAttrByPath pkg.path pkgs) then
(if (builtins.tryEval (pkgs.lib.attrsets.attrByPath pkg.path null pkgs)).success
then true
else builtins.trace "Failed to access ${pkg.name} even though it exists" false)
else builtins.trace "Failed to locate ${pkg.name}." false
)
enrichedAttrs;
validPackageAttributes = builtins.filter
(pkg:
if (pkgs.lib.attrsets.hasAttrByPath pkg.path pkgs)
then (if (builtins.tryEval (pkgs.lib.attrsets.attrByPath pkg.path null pkgs)).success
then true
else builtins.trace "Failed to access ${pkg.name} even though it exists" false)
else builtins.trace "Failed to locate ${pkg.name}." false
)
enrichedAttrs;
attrsWithPackages = builtins.map
(pkg: pkg // { package = pkgs.lib.attrsets.attrByPath pkg.path null pkgs; })
validPackageAttributes;
attrsWithMaintainers = builtins.map
(pkg: pkg // { maintainers = (pkg.package.meta or {}).maintainers or []; })
attrsWithPackages;
attrsWithMaintainers = builtins.map
(pkg: pkg // { maintainers = (pkg.package.meta or {}).maintainers or []; })
attrsWithPackages;
attrsWeCanPing = builtins.filter
(pkg: if (builtins.length pkg.maintainers) > 0
then true
else builtins.trace "Package has no maintainers: ${pkg.name}" false
)
attrsWithMaintainers;
attrsWeCanPing = builtins.filter
(pkg: if (builtins.length pkg.maintainers) > 0
then true
else builtins.trace "Package has no maintainers: ${pkg.name}" false
)
attrsWithMaintainers;
relevantFilenames = drv:
(pkgs.lib.lists.unique
(builtins.map
(pos: pos.file)
(builtins.filter (x: x != null)
[
(builtins.unsafeGetAttrPos "maintainers" (drv.meta or {}))
(builtins.unsafeGetAttrPos "src" drv)
# broken because name is always set in stdenv:
# # A hack to make `nix-env -qa` and `nix search` ignore broken packages.
# # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix.
# name = assert validity.handled; name + lib.optionalString
#(builtins.unsafeGetAttrPos "name" drv)
(builtins.unsafeGetAttrPos "pname" drv)
(builtins.unsafeGetAttrPos "version" drv)
]
relevantFilenames = drv:
(pkgs.lib.lists.unique
(builtins.map
(pos: pos.file)
(builtins.filter (x: x != null)
[
(builtins.unsafeGetAttrPos "maintainers" (drv.meta or {}))
(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.
# # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix.
# name = assert validity.handled; name + lib.optionalString
#(builtins.unsafeGetAttrPos "name" drv)
(builtins.unsafeGetAttrPos "pname" drv)
(builtins.unsafeGetAttrPos "version" drv)
]
)));
attrsWithFilenames = builtins.map
(pkg: pkg // { filenames = relevantFilenames pkg.package; })
attrsWithMaintainers;
attrsWithFilenames = builtins.map
(pkg: pkg // { filenames = relevantFilenames pkg.package; })
attrsWithMaintainers;
attrsWithModifiedFiles = builtins.filter
(pkg: anyMatchingFiles pkg.filenames)
attrsWithFilenames;
attrsWithModifiedFiles = builtins.filter
(pkg: anyMatchingFiles pkg.filenames)
attrsWithFilenames;
listToPing = pkgs.lib.lists.flatten
(builtins.map
(pkg:
builtins.map
(maintainer: {
listToPing = pkgs.lib.lists.flatten
(builtins.map
(pkg:
builtins.map (maintainer: {
handle = maintainer.github;
packageName = pkg.name;
dueToFiles = pkg.filenames;
})
pkg.maintainers
)
attrsWithModifiedFiles);
pkg.maintainers
)
attrsWithModifiedFiles);
byMaintainer = pkgs.lib.lists.foldr
(ping: collector: collector // { "${ping.handle}" = [ { inherit (ping) packageName dueToFiles; } ] ++ (collector."${ping.handle}" or []); })
{}
listToPing;
byMaintainer = pkgs.lib.lists.foldr
(ping: collector: collector // { "${ping.handle}" = [ { inherit (ping) packageName dueToFiles; } ] ++ (collector."${ping.handle}" or []); })
{}
listToPing;
textForPackages = packages:
pkgs.lib.strings.concatStringsSep ", " (
builtins.map
(pkg: pkg.packageName)
textForPackages = packages:
pkgs.lib.strings.concatStringsSep ", " (
builtins.map (pkg: pkg.packageName)
packages);
textPerMaintainer = pkgs.lib.attrsets.mapAttrs
(maintainer: packages: "- @${maintainer} for ${textForPackages packages}")
byMaintainer;
textPerMaintainer = pkgs.lib.attrsets.mapAttrs
(maintainer: packages: "- @${maintainer} for ${textForPackages packages}")
byMaintainer;
packagesPerMaintainer = pkgs.lib.attrsets.mapAttrs
(maintainer: packages:
builtins.map
(pkg: pkg.packageName)
packages)
(maintainer: packages:
builtins.map (pkg: pkg.packageName)
packages)
byMaintainer;
in packagesPerMaintainer