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

Comparing semver to non-semver #368

Closed
SteveL-MSFT opened this issue May 5, 2017 · 1 comment
Closed

Comparing semver to non-semver #368

SteveL-MSFT opened this issue May 5, 2017 · 1 comment

Comments

@SteveL-MSFT
Copy link

We've converted to using semver in http://github.com/powershell/powershell, however, for compatibility reasons we have situations where we have to compare our semver against a non-conforming version. For example, check if 6.0.0 is greater than 3.0 as older tools built on older versions of PowerShell only expect major.minor. To do this comarison, we would like to convert 3.0 to 3.0.0 where we assume the patch version is 0. Is this acceptable from a semver standpoint where we moved from major.minor to semver?

@haacked
Copy link
Contributor

haacked commented May 5, 2017

Yes.

Semver itself doesn't have anything g to say about this.
But the general idea is you want to translate non-semver versions to Semver and a reasonable approach is that the non-specified versions would be 0. This is an implementation detail of your specific platform. All semver tells you is how to compare versions after you've done the translation.

SteveL-MSFT added a commit to SteveL-MSFT/PowerShell that referenced this issue May 8, 2017
…fied which broke scenarios like:

`$psversiontable.psversion -gt "3.0"` which is used by PowerShellGet to determine if a module is compatible with the current version of PowerShell.

Change is to allow specifying only major or major+minor where the missing segments default to zero by providing overloaded constructors and allow
the string parsing method to not require major, minor, and patch segments to all be specified (only major is required).

Based on the [response](semver/semver#368) from the maintainer of semver, there is no requirement to have strict
conformance for the inputs to the constructor and allowing "3.0" to result in a semver of 3.0.0 is reasonable.
lzybkr pushed a commit to PowerShell/PowerShell that referenced this issue May 8, 2017
)

`$psversiontable.psversion -gt "3.0"` which is used by PowerShellGet to determine if a module is compatible with the current version of PowerShell.

Change is to allow specifying only major or major+minor where the missing segments default to zero by providing overloaded constructors and allow
the string parsing method to not require major, minor, and patch segments to all be specified (only major is required).

Based on the [response](semver/semver#368) from the maintainer of semver, there is no requirement to have strict
conformance for the inputs to the constructor and allowing "3.0" to result in a semver of 3.0.0 is reasonable.
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

No branches or pull requests

2 participants