Implement almost full semver comparison (fixes #436)