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

View File

@ -117,6 +117,19 @@ in {
in in
map (l.removePrefix "ext-") extensions; 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 # get cleaned pkg attributes
getRequire = pkg: getRequire = pkg:
l.mapAttrs l.mapAttrs
@ -204,7 +217,7 @@ in {
clean = requires: clean = requires:
l.filterAttrs l.filterAttrs
(name: _: (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)) && !(l.strings.hasPrefix "ext-" name))
requires; requires;
doPin = name: semver: doPin = name: semver:
@ -236,6 +249,7 @@ in {
# ./src/specifications/{subsystem} # ./src/specifications/{subsystem}
subsystemAttrs = { subsystemAttrs = {
inherit phpSemver phpExtensions; inherit phpSemver phpExtensions;
inherit composerPluginApiSemver;
}; };
# name of the default package # name of the default package