fix: php: pass composer-plugin-api to composer-plugins

This commit is contained in:
Martin Toman 2022-09-21 14:40:45 -07:00
parent 12791f09ef
commit f1888d4763
2 changed files with 22 additions and 2 deletions

View File

@ -89,6 +89,7 @@
# Generates a derivation for a specific package name + version
makeOnePackage = name: version: let
packageType = subsystemAttrs.phpPackageType."${name}@${version}";
dependencies = getDependencies name version;
repositories = let
transform = dep: let
@ -127,7 +128,12 @@
inherit (dep) name;
value = dep.version;
})
dependencies
(dependencies
++ l.optional (subsystemAttrs.composerPluginApiSemver ? "${name}@${version}")
{
name = "composer-plugin-api";
version = subsystemAttrs.composerPluginApiSemver."${name}@${version}";
})
));
versionString =

View File

@ -117,6 +117,19 @@ in {
in
map (l.removePrefix "ext-") extensions;
composerPluginApiSemver = l.listToAttrs (l.flatten (map
(
pkg: let
requires = getRequire pkg;
in
l.optional (requires ? "composer-plugin-api")
{
name = "${pkg.name}@${pkg.version}";
value = requires."composer-plugin-api";
}
)
packages));
# get cleaned pkg attributes
getRequire = pkg:
l.mapAttrs
@ -204,7 +217,7 @@ in {
clean = requires:
l.filterAttrs
(name: _:
!(l.elem name ["php" "composer/composer" "composer-runtime-api"])
!(l.elem name ["php" "composer-plugin-api" "composer-runtime-api"])
&& !(l.strings.hasPrefix "ext-" name))
requires;
doPin = name: semver:
@ -236,6 +249,7 @@ in {
# ./src/specifications/{subsystem}
subsystemAttrs = {
inherit phpSemver phpExtensions;
inherit composerPluginApiSemver;
};
# name of the default package