Closed remicollet closed 4 years ago
I don't think so.
Reason is that version is retrieve by jean85/pretty-package-versions
package when you clone phpcompatinfo git repository or install it as a dependency in a project; Application::VERSION
is just a fallback.
I've test it again to be sure that jean85/pretty-package-versions
package did it job, with a fresh install in PHP 7.1
devilbox@php-7.1.33 in /shared/backups/bartlett/tests $ composer req bartlett/php-compatinfo
Using version ^5.3 for bartlett/php-compatinfo
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 31 installs, 0 updates, 0 removals
- Installing composer/package-versions-deprecated (1.8.1): Downloading (100%)
- Installing psr/log (1.1.3): Downloading (100%)
- Installing jean85/pretty-package-versions (1.5.0): Downloading (100%)
- Installing laminas/laminas-zendframework-bridge (1.0.4): Downloading (100%)
- Installing laminas/laminas-diagnostics (1.6.0): Downloading (100%)
- Installing league/tactician (v1.0.3): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing symfony/service-contracts (v1.1.9): Downloading (100%)
- Installing symfony/polyfill-php80 (v1.17.1): Downloading (100%)
- Installing symfony/polyfill-php73 (v1.17.1): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.17.1): Downloading (100%)
- Installing symfony/console (v4.4.10): Downloading (100%)
- Installing composer/semver (1.5.1): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.17.1): Downloading (100%)
- Installing bartlett/php-compatinfo-db (2.15.0): Downloading (100%)
- Installing seld/jsonlint (1.8.0): Downloading (100%)
- Installing justinrainbow/json-schema (5.2.10): Downloading (100%)
- Installing phpdocumentor/reflection-common (2.1.0): Downloading (100%)
- Installing phpdocumentor/type-resolver (1.0.1): Downloading (100%)
- Installing webmozart/assert (1.9.1): Downloading (100%)
- Installing phpdocumentor/reflection-docblock (4.3.4): Downloading (100%)
- Installing symfony/dependency-injection (v4.4.10): Downloading (100%)
- Installing symfony/stopwatch (v4.4.10): Downloading (100%)
- Installing symfony/finder (v4.4.10): Downloading (100%)
- Installing symfony/event-dispatcher-contracts (v1.1.9): Downloading (100%)
- Installing symfony/event-dispatcher (v4.4.10): Downloading (100%)
- Installing doctrine/collections (1.6.6): Downloading (100%)
- Installing nikic/php-parser (v4.6.0): Downloading (100%)
- Installing sebastian/version (2.0.1): Downloading (100%)
- Installing bartlett/php-reflect (4.4.0): Downloading (100%)
- Installing bartlett/php-compatinfo (5.3.0): Downloading (100%)
And got expected result
devilbox@php-7.1.33 in /shared/backups/bartlett/tests $ vendor/bin/phpcompatinfo --version
phpCompatInfo version 5.3.0 DB version 2.15.0 built Jun 30 2020 11:17:55 UTC
BTW, I think that jean85/pretty-package-versions
package seems to not retrieve correctly the right commit (with a git clone copy):
Actually phpcompatinfo latest commit is 5b58fb55f2a759f6c134d1649d1e1df1b8cd5cf2 and we get commit hash 91df513a46561c0c8536dc3cd562ac98d43439dd (n -3)
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ bin/phpcompatinfo --version
phpCompatInfo version 5.3.x-dev@91df513 DB version 2.15.0 built Jun 30 2020 11:17:55 UTC
Application::VERSION is just a fallback.
Yes
FYI, we didn't use jean85/pretty-package-versions
which rely on reading composer.json, so which doesn't make sense outside composer world (IMHO this package is a shame)
So we rely on this fallback version. BTW, I can manage it as we already patch the code to drop this usage.
FYI, we didn't use jean85/pretty-package-versions which rely on reading composer.json, so which doesn't make sense outside composer world (IMHO this package is a shame)
And what do you think about sebastian/version
package ?
Goal are different, jean85/pretty-package-version
allow no change in the code (no release process), while sebastian/version
requires to set the version during the release.
I've found a good compromise (I hope). If you're agree, i can be release a 5.3.1 version to fix it !
jean85/pretty-package-versions
and keep only composer/package-versions-deprecated
1.8.1 (for both composer 1.x and 2.x compatibility)In Bartlett\CompatInfo\Console\Application
class :
use PackageVersions\Versions; // composer/package-versions-deprecated 1.8.1
public function __construct()
{
$version = Versions::getVersion('bartlett/php-compatinfo');
list($ver, $commit) = explode('@', $version);
if (strpos($ver, 'dev') === false) {
$version = $ver;
}
parent::__construct('phpCompatInfo', $version);
}
Results are what I expect :
Out of a git clone copy (phpcompatinfo installed with composer)
devilbox@php-7.1.33 in /shared/backups/bartlett/tests $ vendor/bin/phpcompatinfo --version
phpCompatInfo version 5.3.0 DB version 2.15.0 built Jun 30 2020 11:17:55 UTC
In a git clone copy, either on master or 5.3 branch
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ git branch -v
* 5.3 5b58fb55 prepare stable release 5.3.0
master 5b58fb55 prepare stable release 5.3.0
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ bin/phpcompatinfo --version
phpCompatInfo version 5.3.x-dev@5b58fb55f2a759f6c134d1649d1e1df1b8cd5cf2 DB version 2.15.0 built Jun 30 2020 11:17:55 UTC
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ git checkout master
M src/Bartlett/CompatInfo/Console/Application.php
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ bin/phpcompatinfo --version
phpCompatInfo version 5.3.x-dev@5b58fb55f2a759f6c134d1649d1e1df1b8cd5cf2 DB version 2.15.0 built Jun 30 2020 11:17:55 UTC
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ git branch -v
5.3 5b58fb55 prepare stable release 5.3.0
* master 5b58fb55 prepare stable release 5.3.0
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ rm -rf vendor/ composer.lock
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ composer install --quiet
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ git branch -v
5.3 5b58fb55 prepare stable release 5.3.0
* master 5b58fb55 prepare stable release 5.3.0
devilbox@php-7.1.33 in /shared/backups/bartlett/php-compat-info $ bin/phpcompatinfo --version
phpCompatInfo version dev-master@5b58fb55f2a759f6c134d1649d1e1df1b8cd5cf2-dev DB version 2.15.0 built Jun 30 2020 11:17:55 UT
If you prefer, don't really care (composer/package-versions-deprecated is mostly the same shit)
No need to retag 5.3.1 (5.3.0 RPM are ok, this PR is applied)
ok then, I'll apply my fix only on branch 5.4 that will begin in next hours, and no retag or publish new 5.3 releases
Closing this PR, because I'll push the new branch 5.4 with 5.3 base code plus new version strategy. BTW, thanks for your feedback, I appreciated a lot !
Fix version ;)