-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Branch version strings like dev-master are not supported #30
Comments
I agree that to be a potential problem, at least it certainly is a short coming. I'm not sure yet though how to properly address it: As such a hash only version identifier is not really comparable, we can only tell two hash-versions are different but there is no means of telling which might be "higher". That being said, non-release versions need to be somehow supported. But that potentially opens up a can of worms ;) |
I've tested some of common versions we can find from Composer installation (use cases are identified in following script by use PharIo\Version\VersionConstraintParser;
use Composer\Semver\VersionParser;
// @see https://github.com/composer/semver/
// @see https://github.com/phar-io/version
// composer
$parser1 = new VersionParser();
// phar-io
$parser2 = new VersionConstraintParser();
$versionProvider = [
'1.2.3a40',
'1.2.3p456',
'dev-master@4ce7aef0217756c440502a84aa650c3a7f16387b',
'3.x-dev',
'dev-master',
'dev-master as 1.0.0',
'4.0.x-dev@ac18809'
];
foreach ($versionProvider as $input) {
$input = $parser1->normalizeDefaultBranch($input);
$parts = explode('@', $input);
$normalized = count($parts) > 1 ? $parser1->normalize($parts[0]) : $parser1->normalize($input);
$branch = $parser1->normalizeDefaultBranch($normalized);
try {
$versionConstraint = $parser2->parse($branch);
$message = 'version constraint: ' . $versionConstraint->asString();
} catch (\Throwable $e) {
$message = 'issue : ' . $e->getMessage();
}
$results = [
'input' => $input,
'composer' => $branch,
'phar.io' => $message,
];
var_dump($results);
echo '------------------------------' . PHP_EOL;
} And with a little workaround with See results given
At least, I can fix issue I got when trying to build an XML manifest with |
Reminder about this old report : any news ? |
Hello @theseer
Following our recent discussion, I would like here to remember the use case I found about version string not yet supported.
Context
When we want to create a manifest for a package under development. From master branch or another one, and with latest commit not the same as the one corresponding to the latest git tag. Picking info from VCS like PHPUnit did with https://github.com/sebastianbergmann/phpunit/blob/master/build/scripts/phar-manifest.php#L3-L15
Current behaviour
Prints workaround version
0.0.0-dev
Expected behaviour
Prints version
dev-master@045047b37d1dd99bf7e97487e2dc10820439f29b
Script to reproduce issue
The text was updated successfully, but these errors were encountered: