浏览代码

Update MKit for test suites to v0.0.33

Alois Mahdal 6 年前
父节点
当前提交
08f59cd67a
共有 2 个文件被更改,包括 34 次插入10 次删除
  1. 17
    9
      src/tdk/utils/mkit/include/facts.sh
  2. 17
    1
      src/tdk/utils/mkit/include/vars.sh

+ 17
- 9
src/tdk/utils/mkit/include/facts.sh 查看文件

@@ -139,9 +139,14 @@ semver() {
139 139
     local prerl         # pre-release keyword (from mkit.ini, eg. 'beta')
140 140
     local latest_tag    # latest git tag
141 141
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
142
-    local dirty         # 0 if dirty, 1 if clean
142
+    local dirty=F       # F if dirty, T if clean
143
+    local btime         # hex timestamp or nothing (see $MKIT_TTAG)
143 144
     local suffix        # version suffix
144 145
     prerl=$(ini 1value project:prerl)
146
+    case $MKIT_TTAG in
147
+        none)   btime= ;;
148
+        btime)  btime=$(printf '%08x' "$(date +%s)") ;;
149
+    esac
145 150
     grep ":" <<<"$prerl" \
146 151
      && warn "colon in project:prerl may corrupt version data: $prerl"
147 152
     git_present || {
@@ -161,14 +166,17 @@ semver() {
161 166
     then    # we are at a later commit than the last tag
162 167
         commit="$(git_fact current_branch).g$(git_fact latest_sha)"
163 168
     fi
164
-    git_bool dirty; dirty=$?
165
-    case "$dirty:$commit" in
166
-        1:)  suffix=""               ;;
167
-        0:)  suffix="+dirty"         ;;
168
-        1:*) suffix="+$commit"       ;;
169
-        0:*) suffix="+$commit.dirty" ;;
170
-        *)   suffix=MKIT_BUG
171
-             warn "MKIT_BUG: bad dirt/commit detection" ;;
169
+    git_bool dirty && dirty=T
170
+    case "$dirty:$btime:$commit" in
171
+        F:*:)   suffix=""                       ;;
172
+        T::)    suffix="+dirty"                 ;;
173
+        T:*:)   suffix="+t$btime.dirty"           ;;
174
+        F::*)   suffix="+$commit"               ;;
175
+        F:*:*)  suffix="+t$btime.$commit"         ;;
176
+        T::*)   suffix="+$commit.dirty"         ;;
177
+        T:*:*)  suffix="+t$btime.$commit.dirty"   ;;
178
+        *)      suffix=MKIT_BUG
179
+                warn "MKIT_BUG: bad dirt/commit detection" ;;
172 180
     esac
173 181
     test -n "$prerl" && suffix="-$prerl$suffix"
174 182
     echo "$xyz$suffix"

+ 17
- 1
src/tdk/utils/mkit/include/vars.sh 查看文件

@@ -55,7 +55,23 @@ MKIT_LOCAL=${MKIT_LOCAL:-.mkit}
55 55
 #
56 56
 MKIT_PROJ_PKGNAME=""
57 57
 
58
+#
59
+# Add time-based ordinal tag to SemVer build data?
60
+#
61
+# Can be 'none' or 'btime'.
62
+#
63
+# If 'btime', devel builds have also 'tXXXXXXXX' tag, where each
64
+# 'X' is a hexa-decimal digit of Unix timestamp taken when build
65
+# is initiated.  This way, builds from same branch are guarranteed
66
+# to order based on build time (that is, until February 7th, 2106).
67
+#
68
+# Note that this makes devel and dirty builds non-deterministic,
69
+# but does not affect clean builds (ie. builds from clean repo
70
+# with HEAD corresponding to latest version tag.).
71
+#
72
+MKIT_TTAG=${MKIT_TTAG:-btime}
73
+
58 74
 #
59 75
 # This MKit version
60 76
 #
61
-MKIT_VERSION=0.0.32
77
+MKIT_VERSION=0.0.33