Comparing versions with wildcards and without them (for instance for semantic versioning)
Posted by jpluimers on 2020/08/12
For a project I’m going to be in need to compare version numbers.
I’m not sure yet if I need wildcards, or can leave them out (but for partial semantic versioning, I might need them).
Below a bunch of links that should get me started.
From a quick glance: versioning is hard, comparing even harder.
On versioning in general
- [WayBack] Why are version constraints combining comparisons and wildcards a bad idea? – Composer
- [WayBack] Compare Version Numbers with large inputs allowed – GeeksforGeeks
- [WayBack] Compare two Version numbers – GeeksforGeeks
- [WayBack] Re: RPM version comparison algorithm
- [WayBack] How Yum and RPM Compare Versions – Jason Antman’s Blog
Numeric versioning (usually without wildcards):
- [WayBack] algorithm – Javascript function to compare two versions – Stack Overflow
- [WayBack] java – Comparing version number strings (major, minor, revision, beta) – Stack Overflow
- [WayBack] versioning – Comparing two software versions in C# – Software Engineering Stack Exchange
- [WayBack] Comparing Version Strings in C++ | Sourcey
On semantic versioning (SemVer for short):
- [WayBack] Semantic Versioning 2.0.0 | Semantic Versioning
- [WayBack] GitHub – scottcorgan/compare-semver: Compare semver versions to many other semver versions
- [WayBack] Simple Versioning · GitHub: A simple, pragmatic versioning convention.In a sense, this is a subset of SemVer, but with slightly different semantics.
- [WayBack] Why Semantic Versioning Isn’t · GitHub – an essay – followed by a lively discussion – against SemVer which turns out to actually end in favour of SemVer
- [WayBack] Just published my smallest ever open source project – 1 unit (not counting the unit tests) … – Vincent Parrett – Google+
- [WayBack] GitHub – VSoftTechnologies/SemanticVersion: Semantic Version Parser for Delphi
- Nice discussion on
in
versusCharInSet
versusIsDigit
versusIsInArray
- [WayBack] Semantic Version C# class · GitHub
- [WayBack] c# – Is there a NuGet package that contains a semantic version parser in .NET? – Stack Overflow
- [WayBack] Semantic Version Functions | sprig Useful template functions for Go templates.
- [WayBack] GitHub – zafarkhaja/jsemver: Java implementation of the SemVer Specification
- [WayBack] Semantic version utility · Issue #566 · stedolan/jq · GitHub
- [WayBack] semver: Basics
- [WayBack] GitHub – substack/semver-compare: compare two semver version strings, returning -1, 0, or 1
On the C# Version class (which handles most of semantic versioning except: leading zero’s, very large numbers, non-numeric release specifiers)
- [WayBack] validation – C# Compare two versions using wildcard – Stack Overflow
- [WayBack] c# – Compare version numbers without using split function – Stack Overflow
- [WayBack] Version.CompareTo Method (Object) (System) which does not regard undefined (-1) as wildcards by documenting
// A Version object contains four hierarchical numeric components: major, minor, // build and revision. Build and revision may be unspecified, which is represented // internally as a -1. By definition, an unspecified component matches anything // (both unspecified and specified), and an unspecified component is "less than" any // specified component.
- [WayBack] Version Class (System) The value of Version properties that have not been explicitly assigned a value is undefined (-1); Ordinarily, the Version class is not used to assign a version number to an assembly. Instead, the AssemblyVersionAttribute class is used to define an assembly’s version, as illustrated by the example in this topic.
Interesting idea, but not sustainable: using floating point values to compare versions:
On wildcards:
- 2008 [Archive.is] Matching Wildcards: An Algorithm | Dr Dobb’s: A simple wildcard text-matching algorithm in a single while loop
- 2014 [ Archive.is] Matching Wildcards: An Empirical Way to Tame an Algorithm | Dr Dobb’s: Optimizing and testing a wildcard algorithm to get 5x performance improvement.
Via: [WayBack] Anyone tips for a TVersion structure that supports at max quad digits or wildcards and comparison? Like 3.2 matching 3.2.5.7, but not matching 3.3.4.28 ? – Jeroen Wiert Pluimers – Google+
–jeroen
Leave a Reply