Browse Source

Update MKit to v0.0.40

Alois Mahdal 4 years ago
parent
commit
ce4c42a9dc
3 changed files with 25 additions and 2 deletions
  1. 2
    0
      utils/mkit/include/build.sh
  2. 22
    1
      utils/mkit/include/facts.sh
  3. 1
    1
      utils/mkit/include/vars.sh

+ 2
- 0
utils/mkit/include/build.sh View File

@@ -80,6 +80,7 @@ __expand_macros() {
80 80
     MacroMap[__MKIT_PROJ_MAINTAINER__]=$(ini 1value project:maintainer)
81 81
     MacroMap[__MKIT_PROJ_VCS_BROWSER__]=$(ini 1value project:vcs_browser)
82 82
     MacroMap[__MKIT_PROJ_GIT_LASTHASH__]=$(__cached git_lasthash)
83
+    MacroMap[__MKIT_PROJ_GIT_LASTSUMMARY__]=$(__cached git_lastsummary)
83 84
     MacroMap[__MKIT_PROJ_VERSION__]=$(__cached semver)
84 85
     for section in "$@"; do
85 86
         for mname in $(ini lskeys "$section"); do
@@ -185,6 +186,7 @@ _mkit_data() {
185 186
         echo "  x_MKIT_PROJ_MAINTAINER__ => '__MKIT_PROJ_MAINTAINER__'"
186 187
         echo "  x_MKIT_PROJ_VCS_BROWSER__ => '__MKIT_PROJ_VCS_BROWSER__'"
187 188
         echo "  x_MKIT_PROJ_GIT_LASTHASH__ => '__MKIT_PROJ_GIT_LASTHASH__'"
189
+        echo "  x_MKIT_PROJ_GIT_LASTSUMMARY__ => '__MKIT_PROJ_GIT_LASTSUMMARY__'"
188 190
         echo "  x_MKIT_PROJ_VERSION__ => '__MKIT_PROJ_VERSION__'"
189 191
         for section in "${sections[@]}"; do
190 192
             echo "$section:"

+ 22
- 1
utils/mkit/include/facts.sh View File

@@ -103,6 +103,27 @@ git_lasthash() {
103 103
     git_bool dirty && echo -n ".dirty"
104 104
 }
105 105
 
106
+git_lastsummary() {
107
+    #
108
+    # Show last commit summary
109
+    #
110
+    # We can't do it outside git repo (or without git) but we should
111
+    # not be asked to; targets that don't require git should make use
112
+    # of cache built by dist target.
113
+    #
114
+    git_present || {
115
+        echo UNKNOWN_SUMMARY
116
+        warn "no git present; could not determine last summary"
117
+        return 3
118
+    }
119
+    git_bool dirty && {
120
+        echo "(index is dirty)"
121
+        return
122
+    }
123
+    git log -1 --format=oneline HEAD \
124
+      | cut -d' ' -f2-
125
+}
126
+
106 127
 semver() {
107 128
     #
108 129
     # Build proper SemVer version string
@@ -171,7 +192,7 @@ semver() {
171 192
     if ! git describe --tags --exact-match HEAD >&/dev/null;
172 193
     then    # we are at a later commit than the last tag
173 194
         is_tagged=F
174
-        brname=$(git_fact current_branch)
195
+        brname=$(git_fact current_branch | sed 's/[^[:alnum:]]/_/g')
175 196
         ghash=$(git_fact latest_sha)
176 197
     fi
177 198
     git_bool dirty && is_dirty=T

+ 1
- 1
utils/mkit/include/vars.sh View File

@@ -86,4 +86,4 @@ MKIT_TSTAMP=${MKIT_TSTAMP:-ctime}
86 86
 #
87 87
 # This MKit version
88 88
 #
89
-MKIT_VERSION=0.0.39
89
+MKIT_VERSION=0.0.40