Procházet zdrojové kódy

Update own dogfood

Alois Mahdal před 7 roky
rodič
revize
ef109f9089

+ 43
- 34
utils/mkit/include/build.sh Zobrazit soubor

@@ -6,11 +6,11 @@
6 6
 
7 7
 _build1() {
8 8
     #
9
-    # Process one skeleton
9
+    # Process one skeleton $1 of type $3 (or guessed) to path $2
10 10
     #
11
-    local srcpath="$1"
12
-    local dstpath="$2"
13
-    local ftype="$3"
11
+    local srcpath=$1    # skeleton path
12
+    local dstpath=$2    # destination meaty animal path
13
+    local ftype=$3      # file/builder type
14 14
     test -n "$dstpath"  || dstpath=${srcpath%.skel}
15 15
     test -n "$ftype"    || ftype=$(_guess_ftype "$dstpath")
16 16
     debug_var srcpath dstpath ftype
@@ -21,13 +21,14 @@ _build1() {
21 21
 
22 22
 _build1_ftype() {
23 23
     #
24
-    # Build a file of type $1
24
+    # Build a file of type $1; fom stdin to stdout
25 25
     #
26
-    local ftype="$1"
26
+    local ftype=$1      # file/builder type
27 27
     case $ftype in
28 28
         MKIT_COMMON)    _expand_tokens "tokens" ;;
29 29
         markdown)       _expand_includes | _expand_tokens "tokens" ;;
30 30
         rpmstuff)       _expand_tokens "tokens" "rpmstuff:tokens" ;;
31
+        debstuff)       _expand_tokens "tokens" "debstuff:tokens" ;;
31 32
         *)              die "unknown file type: $ftype" ;;
32 33
     esac
33 34
 }
@@ -59,17 +60,18 @@ _expand_includes() {
59 60
 
60 61
 _expand_tokens() {
61 62
     #
62
-    # Expand tokens from sections $@
63
+    # Read stdin, expanding tokens from sections $@
63 64
     #
64
-    local script=$(mktemp --tmpdir mkit-tmp.XXXXXXXXXX)
65
-    local section varname varvalue
65
+    local script        # sed script cache
66
+    local section       # each section to expand tokens from
67
+    local varname       # each token name
68
+    local varvalue      # each token value
69
+    script=$(mktemp --tmpdir mkit-tmp.XXXXXXXXXX)
66 70
     {
67
-        for section in "$@";
68
-        do
71
+        for section in "$@"; do
69 72
             debug_var section
70 73
             ini lskeys "$section" \
71
-              | while read varname;
72
-                do
74
+              | while read -r varname; do
73 75
                     varvalue="$(ini 1value "$section:$varname" | _qfs )"
74 76
                     echo "s|$varname|$varvalue|g;"
75 77
                     debug_var varname varvalue
@@ -93,7 +95,7 @@ _guess_ftype() {
93 95
     #
94 96
     # Guess file type from destination path $1
95 97
     #
96
-    local dstpath="$1"
98
+    local dstpath=$1    # destination path
97 99
     case $dstpath in
98 100
         *.md) echo markdown    ;;
99 101
         *)    echo MKIT_COMMON ;;
@@ -114,21 +116,22 @@ build() {
114 116
     #
115 117
     # Add meat to all skeletons
116 118
     #
117
-    local srcpath
119
+    local srcpath   # each source path
118 120
     find -type f -name '*.skel' \
119
-     | while read srcpath;
120
-       do
121
+     | while read -r srcpath; do
121 122
            _build1 "$srcpath"
122 123
        done
123 124
 }
124 125
 
125 126
 build_manpages() {
126
-    local manfile mdfile
127
-    if command -v ronn >/dev/null;
128
-    then
127
+    #
128
+    # Build manpages using ronn
129
+    #
130
+    local manfile   # each manual file listed in '[files:man]'
131
+    local mdfile    # each source markdown file
132
+    if command -v ronn >/dev/null; then
129 133
         ini lskeys "files:man" \
130
-          | while read manfile;
131
-            do
134
+          | while read -r manfile; do
132 135
                 mdfile="$manfile.md"
133 136
                 ronn -r "$mdfile"
134 137
                 mkdir -p "$MKIT_LOCAL"
@@ -157,7 +160,11 @@ debstuff() {
157 160
     #
158 161
     # Build Debian stuff (eamed tarball, debian dir)
159 162
     #
160
-    local version="$(semver)"
163
+    local version       # package version
164
+    local debian_skel   # 'debian' folder skeleton
165
+    local dfsrc         # each source file from ^^
166
+    local dftgt         # each built packaging file
167
+    version=$(semver)
161 168
 
162 169
     # tarball - we should already have by means of 'dist'
163 170
     #
@@ -168,17 +175,15 @@ debstuff() {
168 175
 
169 176
     # read content of each mandatory file from debian_skel
170 177
     #
171
-    local debian_skel=$(ini 1value dist:debstuff)
178
+    debian_skel=$(ini 1value dist:debstuff)
172 179
     test -n "$debian_skel" || die "dist:debstuff not specified"
173 180
     test -d "$debian_skel" || die "debian directory template found: $debian_skel"
174 181
     mkdir -p debian/source
175
-    local dfsrc dftgt
176 182
     find "$debian_skel" -type f \
177
-      | while read dfsrc;
178
-        do
183
+      | while read -r dfsrc; do
179 184
             dftgt="debian/${dfsrc#$debian_skel}"
180 185
             mkdir -p "$(dirname "$dftgt")"
181
-            _build1 "$dfsrc" "$dftgt"
186
+            _build1 "$dfsrc" "$dftgt" debstuff
182 187
         done
183 188
     echo debian >> "$MKIT_LOCAL/built.lst"
184 189
 }
@@ -190,9 +195,12 @@ dist() {
190 195
     #FIXME: lacking Makefile skills, we do this step twice fot
191 196
     #       rpmstuff, hence -f hack for gzip
192 197
     #
193
-    local version=$(semver)
194
-    local git_lasthash=$(git_lasthash)
195
-    local dirname=$MKIT_PROJ_PKGNAME-$version
198
+    local version           # tarball version
199
+    local git_lasthash      # last git commit hash
200
+    local dirname           # directory and tarball name
201
+    version=$(semver)
202
+    dirname=$MKIT_PROJ_PKGNAME-$version
203
+    git_lasthash=$(git_lasthash)
196 204
     mkdir -p "$dirname"
197 205
     ini values "dist:tarball" | xargs -I DIST_ITEM cp -R DIST_ITEM "$dirname"
198 206
     update_version "$version" "$dirname/mkit.ini"
@@ -209,9 +217,10 @@ rpmstuff() {
209 217
     #
210 218
     # Build specfile
211 219
     #
212
-    local specname="$MKIT_PROJ_PKGNAME.spec"
213
-    local specsrc="$(ini 1value "dist:rpmstuff")"
220
+    local specname=$MKIT_PROJ_PKGNAME.spec      # .spec filename
221
+    local specsrc                               # source of specfile
222
+    specsrc="$(ini 1value "dist:rpmstuff")"
214 223
     test -n "$specsrc" || die "dist:rpmstuff not specified"
215 224
     test -f "$specsrc" || die "specfile template not found: $specsrc"
216
-    _build1 "$specsrc" "$specname"
225
+    _build1 "$specsrc" "$specname" rpmstuff
217 226
 }

+ 25
- 23
utils/mkit/include/deploy.sh Zobrazit soubor

@@ -23,16 +23,15 @@ _deploy_item() {
23 23
     # Directories are copied recursively, and mode is
24 24
     # applied only to files.
25 25
     #
26
-    local src="$1"
27
-    local dst="$2"
28
-    local mode="${3:-$MKIT_DEFAULT_MODE}"
29
-    if test -d "$src";
30
-    then
26
+    local src=$1                            # source path
27
+    local dst=$2                            # destination path
28
+    local mode=${3:-$MKIT_DEFAULT_MODE}     # mode
29
+    local chmod_item                        # each file to chmod in directory
30
+    if test -d "$src"; then
31 31
         _maybe mkdir -vp "$(dirname "$dst")"
32 32
         _maybe cp -Tvr "$src" "$dst"
33 33
         find "$dst" -type f \
34
-          | while read chmod_item;
35
-            do
34
+          | while read -r chmod_item; do
36 35
                 _maybe chmod "$mode" "$chmod_item"
37 36
             done
38 37
     else
@@ -44,9 +43,9 @@ _get_dst() {
44 43
     #
45 44
     # Find out target path for src file $2 of group $1
46 45
     #
47
-    local grp=$1
48
-    local src=$2
49
-    local dst=$3
46
+    local grp=$1        # deploy group
47
+    local src=$2        # each source
48
+    local dst=$3        # alternative destination name
50 49
     test -n "$dst" || dst=${src##*/}
51 50
     echo "$(_get_root "$grp")/$dst"
52 51
 }
@@ -55,9 +54,11 @@ _get_root() {
55 54
     #
56 55
     # Find out target root for group $1
57 56
     #
58
-    local grp="$1"
59
-    local root=$(ini 1value "roots:$grp")
60
-    local destdir=$(ini 1value ENV:DESTDIR)
57
+    local grp=$1        # deploy group
58
+    local root          # root for this group
59
+    local destdir       # value of DESTDIR
60
+    root=$(ini 1value "roots:$grp")
61
+    destdir=$(ini 1value ENV:DESTDIR)
61 62
     destdir=${destdir%/}
62 63
     case $destdir:$root in
63 64
         *:)     die "missing in config.ini: roots:$grp" ;;
@@ -84,16 +85,17 @@ install() {
84 85
     #
85 86
     # Install product
86 87
     #
87
-    local dst group mode src
88
+    local group     # each deploy group
89
+    local mode      # mode (group-specific)
90
+    local src       # each source path
91
+    local dst       # each (final absolute) destination path
88 92
     ini lskeys "files" \
89 93
       | sort \
90 94
       | uniq \
91
-      | while read group;
92
-        do
95
+      | while read -r group; do
93 96
             mode=$(ini 1value "modes:$group")
94 97
             ini values "files:$group" \
95
-              | while read src dst;
96
-                do
98
+              | while read -r src dst; do
97 99
                     dst=$(_get_dst "$group" "$src" "$dst")
98 100
                     _deploy_item "$src" "$dst" "$mode"
99 101
                 done
@@ -106,15 +108,15 @@ uninstall() {
106 108
     #
107 109
     # Uninstall product
108 110
     #
109
-    local dst group src
111
+    local group     # each deploy group
112
+    local src       # each source path
113
+    local dst       # each (final absolute) destination path
110 114
     ini lskeys "files" \
111 115
       | sort \
112 116
       | uniq \
113
-      | while read group;
114
-        do
117
+      | while read -r group; do
115 118
             ini values "files:$group" \
116
-              | while read src dst;
117
-                do
119
+              | while read -r src dst; do
118 120
                     dst=$(_get_dst "$group" "$src" "$dst")
119 121
                     _maybe rm -vrf "$dst"
120 122
                 done

+ 18
- 13
utils/mkit/include/facts.sh Zobrazit soubor

@@ -6,7 +6,7 @@ git_bool() {
6 6
     #
7 7
     # Get git bool (ie. exit status counts) $1
8 8
     #
9
-    local bool_name="$1"
9
+    local bool_name=$1      # name of boolean to get
10 10
     git_present || warn "can't give bool outside git repo: $bool_name"
11 11
     case "$bool_name" in
12 12
         dirty_files)
@@ -29,7 +29,7 @@ git_fact() {
29 29
     #
30 30
     # Get git fact $1
31 31
     #
32
-    local fact_name="$1"
32
+    local fact_name=$1      # name of fact to get
33 33
     git_present || warn "can't give fact outside git repo: $fact_name"
34 34
     case "$fact_name" in
35 35
         latest_tag)
@@ -88,9 +88,9 @@ git_lasthash() {
88 88
     # work if you got outside the git repo in other way than dist
89 89
     # target, but that's actually expected.)
90 90
     #
91
-    if git_present;
92
-    then    # we are in git repo
93
-        local last_hash=$(git rev-parse HEAD)
91
+    local last_hash     # last commit hash
92
+    if git_present; then    # we are in git repo
93
+        last_hash=$(git rev-parse HEAD)
94 94
         echo -n "$last_hash"
95 95
         git_bool dirty && echo -n ".dirty"
96 96
     else    # we are outside (eg. distributor's build dir')
@@ -146,18 +146,23 @@ semver() {
146 146
     # FIXME:  Using project:prerl for release IDs may not be compatible with
147 147
     #         release strategy implemented in release.sh
148 148
     #
149
-    local version=$(ini 1value project:version)
150
-    local prerl=$(ini 1value project:prerl)
151
-    grep ":" <<<"$prerl" && warn "colon in project:prerl may corrupt version data: $prerl"
149
+    local version       # version string (final result)
150
+    local prerl         # pre-release keyword (from mkit.ini, eg. 'alpha')
151
+    local latest_tag    # latest git tag
152
+    local commit        # commit indicator (CURRENT_BRANCH.gHASH)
153
+    local dirty         # 0 if dirty, 1 if clean
154
+    local suffix        # version suffix
155
+    version=$(ini 1value project:version)
156
+    prerl=$(ini 1value project:prerl)
157
+    grep ":" <<<"$prerl" \
158
+     && warn "colon in project:prerl may corrupt version data: $prerl"
152 159
     if git_present;
153 160
     then    # we are in git repo... so we can get smart
154
-        local latest_tag=$(git_fact latest_tag)
161
+        latest_tag=$(git_fact latest_tag)
155 162
         if ! git describe --tags --exact-match HEAD >&/dev/null;
156 163
         then    # we are at a later commit than the last tag
157
-            local commit="$(git_fact current_branch).g$(git_fact latest_sha)"
164
+            commit="$(git_fact current_branch).g$(git_fact latest_sha)"
158 165
         fi
159
-        local dirty=""
160
-        local suffix=""
161 166
         git_bool dirty; dirty=$?
162 167
         test -n "$latest_tag" && version=${latest_tag:1}
163 168
         case "$dirty:$commit" in
@@ -165,7 +170,7 @@ semver() {
165 170
             0:)  suffix="+dirty"         ;;
166 171
             1:*) suffix="+$commit"       ;;
167 172
             0:*) suffix="+$commit.dirty" ;;
168
-            *)   suffix=MKIT_BUG;
173
+            *)   suffix=MKIT_BUG
169 174
                  warn "MKIT_BUG: bad dirt/commit detection" ;;
170 175
         esac
171 176
         test -n "$prerl" && suffix="-$prerl$suffix"

+ 31
- 31
utils/mkit/include/ini.sh Zobrazit soubor

@@ -4,8 +4,8 @@ _ini_cat() {
4 4
     #
5 5
     # A no-op for text stream
6 6
     #
7
-    while read line;
8
-    do
7
+    local line      # each line
8
+    while read -r line; do
9 9
         printf -- "%s\n" "$line"
10 10
     done
11 11
 }
@@ -14,9 +14,11 @@ _ini_expand() {
14 14
     #
15 15
     # Expand reference value (prefix only)
16 16
     #
17
-    local line suffix ref value
18
-    while read line;                        # [foo:bar]/path
19
-    do
17
+    local line      # each input line
18
+    local suffix    # tail of the line
19
+    local ref       # reference
20
+    local value     # value if reference
21
+    while read -r line; do                  # [foo:bar]/path
20 22
         suffix="${line#\[*\]}"              # /path
21 23
         ref="${line%$suffix}"               # [foo:bar]
22 24
         ref="${ref%\]}"                     # [foo:bar
@@ -30,7 +32,7 @@ _ini_grepkey() {
30 32
     #
31 33
     # Read key from a section
32 34
     #
33
-    local wnt=$1
35
+    local wnt=$1    # wanted key
34 36
     grep '.' \
35 37
       | grep -v '\s*#' \
36 38
       | sed -e 's/ *= */=/; s/ +$//; s/^//;' \
@@ -48,17 +50,15 @@ _ini_greppath() {
48 50
     #     [files:share]
49 51
     #         my/lib.sh   = proj/my/lib.sh
50 52
     #
51
-    local wnt="$1"
52
-    local wntkey="${wnt##*:}"
53
-    local wntsec="${wnt%:$wntkey}"
54
-    if test "$wntsec" = 'ENV';
55
-    then
56
-        local override="${!wntkey}"
57
-        if test -n "$override";
58
-        then
59
-            echo "$override"
60
-            return
61
-        fi
53
+    local wnt=$1                    # wanted path
54
+    local wntkey=${wnt##*:}         # ^^ key part
55
+    local wntsec=${wnt%:$wntkey}    # ^^ section part
56
+    local override                  # ENV override (only ENV section)
57
+    if test "$wntsec" = 'ENV'; then
58
+        override=${!wntkey}
59
+        test -n "$override" \
60
+         && echo "$override" \
61
+         && return
62 62
     fi
63 63
     _ini_grepsec "$wntsec" | _ini_grepkey "$wntkey"
64 64
 }
@@ -67,12 +67,12 @@ _ini_grepsec() {
67 67
     #
68 68
     # Read one INI section
69 69
     #
70
-    local wnt="$1"
71
-    local ok=false
70
+    local wnt=$1        # wanted section name
71
+    local ok=false      # are we in the section?
72
+    local line          # each input line
72 73
     grep '.' \
73 74
       | grep -v '\s*#' \
74
-      | while read line;
75
-        do
75
+      | while read -r line; do
76 76
             case "$line" in
77 77
                 \[$wnt\]) ok=true;  continue ;;
78 78
                 \[*\])    ok=false; continue ;;
@@ -87,7 +87,7 @@ _ini_lskeys() {
87 87
     #
88 88
     # List keys from a section
89 89
     #
90
-    local sct="$1"
90
+    local sct=$1    # section of interest
91 91
     _ini_grepsec "$sct" | cut -d= -f1 | sort | uniq
92 92
 }
93 93
 
@@ -95,8 +95,7 @@ _ini_maybe_expand() {
95 95
     #
96 96
     # Decide whether or not to expand
97 97
     #
98
-    if test "$MKIT_INI_EXPAND" -gt 0;
99
-    then
98
+    if test "$MKIT_INI_EXPAND" -gt 0; then
100 99
         MKIT_INI_EXPAND=$(( --MKIT_INI_EXPAND )) _ini_expand
101 100
     else
102 101
         _ini_cat
@@ -107,10 +106,10 @@ ini() {
107 106
     #
108 107
     # do ini operation
109 108
     #
110
-    local op=$1
111
-    local arg=$2
112
-    local fn
113
-    local limit=_ini_cat
109
+    local op=$1             # operator
110
+    local arg=$2            # argument
111
+    local fn                # internal function implementing $op
112
+    local limit=_ini_cat    # limiting internal function
114 113
     case $op in
115 114
         lskeys) fn=_ini_lskeys   ;;
116 115
         sec)    fn=_ini_grepsec  ;;
@@ -125,9 +124,10 @@ update_version() {
125 124
     #
126 125
     # Change project.version in mkit.ini at path $2 to version $1
127 126
     #
128
-    local version="$1"
129
-    local inifile="$2"
130
-    local tmp=$(mktemp -t mkit.update_version.XXXXXXXX)
127
+    local version=$1    # new version
128
+    local inifile=$2    # mkit.ini path
129
+    local tmp           # mkit.ini cache
130
+    tmp=$(mktemp -t mkit.update_version.XXXXXXXX)
131 131
     <"$inifile" perl -e '
132 132
         my $hit = 0;
133 133
         my $done = 0;

+ 10
- 9
utils/mkit/include/mkit.sh Zobrazit soubor

@@ -38,9 +38,8 @@ debug_var() {
38 38
     # Print debug message
39 39
     #
40 40
     $MKIT_DEBUG || return 0
41
-    local __mkit_debug_var_name__
42
-    for __mkit_debug_var_name__ in "$@";
43
-    do
41
+    local __mkit_debug_var_name__       # variable name to debug
42
+    for __mkit_debug_var_name__ in "$@"; do
44 43
         {
45 44
             echo -n "MKIT_DEBUG: ${FUNCNAME[1]}():"
46 45
             echo -n " $__mkit_debug_var_name__"
@@ -65,8 +64,11 @@ _compver() {
65 64
     # If our x is 0, check first two fragments, otherwise check just
66 65
     # the x.  Fragments must equal.
67 66
     #
68
-    local their_ver our_x our_y their_x their_y
69
-    their_ver="$1"
67
+    local their_ver=$1      # their version
68
+    local our_x             # our X
69
+    local our_y             # our Y
70
+    local their_x           # their X
71
+    local their_y           # their Y
70 72
     their_x=${their_ver%%.*}
71 73
     their_y=${their_ver##$their_x.}
72 74
     their_y=${their_y%%.*}
@@ -89,8 +91,8 @@ _chkiniversion() {
89 91
     # Look for "#mkit version=0.0.0" or similar in first or last
90 92
     # 3 lines of the file; then check if the version is supported.
91 93
     #
92
-    local ver_line
93
-    local their_ver
94
+    local ver_line      # line declaring version
95
+    local their_ver     # the declared version
94 96
     ver_line=$(
95 97
         {
96 98
             head -3 "$MKIT_INI"
@@ -122,8 +124,7 @@ route() {
122 124
     #
123 125
     # Call correct function based on $1
124 126
     #
125
-    if _valid_targets | grep -qwx "^$1";
126
-    then
127
+    if _valid_targets | grep -qwx "^$1"; then
127 128
         "$1"
128 129
     else
129 130
         {

+ 51
- 21
utils/mkit/include/release.sh Zobrazit soubor

@@ -7,14 +7,18 @@ _bump_version() {
7 7
     #
8 8
     # Bump version on stdin by level $1 (x, y or z)
9 9
     #
10
-    local rlevel=$1
11
-    local old
10
+    local rlevel=$1     # release level
11
+    local old           # old version
12
+    local oldx          # ... X
13
+    local oldz          # ... Z
14
+    local oldy          # ... Y
15
+    local tmpy          # Y parsing cache
16
+    local new           # bumped version
12 17
     read -r old
13
-    local oldx=${old%.*.*}
14
-    local oldz=${old#*.*.}
15
-    local tmpy=${old%.*}
16
-    local oldy=${tmpy#*.}
17
-    local new=""
18
+    oldx=${old%.*.*}
19
+    oldz=${old#*.*.}
20
+    tmpy=${old%.*}
21
+    oldy=${tmpy#*.}
18 22
     case $rlevel in
19 23
         x) new="$((oldx+MKIT_BUMPSIZE)).0.0"            ;;
20 24
         y) new="$oldx.$((oldy+MKIT_BUMPSIZE)).0"        ;;
@@ -28,23 +32,23 @@ _relck() {
28 32
     #
29 33
     # Die if blocking condition $1 is detected
30 34
     #
31
-    local condition="$1"
32
-    local x
35
+    local condition=$1      # condition name
36
+    local oracle            # expected value
33 37
     case "$condition" in
34 38
         git_present)
35 39
             git rev-parse HEAD >&/dev/null\
36 40
              || die "cannot do this outside git repo"
37 41
             ;;
38 42
         at_relsrc)
39
-            local relsrc=$(ini 1value project:relsrc)
43
+            oracle=$(ini 1value project:relsrc)
40 44
             git_fact current_branch \
41
-              | grep -qFx "$relsrc" \
42
-             || die "you are not on release source branch: $relsrc"
45
+              | grep -qFx "$oracle" \
46
+             || die "you are not on release source branch: $oracle"
43 47
             ;;
44 48
         not_dirty)
45 49
             git diff --shortstat 2>/dev/null \
46 50
               | grep -q . \
47
-             && die "tree is dirty: $dirt"
51
+             && die "tree is dirty!"
48 52
             ;;
49 53
         tags_ok)
50 54
             git_fact latest_tag \
@@ -62,7 +66,7 @@ _relck() {
62 66
              && die "WIP commit since $(git_fact latest_tag)"
63 67
             ;;
64 68
         ini_version)
65
-            local oracle=$(git_fact latest_version | _bump_version "$rlevel")
69
+            oracle=$(git_fact latest_version | _bump_version "$rlevel")
66 70
             ini 1value project:version  \
67 71
               | grep -qFx "$oracle" \
68 72
              || die "new version not in mkit.ini: $oracle"
@@ -83,9 +87,9 @@ _release() {
83 87
     # FIXME: Using project:prerl as build.sh:semver() does may not be
84 88
     #        compatible with this release strategy
85 89
     #
86
-    local rlevel=$1
87
-    local newtag
88
-    local reldst
90
+    local rlevel=$1     # release level (x, y or z)
91
+    local newtag        # new tag
92
+    local reldst        # release destination branch (if any)
89 93
 
90 94
     _relck git_present
91 95
     _relck at_relsrc
@@ -103,8 +107,7 @@ _release() {
103 107
 
104 108
     reldst=$(ini 1value project:reldst)
105 109
     debug_var reldst
106
-    if test -n "$reldst";
107
-    then
110
+    if test -n "$reldst"; then
108 111
         git branch -f "$reldst" "$newtag"
109 112
     fi
110 113
 }
@@ -127,8 +130,14 @@ _release_msg() {
127 130
 }
128 131
 
129 132
 _vbump() {
130
-    local rlevel="$1"
131
-    local nextver   # after the bump
133
+    #
134
+    # Do version bump at level $1
135
+    #
136
+    # Perform checks, compute new version, update mkit.ini and initiate
137
+    # 'Bump version' commit with changelog template.
138
+    #
139
+    local rlevel=$1     # bump level (x, y or z)
140
+    local nextver       # version after the bump
132 141
     _relck git_present
133 142
     _relck at_relsrc
134 143
     _relck not_dirty
@@ -143,6 +152,9 @@ _vbump() {
143 152
 }
144 153
 
145 154
 _vbump_gitmsg() {
155
+    #
156
+    # Compose git message template for 'Bump version' commit
157
+    #
146 158
     echo "Bump version"
147 159
     echo ""
148 160
     echo "Overview of changes:"
@@ -156,25 +168,43 @@ _vbump_gitmsg() {
156 168
 }
157 169
 
158 170
 release_x() {
171
+    #
172
+    # Perform release on X level
173
+    #
159 174
     _release x
160 175
 }
161 176
 
162 177
 release_y() {
178
+    #
179
+    # Perform release on Y level
180
+    #
163 181
     _release y
164 182
 }
165 183
 
166 184
 release_z() {
185
+    #
186
+    # Perform release on Z level
187
+    #
167 188
     _release z
168 189
 }
169 190
 
170 191
 vbump_x() {
192
+    #
193
+    # Perform version bump on X level
194
+    #
171 195
     _vbump x
172 196
 }
173 197
 
174 198
 vbump_y() {
199
+    #
200
+    # Perform version bump on Y level
201
+    #
175 202
     _vbump y
176 203
 }
177 204
 
178 205
 vbump_z() {
206
+    #
207
+    # Perform version bump on Z level
208
+    #
179 209
     _vbump z
180 210
 }

+ 6
- 2
utils/mkit/make Zobrazit soubor

@@ -1,9 +1,13 @@
1 1
 #!/bin/bash
2
+#shellcheck disable=SC2034,SC1090
2 3
 # mkit - simple install helper
3 4
 # See LICENSE file for copyright and license details.
4 5
 
5 6
 die() {
6
-    echo "$@" && exit 9
7
+    #
8
+    # Poor man's die() (mkit.sh has better)
9
+    #
10
+    echo "$@" >&2 && exit 9
7 11
 }
8 12
 
9 13
 
@@ -66,7 +70,7 @@ MKIT_PROJ_PKGNAME=""
66 70
 #
67 71
 # This MKit version
68 72
 #
69
-MKIT_VERSION=0.0.18+devel.ga0af950
73
+MKIT_VERSION=0.0.19+devel.ge8a2332
70 74
 
71 75
 
72 76
 . "$MKIT_DIR/include/mkit.sh" || die "failed to init; check if MKIT_DIR is set properly: $MKIT_DIR"