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

Support composer installation #236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Chi-teck
Copy link

It would be useful to have this package as Composer dependency.

Currently when the cachetool installed this way it fails with the following message.

In VersionParser.php line 186:
                                              
  [UnexpectedValueException]                  
  Invalid version string "@package_version@"  

@mbrodala
Copy link
Contributor

We require this package all the time as Composer dependency just fine. Running vendor/bin/cachetool also works fine. What exactly have you tried?

@Chi-teck
Copy link
Author

$ ./vendor/bin/cachetool 

In VersionParser.php line 186:
                                              
  Invalid version string "@package_version@"  

@mbrodala
Copy link
Contributor

Please retry with ./vendor/bin/cachetool --verbose to get a full error trace. Again, this does not occur here when running the same command. (Version 9.1.0 here ATM.)

@Chi-teck
Copy link
Author

Chi-teck commented Dec 12, 2023

$ ./vendor/bin/cachetool --verbose

In VersionParser.php line 186:
                                              
  [UnexpectedValueException]                  
  Invalid version string "@package_version@"  
                                              

Exception trace:
  at /var/www/site/vendor/composer/semver/src/VersionParser.php:186
 Composer\Semver\VersionParser->normalize() at /var/www/site/vendor/consolidation/self-update/src/SelfUpdateCommand.php:36
 SelfUpdate\SelfUpdateCommand->__construct() at /var/www/site/vendor/gordalina/cachetool/src/Console/Application.php:65
 CacheTool\Console\Application->getDefaultCommands() at /var/www/site/vendor/symfony/console/Application.php:1312
 Symfony\Component\Console\Application->init() at /var/www/site/vendor/symfony/console/Application.php:680
 Symfony\Component\Console\Application->find() at /var/www/site/vendor/symfony/console/Application.php:262
 Symfony\Component\Console\Application->doRun() at /var/www/site/vendor/gordalina/cachetool/src/Console/Application.php:131
 CacheTool\Console\Application->doRun() at /var/www/site/vendor/symfony/console/Application.php:174
 Symfony\Component\Console\Application->run() at /var/www/site/vendor/gordalina/cachetool/bin/cachetool:30
 include() at /var/www/site/vendor/bin/cachetool:119
$ composer show gordalina/cachetool
name     : gordalina/cachetool
descrip. : Manage your OPcache & APCu cache through the CLI
keywords : Opcache, apcu, cache, fastcgi, fpm, opcode
versions : * 9.0.2
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : 
source   : [git] https://github.com/gordalina/cachetool.git 6b282989613ddd39c608df123ff42b8105a0ecc8
dist     : [zip] https://api.github.com/repos/gordalina/cachetool/zipball/6b282989613ddd39c608df123ff42b8105a0ecc8 6b282989613ddd39c608df123ff42b8105a0ecc8
path     : /var/www/site/vendor/gordalina/cachetool
names    : gordalina/cachetool

@Chi-teck
Copy link
Author

Cannot install cachetool 9.1.0 yet as it has locked dependency on consolidation/self-update

https://github.com/gordalina/cachetool/blob/main/composer.json#L24C10-L24C35

@mbrodala
Copy link
Contributor

mbrodala commented Dec 12, 2023

@Chi-teck But you should, exactly because of that: #231

Seems like this would fix your issue.

@Chi-teck
Copy link
Author

Again, this does not occur here when running the same command.

It likely depends on Composer or symfony/console version.

@Chi-teck
Copy link
Author

exactly because of that:

Ok, that might be the reason. BTW what version is displayed for you when you run

$ ./vendor/bin/cachetool --version

@mbrodala
Copy link
Contributor

As I already wrote: 9.1.0, the currently latest version.

@Chi-teck
Copy link
Author

Chi-teck commented Dec 12, 2023

Downgrading consolidation/self-update resolved the issue for me.

As I already wrote: 9.1.0, the currently latest version.

How did it pick the version? For me it shows the following.

$ ./vendor/bin/cachetool --version
CacheTool @package_version@

@Chi-teck
Copy link
Author

Chi-teck commented Dec 12, 2023

BTW Compose 2 is capable to provide a version for any installed package.
So instead of @package_version@ we could use something like this

InstalledVersions::getPrettyVersion('gordalina/cachetool');

@mbrodala
Copy link
Contributor

Now I get what you mean, I can confirm this:

$ vendor/bin/cachetool --version
CacheTool @package_version@

But since I always use composer show instead, it's not a big deal. ;-)

@Chi-teck
Copy link
Author

Yes, it's not a big deal.

The big deal is the lock to consolidation/self-update:2.1 which may cause dependency conflicts with other packages. Also some day, this version of consolidation/self-update will become unsupported.

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

Successfully merging this pull request may close these issues.

2 participants