Eliminate a step in the string construction

This commit is contained in:
Tim Van Baak 2024-07-08 12:15:24 -07:00
parent 1315e8fab8
commit 0670b65fff
1 changed files with 3 additions and 4 deletions

View File

@ -30,6 +30,7 @@
hasAttr "meta" drv &&
hasAttr "maintainers" drv.meta &&
(length drv.meta.maintainers) == 0;
stringJoin = objToString: objs: writeText "txt" (concatLines (map objToString objs));
maintainerToString = m: "${m.name} (${m.email})";
drvToString = drv: "${drv.name}";
};
@ -38,8 +39,7 @@
maintainers = drv: let
drvs = buildtimeDerivations drv;
maintainers = concatMap drvMaintainers drvs;
maintainerNames = map maintainerToString maintainers;
maintainerNamesList = writeText "maintainers" (concatLines maintainerNames);
maintainerNamesList = stringJoin (m: "${m.name} (${m.email})") maintainers;
uniqNames = runCommandLocal "uniq-maintainers.txt" {} ''
<${maintainerNamesList} sort | uniq -c > $out
'';
@ -47,8 +47,7 @@
adopt = drv: let
drvs = buildtimeDerivations drv;
drvsNoMain = filter nobodyMaintains drvs;
drvNames = map drvToString drvsNoMain;
drvNamesList = writeText "no-maintainers" (concatLines drvNames);
drvNamesList = stringJoin (drv: "${drv.name} ${drv.meta.position}") drvsNoMain;
uniqNames = runCommandLocal "no-maintainers.txt" {} ''
<${drvNamesList} sort -u > $out
'';