Skip to content

Semantic versioning

robsimmons edited this page Oct 24, 2011 · 5 revisions

Smackage intends to take the idea of semantic versioning, as described at http://semver.org/, very seriously. In particular, this means that dependencies specified by Smackage packages should generally refer to specific major revision numbers, and Smackage makes sure that "v1" always refers to one of the "vX.Y.Z" releases; as long as your code could run against "foo v1" when it was released, it will continue to run against "foo v1", since future versions of "foo" with major revision number 1 are not allowed to change the public interface of "foo".

Writing requires: foo v1 in a smackspec file is basically the same as requires: foo >=1.0.0 <2.0.0 in most existing systems. There's a plan to add notation requires: foo v1 (1.4.5) which will be equivalent to requires: foo >=1.4.5 <2.0.0, but currently that should be unnecessary - if you try to install a package that requires foo v1, smackage will go ahead and update foo to the most recent version that has semantic version v1.

The additional meaning of the smackspec requires is that the way you write the constraint explains to smackage how you're going to access the code of the required package. If you write reuqires: foo 1.3, you don't care if smackage, behind the scenes, deletes v1.3.5 and replaces it with v1.3.6, but on the other hand, if v1.5.7 gets installed you expect some variant of v1.3 to stick around, because you'll be referring to the foo package as, say $SMACKAGE/foo/v1.3/sources.cm in your own sources.cm file. The best practice is always to refer to a major version, requires: foo v1.

One quirk to smackage's selection of files is that it will always prefer a version without a special tag to a version with a special tag. If the foo package has versions 1.4.0beta and 1.3.9 and your package requires: foo v1, then version 1.4 will be installed. However, if you require version v1.4 (or, later on, if you require: foo v1 (1.4.0beta)), version 1.4.0beta will still be installed as version v1. The reason for this is to give a bit of practical leeway for beta releases to do unexpected or incompletely tested things.

Clone this wiki locally