fix: php: drop missing requirements

Since we are reading composer.lock, assume that missing requirements
are satisfied in upper packages by provides/replaces
This commit is contained in:
Martin Toman 2022-09-05 10:36:46 -07:00
parent e27c43f780
commit 3bd99ac47d

View File

@ -189,9 +189,20 @@ in {
};
doReplace = pkg: l.foldl replace pkg packages;
doProvide = pkg: l.foldl provide pkg packages;
resolve = pkg: doProvide (doReplace pkg);
dropMissing = pkgs: let
doDropMissing = pkg:
pkg
// {
require =
l.filterAttrs
(name: semver: l.any (pkg: (pkg.name == name) && (satisfiesSemver pkg.version semver)) pkgs)
(getDependencies pkg);
};
in
map doDropMissing pkgs;
resolve = pkg: (doProvide (doReplace pkg));
in
map resolve packages;
dropMissing (map resolve packages);
# toplevel php semver
phpSemver = composerJson.require."php" or "*";