Pārlūkot izejas kodu

Update MKit to v0.0.33

Alois Mahdal 6 gadus atpakaļ
vecāks
revīzija
a72d01686b

+ 9
- 5
utils/mkit/include/build.sh Parādīt failu

@@ -47,15 +47,19 @@ __expand_line() {
47 47
     local line=$1   # line to process
48 48
     local mname     # macro name
49 49
     local mvline    # line of macro value
50
+    local xline     # expanded line
51
+    xline=$line
50 52
     for mname in "${!MacroMap[@]}"; do
51 53
         if ! test "${line//$mname}" == "$line"; then
52
-            while IFS= read -r mvline; do
53
-                echo "${line//$mname/$mvline}"
54
-            done <<<"${MacroMap[$mname]}"
55
-            return 0
54
+            xline=$(
55
+                while IFS= read -r mvline; do
56
+                    echo "${line//$mname/$mvline}"
57
+                done <<<"${MacroMap[$mname]}"
58
+            )
56 59
         fi
60
+        line=$xline
57 61
     done
58
-    echo "$line"
62
+    echo "$xline"
59 63
     return 1
60 64
 }
61 65
 

+ 17
- 9
utils/mkit/include/facts.sh Parādīt failu

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

+ 0
- 1
utils/mkit/include/ini.sh Parādīt failu

@@ -79,7 +79,6 @@ __ini_grepsec() {
79 79
     local ok=false      # are we in the section?
80 80
     local line          # each input line
81 81
     grep '.' \
82
-      | grep -v '\s*#' \
83 82
       | while read -r line; do
84 83
             case "$line" in
85 84
                 \[$wnt\]) ok=true;  continue ;;

+ 17
- 1
utils/mkit/include/vars.sh Parādīt failu

@@ -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.31
77
+MKIT_VERSION=0.0.33