[GH-ISSUE #97] Using tidle instead of hyphen for pre-release tag to comply with debian versioning #2783

Closed
opened 2026-04-25 16:41:04 -05:00 by GiteaMirror · 5 comments
Owner

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.0rc1 < 1.0.0rc2 < 1.0.0

if 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

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.0~rc2 < 1.0.0 if 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
Author
Owner

@isaacs commented on GitHub (Jun 6, 2013):

Would it be suitable to use either - or ~ as a separator?

<!-- gh-comment-id:19019686 --> @isaacs commented on GitHub (Jun 6, 2013): Would it be suitable to use either `-` or `~` as a separator?
Author
Owner

@atuleu commented on GitHub (Jun 6, 2013):

Suitable for me ... actually my developments are conform to this document, expect for this hyphen thing.

<!-- gh-comment-id:19033249 --> @atuleu commented on GitHub (Jun 6, 2013): Suitable for me ... actually my developments are conform to this document, expect for this hyphen thing.
Author
Owner

@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 :

however, it [the upstream version] may need to be reformatted to fit into the package management system's format and comparison scheme.

So the solution appears simple to me. On import, just
upstream_version =~ s/-/~/; or s/-/~/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!

<!-- gh-comment-id:19038801 --> @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 : > however, it [the upstream version] may need to be reformatted to fit into the package management system's format and comparison scheme. So the solution appears simple to me. On import, just `upstream_version =~ s/-/~/;` or `s/-/~/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!**
Author
Owner

@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.

<!-- gh-comment-id:19049967 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:19170155 --> @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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#2783