|
@@ -102,7 +102,7 @@ git_lasthash() {
|
102
|
102
|
|
103
|
103
|
semver() {
|
104
|
104
|
#
|
105
|
|
- # Build semver version string with build metadata
|
|
105
|
+ # Build proper SemVer version string
|
106
|
106
|
#
|
107
|
107
|
# Build version string from available info using following
|
108
|
108
|
# logic:
|
|
@@ -120,33 +120,23 @@ semver() {
|
120
|
120
|
#
|
121
|
121
|
# Examples:
|
122
|
122
|
#
|
123
|
|
- # myprog v1.0.7 # all clear
|
124
|
|
- # myprog v1.0.7-alpha # mkit.ini: project:prerl="alpha"
|
125
|
|
- # myprog v1.0.7-alpha+g1aef811.master # ^^ + some commits after
|
126
|
|
- # myprog v1.0.7-alpha+gf14fc4f.api2 # ^^ + on a feature branch
|
127
|
|
- # myprog v1.0.7-alpha+gf14fc4f.api2.dirty # ^^ + tree edited
|
128
|
|
- # myprog v1.0.7-alpha+dirty # tag OK but tree edited
|
129
|
|
- # myprog v1.0.7+dirty # ^^ but no pre-release id
|
|
123
|
+ # foo v1.0.7 # all clear; proper release
|
|
124
|
+ # foo v1.0.7-beta # mkit.ini: project:prerl="beta"
|
|
125
|
+ # foo v1.0.7-beta+g1aef811.master # ^^ + some commits after
|
|
126
|
+ # foo v1.0.7-beta+gf14fc4f.api2 # ^^ + on a feature branch
|
|
127
|
+ # foo v1.0.7-beta+gf14fc4f.api2.dirty # ^^ + tree edited
|
|
128
|
+ # foo v1.0.7-beta+dirty # tag OK but tree edited
|
|
129
|
+ # foo v1.0.7+dirty # ^^ but no pre-release id
|
130
|
130
|
#
|
131
|
131
|
# Note that versions with "dirty" should be perceived as kind of
|
132
|
132
|
# dangerous outside developer's own machine. Versions with sha1 are
|
133
|
133
|
# safer but must not be released.
|
134
|
134
|
#
|
135
|
|
- # I have considered decorating the git commit refs to make them
|
136
|
|
- # sort of sortable (e.g. "r1.g1aef811"), but on second thought,
|
137
|
|
- # I don't think it's good idea to give *any* semantics to meta-data
|
138
|
|
- # at all. First, there is no rule that r1<r2<r3; a commit can be
|
139
|
|
- # removing what other just added and one change can be split to
|
140
|
|
- # multiple commits. Also, the whole thing breaks anyway once you
|
141
|
|
- # rebase your branch (no, it's not a sin). The sole purpose of
|
142
|
|
- # meta-data is to *identify* the code, and provide safe path back
|
143
|
|
- # to tree; commit refs are already perfect for that.
|
144
|
|
- #
|
145
|
135
|
# FIXME: Using project:prerl for release IDs may not be compatible with
|
146
|
136
|
# release strategy implemented in release.sh
|
147
|
137
|
#
|
148
|
138
|
local xyz # base version string
|
149
|
|
- local prerl # pre-release keyword (from mkit.ini, eg. 'alpha')
|
|
139
|
+ local prerl # pre-release keyword (from mkit.ini, eg. 'beta')
|
150
|
140
|
local latest_tag # latest git tag
|
151
|
141
|
local commit # commit indicator (CURRENT_BRANCH.gHASH)
|
152
|
142
|
local dirty # 0 if dirty, 1 if clean
|