|
@@ -128,7 +128,7 @@ get_version() {
|
128
|
128
|
#
|
129
|
129
|
# 1. use VERSION (from config.mk)
|
130
|
130
|
# 2. if we are in git, override the version with last tag
|
131
|
|
- # 3. if set, add STAGE (from config.mk) as pre-release ID
|
|
131
|
+ # 3. if set, add PRERELEASE (from config.mk) as pre-release ID
|
132
|
132
|
# (afer dash)
|
133
|
133
|
# 4. if we are at a later commit than the last tag, add branch
|
134
|
134
|
# name and commit sha1 to build metadata (after plus sign)
|
|
@@ -140,12 +140,12 @@ get_version() {
|
140
|
140
|
# Examples:
|
141
|
141
|
#
|
142
|
142
|
# myprog v1.0.7 # all clear
|
143
|
|
- # myprog v1.0.7-alpha # STAGE="alpha"
|
|
143
|
+ # myprog v1.0.7-alpha # PRERELEASE="alpha"
|
144
|
144
|
# myprog v1.0.7-alpha+g1aef811.master # ^^ + some commits after
|
145
|
145
|
# myprog v1.0.7-alpha+gf14fc4f.api2 # ^^ + on a feature branch
|
146
|
146
|
# myprog v1.0.7-alpha+gf14fc4f.api2.dirty # ^^ + tree edited
|
147
|
147
|
# myprog v1.0.7-alpha+dirty # tag OK but tree edited
|
148
|
|
- # myprog v1.0.7+dirty # ^^ but no stage
|
|
148
|
+ # myprog v1.0.7+dirty # ^^ but no pre-release id
|
149
|
149
|
#
|
150
|
150
|
# Note that versions with "dirty" should be perceived as kind of
|
151
|
151
|
# dangerous outside developer's own machine. Versions with sha1 are
|
|
@@ -166,8 +166,8 @@ get_version() {
|
166
|
166
|
# other than a tagged commit.
|
167
|
167
|
#
|
168
|
168
|
local version=$VERSION
|
169
|
|
- local stage=$STAGE
|
170
|
|
- grep ":" <<<"$stage" && warn "colon in STAGE may corrupt version data: $stage"
|
|
169
|
+ local prerl=$PRERELEASE
|
|
170
|
+ grep ":" <<<"$prerl" && warn "colon in PRERELEASE may corrupt version data: $prerl"
|
171
|
171
|
if git rev-parse HEAD >&/dev/null;
|
172
|
172
|
then # we are in git repo... so we can get smart
|
173
|
173
|
local lasttag=$(git tag | grep ^v | sort -V | tail -n1)
|
|
@@ -183,15 +183,15 @@ get_version() {
|
183
|
183
|
fi
|
184
|
184
|
version=${lasttag:1}
|
185
|
185
|
local suffix=""
|
186
|
|
- case $stage:$commit:$dirty in
|
|
186
|
+ case $prerl:$commit:$dirty in
|
187
|
187
|
::) suffix="" ;;
|
188
|
188
|
::dirty) suffix="+$dirty" ;;
|
189
|
189
|
:*:) suffix="+$commit" ;;
|
190
|
190
|
:*:dirty) suffix="+$commit" ;;
|
191
|
|
- *::) suffix="-$stage" ;;
|
192
|
|
- *::dirty) suffix="-$stage+$dirty" ;;
|
193
|
|
- *:*:) suffix="-$stage+$commit" ;;
|
194
|
|
- *:*:dirty) suffix="-$stage+$commit.$dirty" ;;
|
|
191
|
+ *::) suffix="-$prerl" ;;
|
|
192
|
+ *::dirty) suffix="-$prerl+$dirty" ;;
|
|
193
|
+ *:*:) suffix="-$prerl+$commit" ;;
|
|
194
|
+ *:*:dirty) suffix="-$prerl+$commit.$dirty" ;;
|
195
|
195
|
esac
|
196
|
196
|
version=$version$suffix
|
197
|
197
|
fi
|