Problem/Motivation
When you require a dev release of something, e.g. with composer require drupal/modulename:1.0.x-dev then the unpack plugin fails with an error message "drupal/modulename does not resolve to a package." and quits.
When requiring with a proper constraint, e.g. composer require drupal/modulename:^1.0, then there is no error, even if only the dev release is available and gets downloaded.
Steps to reproduce
composer create-project drupal/recommended-project:^11 recipe-test
composer require drupal/eca drupal/bpmn_io
composer require drupal/eca:3.0.x-dev drupal/bpmn_io:3.0.x-dev drupal/modeler_api:1.0.x-dev
Proposed resolution
drupal/eca:3.0.x-dev causes $package to be an \Composer\Package\AliasPackage not what the code expects \Composer\Package\Package. We need to use \Composer\Package\PackageInterface instead.
Remaining tasks
User interface changes
None
Introduced terminology
N/a
API changes
None
Data model changes
None
Release notes snippet
N/a
Issue fork drupal-3532796
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3532796-composer-unpack-plugin
changes, plain diff MR !12531
Comments
Comment #2
alexpottCan you add your actual steps to reproduce this issue. I cannot reproduce this. Here's the output of
composer --versionfor me...Here's what I'm doing:
The events recipe is successfully unpacked and the modules are installed. No messages from the recipe plugin.
I've also updated to composer 2.7.7 and it does not happen for that version either.
Comment #4
alexpottSteps to reproduce from @rkoller
On the second require you will see
drupal/eca does not resolve to a package.in the output.Comment #5
alexpottComment #7
alexpottI've tried to write a test for this but it is hard - I can;t get composer to use an alias for our path repositories used in testing.
I've now got even less steps to cause the problem
But doing
$this->runComposer('require "fixtures/module-b:2.0.1 as 3.0.0"')in a \Drupal\Tests\Composer\Plugin\Unpack\Functional\UnpackRecipeTest does not cause the problem :(Comment #8
jurgenhaasI've tested this successfully. With the commands from #7 I wasn't able to reproduce the issue, but the following showed the error:
Then I tried again and patched with this MR first. Then the error was gone.
Comment #11
catchCommitted/pushed to 11.x and cherry-picked to 11.2.x, thanks!