|
@@ -1,6 +1,6 @@
|
1
|
1
|
#!/bin/bash
|
2
|
2
|
|
3
|
|
-__die_if() {
|
|
3
|
+_die_if() {
|
4
|
4
|
#
|
5
|
5
|
# Die if blocking condition $1 is detected
|
6
|
6
|
#
|
|
@@ -13,7 +13,7 @@ __die_if() {
|
13
|
13
|
;;
|
14
|
14
|
norelbr)
|
15
|
15
|
local relsrc=$(ini 1value project:relsrc)
|
16
|
|
- __git_info curbranch \
|
|
16
|
+ _git_info curbranch \
|
17
|
17
|
| grep -qFx "$relsrc" \
|
18
|
18
|
|| die "you are not on release source branch: $relsrc"
|
19
|
19
|
;;
|
|
@@ -23,7 +23,7 @@ __die_if() {
|
23
|
23
|
&& die "tree is dirty: $dirt"
|
24
|
24
|
;;
|
25
|
25
|
novertag)
|
26
|
|
- __git_info lasttag \
|
|
26
|
+ _git_info lasttag \
|
27
|
27
|
| grep -q . \
|
28
|
28
|
|| die "cannot find last tag"
|
29
|
29
|
;;
|
|
@@ -33,20 +33,20 @@ __die_if() {
|
33
|
33
|
|| die "last change must be version bump in mkit.ini"
|
34
|
34
|
;;
|
35
|
35
|
wip)
|
36
|
|
- __git_info reldiff \
|
|
36
|
+ _git_info reldiff \
|
37
|
37
|
| grep '^....... WIP ' \
|
38
|
|
- && die "WIP commit since $(__git_info lasttag)"
|
|
38
|
+ && die "WIP commit since $(_git_info lasttag)"
|
39
|
39
|
;;
|
40
|
40
|
old_c)
|
41
|
|
- x=$(__ver_info nextver_g)
|
42
|
|
- __ver_info currver_c \
|
|
41
|
+ x=$(_ver_info nextver_g)
|
|
42
|
+ _ver_info currver_c \
|
43
|
43
|
| grep -qFx "$x" \
|
44
|
44
|
|| die "new version not in mkit.ini: $x"
|
45
|
45
|
;;
|
46
|
46
|
esac
|
47
|
47
|
}
|
48
|
48
|
|
49
|
|
-__git_info() {
|
|
49
|
+_git_info() {
|
50
|
50
|
#
|
51
|
51
|
# Get git info $1
|
52
|
52
|
#
|
|
@@ -54,24 +54,24 @@ __git_info() {
|
54
|
54
|
case "$info" in
|
55
|
55
|
lasttag) git tag | grep ^v | sort -V | tail -n1 ;;
|
56
|
56
|
curbranch) git rev-parse --abbrev-ref HEAD ;;
|
57
|
|
- reldiff) git log --oneline "$(__git_info lasttag)..HEAD" --name-only ;;
|
|
57
|
+ reldiff) git log --oneline "$(_git_info lasttag)..HEAD" --name-only ;;
|
58
|
58
|
esac
|
59
|
59
|
}
|
60
|
60
|
|
61
|
|
-__ver_info() {
|
|
61
|
+_ver_info() {
|
62
|
62
|
#
|
63
|
63
|
# Get git info $1
|
64
|
64
|
#
|
65
|
65
|
local info="$1"
|
66
|
66
|
case "$info" in
|
67
|
|
- lastver_g) __git_info lasttag | sed s/^v// ;;
|
68
|
|
- nextver_g) __make_ver "$level" "$(__ver_info lastver_g)" ;;
|
|
67
|
+ lastver_g) _git_info lasttag | sed s/^v// ;;
|
|
68
|
+ nextver_g) _make_ver "$level" "$(_ver_info lastver_g)" ;;
|
69
|
69
|
currver_c) ini 1value project:version ;;
|
70
|
|
- nextver_c) __make_ver "$level" "$(__ver_info currver_c)" ;;
|
|
70
|
+ nextver_c) _make_ver "$level" "$(_ver_info currver_c)" ;;
|
71
|
71
|
esac
|
72
|
72
|
}
|
73
|
73
|
|
74
|
|
-__make_ver() {
|
|
74
|
+_make_ver() {
|
75
|
75
|
local level=$1
|
76
|
76
|
local old=$2
|
77
|
77
|
local oldx=${old%.*.*}
|
|
@@ -87,7 +87,7 @@ __make_ver() {
|
87
|
87
|
echo "$new"
|
88
|
88
|
}
|
89
|
89
|
|
90
|
|
-__release() {
|
|
90
|
+_release() {
|
91
|
91
|
#
|
92
|
92
|
# Prepare release
|
93
|
93
|
#
|
|
@@ -100,15 +100,15 @@ __release() {
|
100
|
100
|
local level=$1
|
101
|
101
|
local newtag
|
102
|
102
|
|
103
|
|
- __die_if nogit
|
104
|
|
- __die_if norelbr
|
105
|
|
- __die_if dirty
|
106
|
|
- __die_if novertag
|
107
|
|
- __die_if nobump
|
108
|
|
- __die_if wip
|
109
|
|
- __die_if old_c
|
|
103
|
+ _die_if nogit
|
|
104
|
+ _die_if norelbr
|
|
105
|
+ _die_if dirty
|
|
106
|
+ _die_if novertag
|
|
107
|
+ _die_if nobump
|
|
108
|
+ _die_if wip
|
|
109
|
+ _die_if old_c
|
110
|
110
|
|
111
|
|
- newtag=v$(__ver_info nextver_g)
|
|
111
|
+ newtag=v$(_ver_info nextver_g)
|
112
|
112
|
set -e
|
113
|
113
|
debug_var newtag
|
114
|
114
|
$MKIT_DRY && return
|
|
@@ -116,12 +116,12 @@ __release() {
|
116
|
116
|
git branch -f "$(ini 1value project:reldst)" "$newtag"
|
117
|
117
|
}
|
118
|
118
|
|
119
|
|
-__git_msg_vbump() {
|
|
119
|
+_git_msg_vbump() {
|
120
|
120
|
echo "Bump version"
|
121
|
121
|
echo ""
|
122
|
122
|
echo "Overview of changes:"
|
123
|
123
|
echo ""
|
124
|
|
- __git_info reldiff \
|
|
124
|
+ _git_info reldiff \
|
125
|
125
|
| sed '
|
126
|
126
|
s/^[a-f0-9]\{7\} / * &/; t PATHS
|
127
|
127
|
s/^/ /
|
|
@@ -129,44 +129,44 @@ __git_msg_vbump() {
|
129
|
129
|
'
|
130
|
130
|
}
|
131
|
131
|
|
132
|
|
-__vbump() {
|
|
132
|
+_vbump() {
|
133
|
133
|
local level="$1"
|
134
|
134
|
local lastver # current from mkit.ini
|
135
|
135
|
local nextver # after the bump
|
136
|
|
- __die_if nogit
|
137
|
|
- __die_if norelbr
|
138
|
|
- __die_if dirty
|
139
|
|
- lastver=$(__ver_info currver_c)
|
140
|
|
- nextver=$(__ver_info nextver_c)
|
|
136
|
+ _die_if nogit
|
|
137
|
+ _die_if norelbr
|
|
138
|
+ _die_if dirty
|
|
139
|
+ lastver=$(_ver_info currver_c)
|
|
140
|
+ nextver=$(_ver_info nextver_c)
|
141
|
141
|
debug_var lastver nextver
|
142
|
142
|
$MKIT_DRY && return
|
143
|
143
|
update_version "$nextver" mkit.ini \
|
144
|
144
|
|| die "failed to update version in mkit.ini"
|
145
|
145
|
git add mkit.ini \
|
146
|
146
|
|| die "failed to add mkit.ini to the index"
|
147
|
|
- git commit -e -m "$(__git_msg_vbump)"
|
|
147
|
+ git commit -e -m "$(_git_msg_vbump)"
|
148
|
148
|
}
|
149
|
149
|
|
150
|
150
|
vbump_x() {
|
151
|
|
- __vbump x
|
|
151
|
+ _vbump x
|
152
|
152
|
}
|
153
|
153
|
|
154
|
154
|
vbump_y() {
|
155
|
|
- __vbump y
|
|
155
|
+ _vbump y
|
156
|
156
|
}
|
157
|
157
|
|
158
|
158
|
vbump_z() {
|
159
|
|
- __vbump z
|
|
159
|
+ _vbump z
|
160
|
160
|
}
|
161
|
161
|
|
162
|
162
|
release_x() {
|
163
|
|
- __release x
|
|
163
|
+ _release x
|
164
|
164
|
}
|
165
|
165
|
|
166
|
166
|
release_y() {
|
167
|
|
- __release y
|
|
167
|
+ _release y
|
168
|
168
|
}
|
169
|
169
|
|
170
|
170
|
release_z() {
|
171
|
|
- __release z
|
|
171
|
+ _release z
|
172
|
172
|
}
|