Repository navigation
Address defects in SemVer comparison and parsing - #920
Merged
Merged
Conversation
…being part of the normalized version
Member
|
thx a lot |
forki
added a commit
that referenced
this pull request
Jul 13, 2015
Address defects in SemVer comparison and parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So this got kinda big, I'm sorry in advance.
At work, we made some nuget packages of the form
Mozu.Component.Contracts.1.1.0-dev1507031354ci. That is the package Id, followed by an increasing major, minor, patch. Prereleases are of the form 'dev', then a YYMMDDHHmm timestamp, and then a few characters from the branch that created the package, in this case 'ci'.This is fine from Nuget's point of view, because a prerelease term is any non-period string after a patch. This is also fine from SemVer 2.0, because a prerelease term is
However, Paket seems to be more strict than this, requiring that a prerelease term be only of the form
(optional string part)(optional number part). So what happens is that the prerelease term is not parsed at all, which means a restore/install pulls an arbitrary Major.Minor.Patch version of the package Id in question from the server.So for this pull request I redid the way that Paket parses and interprets prerelease identifiers, making a Prerelease record track a set of one or more PrereleaseSegments which can be either alphanumeric or numeric. This is important because the number of segments, as well as their types, has implications for comparisions according to section 11 of the SemVer 2.0 spec.
I've also addressed the build metadata portion of the spec. Based on my reading I see room for only one chunk of build metadata that isn't necessarily tied to whether or not a particular version string has a prerelease section or not. So I renamed that item. The build metadata is also not to be used in comparisions, so I removed it from consideration in the implementation of IComparable for the SemVerInfo class.