Skip to content

How to handle versions like develop and master #1975

@citibeth

Description

@citibeth

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

  1. Split on the dots. Eg: '1.2.develop' --> ('1', '2', 'develop')
  2. 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:

  1. Replace '@develop' with '@>develop'
  2. 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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions