Description
I think this follows on from #150 - my test extension asgrim/example-pie-extension
uses replace
, and this is causing issues.
Steps to reproduce:
- Install the example ext (
bin/pie install -v asgrim/example-pie-extension
) - Then try to install a different, unrelated extension, e.g. (
bin/pie install -v xdebug/xdebug
)
Expected results:
xdebug
should be installed
Actual results:
You are running PHP 8.3.14
Target PHP installation: 8.3.14 ts, on Linux/OSX/etc x86_64 (from /home/james/workspace/oss/php-src-build/bin/php)
Found package: xdebug/xdebug:3.4.0 which provides ext-xdebug
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- ext-example_pie_extension is present at version 0.1.0 and cannot be modified by Composer
- asgrim/example-pie-extension is locked to version 2.0.2 and an update of this package was not requested.
- Only one of these can be installed: asgrim/example-pie-extension[2.0.2], ext-example_pie_extension[0.1.0]. asgrim/example-pie-extension replaces ext-example_pie_extension and thus cannot coexist with it.
Observations:
- The dependency was correctly resolved in
\Php\Pie\DependencyResolver\ResolveDependencyWithComposer
; so the issue comes from the Composer Installer\Php\Pie\ComposerIntegration\ComposerIntegrationHandler
- The installed/reported extension version is
0.1.0
(I never updated thePHP_EXAMPLE_PIE_EXTENSION_VERSION
constant to be the actual version) but I don't think this is related; even if they were the same version I think it is just the fact that asgrim/example-pie-extensionreplaces
ext-example-pie-extension, but both are present, so Composer has a little meltdown from it - The fix I had done in When ext that uses
replace
is already enabled, Composer will report conflict #150 was to exclude the ext being installed from the reported list of extensions for the\Php\Pie\ComposerIntegration\PhpBinaryPathBasedPlatformRepository
, but I don't think this is the right approach. I think perhaps something like: work out if a Composer package (asgrim/example-pie-extension) does areplaces
for an extension (example_pie_extension) and exclude all of those when building the platform inPhpBinaryPathBasedPlatformRepository
- I think this behaviour is strictly related to using
replaces
incomposer.json
, which checking into the Packagist extensions list shows that there are only two extensions using this at the moment (asgrim/example-pie-extension, solidworx/aspect), so it is not (yet) a widespread problem at the moment.