mirror of
https://github.com/semver/semver.git
synced 2026-07-10 19:50:47 -05:00
[GH-ISSUE #97] Using tidle instead of hyphen for pre-release tag to comply with debian versioning #2783
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @atuleu on GitHub (May 17, 2013).
Original GitHub issue: https://github.com/semver/semver/issues/97
hyphen is used by debian to separate between upstream and debian version.
It would be safer to separate (like for backport in debian, that are a kind of pre-release) pre-release tag with tidle '~' to comply easily with debian policy. Then comparison in lexical order of string would still ensure :
1.0.0
rc1 < 1.0.0rc2 < 1.0.0if you refer to the debian policy, this is how they advice to mark upstream version :
http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
and the footnote :
http://www.debian.org/doc/debian-policy/footnotes.html#f37
@isaacs commented on GitHub (Jun 6, 2013):
Would it be suitable to use either
-or~as a separator?@atuleu commented on GitHub (Jun 6, 2013):
Suitable for me ... actually my developments are conform to this document, expect for this hyphen thing.
@tbull commented on GitHub (Jun 6, 2013):
Well, Debian is not the only (package management) system in the world which deals with version numbers and which imposes its own set of rules on them. When importing anything from the outside world, there has to be a translation process from the original version to one which complies with these rules. This thought has already occured to the Debian guys, too.
From http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version :
So the solution appears simple to me. On import, just
upstream_version =~ s/-/~/;ors/-/~/g;(Perl syntax)
Adjusting the SemVer rules to be compatible with one particular package management system does not seem like a good idea to me. There are so many other such systems. Each of the scripting languages (Perl, Ruby, Python) has own repositories, many OS have them (several Linuxes, several BSDs). Making the requested modification could mean to lose compatibility with one of them. And we would have another special rule, an exception, the opposite of simplicity. I can only repeat: Keep it as simple as possible!
@isaacs commented on GitHub (Jun 6, 2013):
I slept on this and woke up feeling like this is not a good idea. @tbull just convinced me even more.
I'd say that if you want to parse Debian style versions, you should either minimally extend the spec for your use case and document the divergence (as I plan to do in one edge case with npm versions), or convert before parsing/comparing.
@haacked commented on GitHub (Jun 9, 2013):
Ok, I'll close this then.
The dash for pre-release was part of SemVer 1.0 and I think changing it would be a huge unnecessary breaking change for all SemVer implementations out there. So I agree with not changing it.