Browse Source

Update MKit for test suites to v0.0.34

Alois Mahdal 6 years ago
parent
commit
45f2d64118
2 changed files with 31 additions and 15 deletions
  1. 6
    2
      src/tdk/utils/mkit/include/facts.sh
  2. 25
    13
      src/tdk/utils/mkit/include/vars.sh

+ 6
- 2
src/tdk/utils/mkit/include/facts.sh View File

@@ -54,6 +54,9 @@ git_fact() {
54 54
         latest_sha)
55 55
             git log -1 --pretty=format:%h HEAD
56 56
             ;;
57
+        latest_cdate)
58
+            git log -1 --format=%cd --date=unix HEAD
59
+            ;;
57 60
         *)
58 61
             warn "unknown git fact asked: $fact_name"
59 62
             ;;
@@ -140,12 +143,13 @@ semver() {
140 143
     local latest_tag    # latest git tag
141 144
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
142 145
     local dirty=F       # F if dirty, T if clean
143
-    local btime         # hex timestamp or nothing (see $MKIT_TTAG)
146
+    local btime         # timestamp or nothing (see $MKIT_TTAG)
144 147
     local suffix        # version suffix
145 148
     prerl=$(ini 1value project:prerl)
146 149
     case $MKIT_TTAG in
147 150
         none)   btime= ;;
148
-        btime)  btime=$(printf '%08x' "$(date +%s)") ;;
151
+        btime)  btime=$(date -u +%Y%m%d%H%M%S) ;;
152
+        ctime)  btime=$(date -d @"$(git_fact latest_cdate)" -u +%Y%m%d%H%M%S) ;;
149 153
     esac
150 154
     grep ":" <<<"$prerl" \
151 155
      && warn "colon in project:prerl may corrupt version data: $prerl"

+ 25
- 13
src/tdk/utils/mkit/include/vars.sh View File

@@ -58,20 +58,32 @@ MKIT_PROJ_PKGNAME=""
58 58
 #
59 59
 # Add time-based ordinal tag to SemVer build data?
60 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}
61
+# Can be 'none', 'ctime' or 'btime'.
62
+#
63
+# If 'ctime', devel builds have also timestamp-based tag in format of
64
+# `t%Y%m%d%H%M%S`, that is, a small character 't' followed by timestamp
65
+# without non-digit characters.  The timestamps are in UTC, ie. timezones
66
+# need not apply.  'btime' has the same format, except that it's derived
67
+# from build time, while 'ctime' is from last commit's commit date.
68
+#
69
+# This helps with deploying development builds where packaging system
70
+# is not SemVer-compliant and makes it hard to install arbitrary version.
71
+# For example, old yum version (as of RHEL-6) will not let you install
72
+# version that it deems older than is installed, making it hard to
73
+# continually upgrade during active development.  While packaging
74
+# systems have their own rukes (and SemVer says both versions should be
75
+# considered same) this tag will make it more likely to "win" the build
76
+# you made later.
77
+#
78
+# Note that this does not affect clean builds (ie. builds from clean
79
+# repo with HEAD corresponding to latest version tag.).
80
+#
81
+# Also note that 'btime' makes the version non-deterministic: merely
82
+# initiating the build a second later will result in different version.
83
+#
84
+MKIT_TTAG=${MKIT_TTAG:-ctime}
73 85
 
74 86
 #
75 87
 # This MKit version
76 88
 #
77
-MKIT_VERSION=0.0.33
89
+MKIT_VERSION=0.0.34