netz98 / n98-magerun2

The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.
https://magerun.net
Other
872 stars 225 forks source link

not possible to require as a composer dependency on 2.4.7 #1454

Closed convenient closed 6 months ago

convenient commented 6 months ago

Describe the bug

It is not possible to require magerun as a dev dependency on 2.4.7

Expected behaviour

On an instance of 2.4.7 this command works

composer require n98/magerun2:"*" --dev --no-interaction

Steps to reproduce the issue

Here's a bash script

#!/bin/bash
set -ev
mkdir testinstall
cd testinstall
composer create-project --repository="https://repo-magento-mirror.fooman.co.nz/" magento/project-community-edition . --no-install --no-plugins
composer config --unset repo.0
composer config repo.composerrepository composer "https://repo-magento-mirror.fooman.co.nz/"
composer require n98/magerun2:"*" --dev --no-interaction --no-update
composer install --no-scripts --no-plugins

Here's the output

$ bash create.sh
mkdir testinstall
cd testinstall
composer create-project --repository="https://repo-magento-mirror.fooman.co.nz/" magento/project-community-edition . --no-install --no-plugins
Creating a "magento/project-community-edition" project at "./"
Installing magento/project-community-edition (2.4.7)
Plugins have been disabled.
  - Downloading magento/project-community-edition (2.4.7)
  - Installing magento/project-community-edition (2.4.7): Extracting archive
Created project in /Users/lukerodgers/src/2-4-7-test/testinstall/.
composer config --unset repo.0
composer config repo.composerrepository composer "https://repo-magento-mirror.fooman.co.nz/"
composer require n98/magerun2:"*" --dev --no-interaction --no-update
./composer.json has been updated
composer install --no-scripts --no-plugins
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - n98/magerun2[1.0.0, ..., 1.1.17] require symfony/finder ~2.3 -> found symfony/finder[v2.3.0, ..., v2.8.52] but it conflicts with your root composer.json require (^6.4).
    - n98/magerun2[1.2.0, ..., 1.6.0, 2.0.0, ..., 2.3.3] require symfony/finder ~2.3||~3.0 -> found symfony/finder[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but it conflicts with your root composer.json require (^6.4).
    - n98/magerun2[3.0.0, ..., 3.2.0, 4.0.0, ..., 4.1.0] require php ^7.0.0 -> your php version (8.1.28) does not satisfy that requirement.
    - n98/magerun2[4.2.0, ..., 4.7.0] require php ^7.1 -> your php version (8.1.28) does not satisfy that requirement.
    - n98/magerun2[4.8.0, ..., 4.9.1, 5.0.0, ..., 5.2.0, 6.0.0, ..., 6.1.1] require symfony/finder ~5.3 -> found symfony/finder[v5.3.0, ..., v5.4.35] but it conflicts with your root composer.json require (^6.4).
    - n98/magerun2[7.0.0, ..., 7.4.0] require symfony/finder ^5.4 -> found symfony/finder[v5.4.0, ..., v5.4.35] but it conflicts with your root composer.json require (^6.4).
    - Root composer.json requires n98/magerun2 * -> satisfiable by n98/magerun2[1.0.0, ..., 1.6.0, 2.0.0, ..., 2.3.3, 3.0.0, ..., 3.2.0, 4.0.0, ..., 4.9.1, 5.0.0, ..., 5.2.0, 6.0.0, 6.0.1, 6.1.0, 6.1.1, 7.0.0, ..., 7.4.0].

This is because 2.4.7 requires symfony/finder like so

https://github.com/magento/magento2/blob/fcebd3a4ad2a6863af2e2092f5e548cbd81cb0f8/composer.json#L133

But magerun does like so

https://github.com/netz98/n98-magerun2/blob/94ac79064b1ee4aabef57ceeb3726285d0bb3850/composer.json#L45

cmuench commented 6 months ago

@convenient We cannot support this anymore because of the wide range of dependencies of different Magento versions. That's why the n98/magerun2-dist package was introduced which delivers the phar file without any package dependencies.

See also this blog post: https://magerun.net/released-n98-magerun2-v3-1-0-with-brand-new-webapi-commands/

convenient commented 6 months ago

@cmuench Ahh amazing thanks. I hadn't spotted it as this was the first time I'd seen composer require n98/magerun2:"*" fail since 2.3.7ish :) Now I know, thanks.