-
Notifications
You must be signed in to change notification settings - Fork 2.4k
How to handle versions like develop and master #1975
Copy link
Copy link
Closed
Labels
Description
@davydden @tgamblin
This Issue is related to: #1924 #1940 #1561
Currently, the @develop version is special, in that it is larger than all numeric versions, whereas all other non-numeric versions are smaller. Although this does serve a purpose, it feels like a special-case "hack" where a more general (and transparent) approach could serve us better. This is a proposal for comparing versions that is more general.
A version consists of a series of strings separated by dots. For example: '1', '1.2', 'master', '1.2.develop', etc. Versions are compared by:
- Split on the dots. Eg: '1.2.develop' --> ('1', '2', 'develop')
- Compare the tuples element-by-element using the following rules:
a) An element is numeric if it consists of all 0-9 digits (plus other stuff, like 2a).
b) Any element starting '<' is always less than 0; any element starting with '>' is greater than 9.
c) All other elements will be sorted in alphabetical order, and placed less than elements starting with '<'
In practice, two things would need to change from current use:
- Replace '@develop' with '@>develop'
- Use quotes when specifying these versions in the bash shell. (Unless we think of different symbols to use for < and >. The symbols can be more than one character if we like. Maybe '~' and '+' since those are already used elsewhere in Spack).
Thoughts?
[This proposal has been updated slightly from original]
Reactions are currently unavailable