simpleTranslate2: ignore irrelevant dependency objects

This commit is contained in:
DavHau 2022-05-31 11:39:54 +02:00
parent e37041d443
commit d6d94d88db

View File

@ -92,7 +92,15 @@
;
};
allDependencies =
/*
format:
{
foo = {
"1.0.0" = finalObj
}
}
*/
makeDependencies = finalObjects:
l.foldl'
(result: finalObj:
lib.recursiveUpdate
@ -105,6 +113,31 @@
{}
finalObjects;
allDependencies = makeDependencies finalObjects;
exportedFinalObjects =
l.filter
(finalObj:
exportedPackages.${finalObj.name} or null == finalObj.version)
finalObjects;
relevantFinalObjects = l.genericClosure {
startSet =
l.map
(finalObj:
finalObj
// {key = "${finalObj.name}#${finalObj.version}";})
exportedFinalObjects;
operator = finalObj:
l.map
(c:
allDependencies.${c.name}.${c.version}
// {key = "${c.name}#${c.version}";})
finalObj.dependencies;
};
relevantDependencies = makeDependencies relevantFinalObjects;
sources =
l.mapAttrs
(name: versions: let
@ -120,7 +153,7 @@
l.mapAttrs
(version: finalObj: finalObj.sourceSpec)
filteredObjects)
allDependencies;
relevantDependencies;
dependencyGraph =
lib.mapAttrs
@ -128,7 +161,7 @@
lib.mapAttrs
(version: finalObj: finalObj.dependencies)
versions)
allDependencies;
relevantDependencies;
cyclicDependencies =
# TODO: inefficient! Implement some kind of early cutoff