Skip to content
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

Composer setup failed #124

Open
gpatry opened this issue Jan 16, 2023 · 6 comments
Open

Composer setup failed #124

gpatry opened this issue Jan 16, 2023 · 6 comments

Comments

@gpatry
Copy link

gpatry commented Jan 16, 2023

Hi,

First thanks for your lot of work since many years for giving us a php library for interacting with sonos systems.

I setup a fresh symfony 6.2 webapp and then try to install your sonos library.
When simply running composer require duncan3dc/sonos, I got v0.8.8 installed ...

./composer.json has been updated
Running composer update duncan3dc/sonos
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 0 updates, 0 removals
- Locking duncan3dc/domparser (2.1.0)
- Locking duncan3dc/helpers (1.7.0)
- Locking duncan3dc/serial (0.4.0)
- Locking duncan3dc/sonos (0.8.8)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing duncan3dc/serial (0.4.0): Extracting archive
- Installing duncan3dc/helpers (1.7.0): Extracting archive
- Installing duncan3dc/domparser (2.1.0): Extracting archive
- Installing duncan3dc/sonos (0.8.8): Extracting archive
Generating autoload files
109 packages you are using are looking for funding.
Use the composer fund command to find out more!

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [OK]
Executing script assets:install public [OK]
Executing script requirements-checker [OK]

No security vulnerability advisories found
Using version ^0.8.8 for duncan3dc/sonos

Now if I want to force latest version (eg 2.2.2 according to your latest tags) by setting it in composer.json, I've got this errors ...
composer file update :
"duncan3dc/sonos": "^2.0", or with "duncan3dc/sonos": "^2.2.2",

running composer update :
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Restricting packages listed in "symfony/symfony" to "6.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- duncan3dc/sonos[2.2.0, ..., 2.2.2] require duncan3dc/speaker ^1.0 -> satisfiable by duncan3dc/speaker[1.0.0, ..., 1.4.0].
- duncan3dc/speaker 1.4.0 requires duncan3dc/exec ^0.4 || ^1.0 -> satisfiable by duncan3dc/exec[0.4.0, 1.0.0].
- duncan3dc/sonos[2.0.0, ..., 2.1.1] require php ^7.1 -> your php version (8.1.14) does not satisfy that requirement.
- duncan3dc/exec[0.4.0, 1.0.0] require symfony/console ^4.2 || ^5.0 -> found symfony/console[v4.2.0, ..., v4.4.49, v5.0.0, ..., v5.4.17] but it conflicts with your root composer.json require (6.2.*).
- duncan3dc/speaker[1.0.0, ..., 1.1.0] require symfony/process ^2.3 -> found symfony/process[v2.3.0, ..., v2.8.52] but it conflicts with your root composer.json require (6.2.*).
- duncan3dc/speaker 1.2.0 requires symfony/process ^2.8|^3.0 -> found symfony/process[v2.8.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but it conflicts with your root composer.json require (6.2.*).
- duncan3dc/speaker[1.3.0, ..., 1.3.1] require php ^7.2 -> your php version (8.1.14) does not satisfy that requirement.
- Root composer.json requires duncan3dc/sonos ^2.0 -> satisfiable by duncan3dc/sonos[2.0.0, ..., 2.2.2].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

If I run composer with -W option, some symfony packages are downgraded and I don't want it.

here is the command I ran to setup my project :
symfony new SonosManager --version="6.2.*" --webapp
cd SonosManager
composer require logger
composer require annotations
composer remove sensio/framework-extra-bundle
composer require symfony/profiler-pack
composer require symfony/debug-pack
composer require twig
composer require symfony/requirements-checker
composer require symfony/apache-pack

Can you help me ?

@duncan3dc
Copy link
Owner

Hi @gpatry, this library doesn't directly depend on Symfony components, but I guess some dependencies do, let me take a look and see what I can do to allow compatibility with Symfony 6

@duncan3dc
Copy link
Owner

Can you try again Guillaume? I think it should work now 🤞

@gpatry
Copy link
Author

gpatry commented Jan 17, 2023

Hi @duncan3dc ,

I test again, if I run composer require duncan3cd/sonos the result is the same as before : install version 0.8.8 of the library

If I mention explicitly duncan3dc/sonos:^2.2.2 in my composer.json, install failed again with a requirement on psr/log 1.1 instead of psr/log 3.0 added by symfony 6.2

Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "6.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
` Problem 1` ` - Root composer.json requires duncan3dc/sonos ^2.2.2 -> satisfiable by duncan3dc/sonos[2.2.2].` ` - duncan3dc/sonos 2.2.2 requires psr/log ^1.1 -> found psr/log[1.1.0, ..., 1.1.4] but it conflicts with your root composer.json require (^3.0).`
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

And thanks for your quick answser already given.
Guillaume

@gpatry
Copy link
Author

gpatry commented Jan 17, 2023

Hi @duncan3dc ,

After exploring versions of psr/log and psr/cache and differents requirements of symfony, I think this issue could be solved by updating your composer.json like this :

remove :
"psr/log": "^1.1",
"psr/simple-cache": "^1.0",
add :
"psr/log": "^1.1 || ^2.0 || ^3.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0",

psr/log and psr/cache requires PHP >= 8.0.0 so it could probably break compatibility ?

@gpatry
Copy link
Author

gpatry commented Jan 17, 2023

I created a pull-request with changes proprosal (Full support for PHP 8.2 and Symfony 6.2 #125)
I run composer test and all test are OK.

I also notice that phpstan/phpstan is outdate. I tried to update it to the latest version and correct the 85 errors.
If I have time, I will suggest corrections too.

@gpatry
Copy link
Author

gpatry commented Jan 17, 2023

I go forward in testing.
I replace the 0.8.8 src in my vendor dir with the 2.2.2 src and try to use latest version.

I don't know if it is due to psr/log 3.0 compatibility, but have this issue when using it :

Compile Error: Declaration of duncan3dc\Sonos\Devices\Discovery::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void

Stack trace :

Symfony\Component\ErrorHandler\Error\FatalError:
Compile Error: Declaration of duncan3dc\Sonos\Devices\Discovery::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void

  at vendor/duncan3dc/sonos/src/Devices/Discovery.php:58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants