Kaynağa Gözat

Don't use hexadecimal "timestamps"

Hexadecimals were used to save few characters, but it turns out that
while lexical sort should be fine, in version modes they do tend to
sort in strange ways (eg. `t5af5e80a < t5af5e800` in rpm).
Alois Mahdal 6 yıl önce
ebeveyn
işleme
28c4b19e49
2 değiştirilmiş dosya ile 15 ekleme ve 6 silme
  1. 2
    2
      src/include/facts.sh
  2. 13
    4
      src/include/vars.sh.skel

+ 2
- 2
src/include/facts.sh Dosyayı Görüntüle

@@ -140,12 +140,12 @@ semver() {
140 140
     local latest_tag    # latest git tag
141 141
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
142 142
     local dirty=F       # F if dirty, T if clean
143
-    local btime         # hex timestamp or nothing (see $MKIT_TTAG)
143
+    local btime         # timestamp or nothing (see $MKIT_TTAG)
144 144
     local suffix        # version suffix
145 145
     prerl=$(ini 1value project:prerl)
146 146
     case $MKIT_TTAG in
147 147
         none)   btime= ;;
148
-        btime)  btime=$(printf '%08x' "$(date +%s)") ;;
148
+        btime)  btime=$(date -u +%Y%m%d%H%M%S) ;;
149 149
     esac
150 150
     grep ":" <<<"$prerl" \
151 151
      && warn "colon in project:prerl may corrupt version data: $prerl"

+ 13
- 4
src/include/vars.sh.skel Dosyayı Görüntüle

@@ -60,10 +60,19 @@ MKIT_PROJ_PKGNAME=""
60 60
 #
61 61
 # Can be 'none' or 'btime'.
62 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).
63
+# If 'btime', 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.
67
+#
68
+# This helps with deploying development builds where packaging system
69
+# is not SemVer-compliant and makes it hard to install arbitrary version.
70
+# For example, old yum version (as of RHEL-6) will not let you install
71
+# version that it deems older than is installed, making it hard to
72
+# continually upgrade during active development.  While packaging
73
+# systems have their own rukes (and SemVer says both versions should be
74
+# considered same) this tag will make it more likely to "win" the build
75
+# you made later.
67 76
 #
68 77
 # Note that this makes devel and dirty builds non-deterministic,
69 78
 # but does not affect clean builds (ie. builds from clean repo