-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incomplete folders restored when using Composer 2 #39
Comments
quick "me too" on this one... Still a problem on 2.1.3 |
From what I can tell... composer is running the pre-package-install hook prior to most things being installed. All the pre-package install (and install) all happen first (and serially). Then all the Post package install hooks are run together serially. In my case since the paths were preserved as they were near the beginning of the install the packages that were installed after drupal/drupal was do not exist in the preserved cache folder. Then when the post package-install hooks happen later, all the installed packages are wiped out by the folder that in preserve. This is different from Composer 1 because the each package goes through the process of pre-install to post-install per package. Therefore you get the state of the paths as they were directly before the installation and then put back immediately after before the next item is installed. I really don't know how to solve this problem with that being the case. |
as you can see I've added composer/composer#9983. I really don't know what to do until then. |
So in the following comment: composer/composer#9983 (comment) There is no intention of supporting non-concurrency and the way that the events fire seems intentional. I'm working on work arounds currently... but I think the continued viability of this plugin may need to be looked at. Since Drupal 7 is coming close to EOL and the amount of composer installs are likely even a smaller portion of the D7 sites that are still around... We may consider duct taping a solution. That is to say if not other projects use this plugin for their frameworks that we don't know about. I've got something in the works and will post what I did to get around this for others |
So here's what I ended up doing... Note that YMMV and you will need to configure a few things in the script. I didn't go through the effort of seeing if I could get the composer extra configuration through even being passed in to each of the scripts... but here's what I did. This assumes that I'm moving everything that used to be in web/sites/all to temp/sites/all in my composer file. EDIT: Removed this code sample and will post the new one in a new comment cause this turned out to not work well in autoloading. |
I wanted to come back and post my final solution as my previous comment didn't work well for autoloading of libraries. There was a typo in my search replace. However, I did something that simplified things a bit. First... Change only drupal core in your installer paths
Add The following to
Then add
to both your Hope this helps. |
I guess this is also happening with DrupalCI on drupal.org? I noticed that tests are failing for one of my D7 contrib modules on PHP 7.3 thru PHP 8.1 (which use Composer 2) while passing on PHP 7.2 (which uses Composer 1). It appears that dependencies aren't available - presumably empty module directory - and tests fail during the |
@mfb thanks for hunting this down. |
Well, the problem I've seen with DrupalCI and D7 contrib modules might be unrelated to this issue - I posted a potential fix at https://www.drupal.org/project/drupalci_testbot/issues/3294386 |
@mfb right... the error you posted was related to a totally different deadline due to a security fix starting with composer 2.2.0. You can see related issues like https://www.drupal.org/project/drupal/issues/3255749 and the original documentation at https://getcomposer.org/doc/06-config.md#allow-plugins and a blog post announcing the feature at https://blog.packagist.com/composer-2-2/ |
yes I'm very familiar from local development, just took me a while to track the drupalci issue down to it :) |
@generalredneck & others, there's the new kid on the block that solves the problem via symlinks: https://github.com/druidfi/mona-plugin |
When I am installing Drupal 7 alongside a number of modules from a freshly cloned repo it appears that the modules folder seems to get backed up in a partially completed state, and then later on restored. This overwrites part of the modules. The modules folder ends up with a bunch of empty folders and missing modules.
The console output indicates that some folders are being overwritten:
This happens only with Composer 2, so possibly this is caused by the parallel installation of the packages. Possibly some modules get installed before Drupal core itself is installed? I tried setting the
COMPOSER_MAX_PARALLEL_HTTP=1
environment variable but this doesn't help. It only throttles the downloading of the packages, not the installation.I am not using composer-patches. It happens with the latest version of Composer (2.0.12).
Here are the relevant parts of the
composer.json
file that is causing the problem:The text was updated successfully, but these errors were encountered: