forked from hendriktews/proof-tree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-release
More file actions
executable file
·249 lines (171 loc) · 4.74 KB
/
make-release
File metadata and controls
executable file
·249 lines (171 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/bin/bash
#set -x
set -e
commit_changes="yes"
#commit_changes="no"
function usage(){
echo "usage: make-release [-nochanges]"
exit 1
}
while [ $# \!= 0 ]; do
case $1 in
-nochanges) commit_changes="no";
shift;;
*) echo `basename $0` : unknown option $1;
usage;
shift;;
esac;
done
timestamp=$(date '+%Y-%m-%d')
dir="prooftree-$timestamp"
webdir=/home/tews/www/alfa-www/askra-root/software/prooftree
version=$(cat version.txt)
if [ $commit_changes = "yes" ] ; then
echo
echo recent change end marker in changes.html on the right spot??
echo Prepare changes.html for commit?
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
commit_changes="no"
fi
fi
if [ $commit_changes = "yes" ] ; then
sed -i.$(date +%s)~ \
-e "s/^<DT>XXXX-XX-XX/<DT>$timestamp: Prooftree $version released/" \
changes.html
message="prepare changes.html for release"
cat - ChangeLog > newchangelog <<EOF
$(date +%Y-%m-%d) Hendrik Tews <prooftree@askra.de>
* $message
EOF
mv newchangelog ChangeLog
git status
git diff
echo
echo Commit and copy patched [recent-]changes.html :
echo git commit -a -m "$message" ?
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
exit 0
fi
git commit -a -m "$message"
cp changes.html $webdir
sed -n -e '/RECENT CHANGES START/,/RECENT CHANGES END/p' \
< changes.html > $webdir/recent-changes.html
fi
#######################################################################
# make source and bin package
rm -f prooftree.man.html
make prooftree.man.html
branch=$(git branch | awk '/\*/ {print $2;}')
if [ $branch = '(none)' ] ; then
branch=master
fi
echo using branch $branch
tmpdir=/tmp/tews
name="prooftree-$version"
rm -rf $tmpdir/$name*
git archive --format=tar --prefix=$name/ $branch | (cd $tmpdir; tar -xf - )
filestocopy="prooftree.man.html"
for f in $filestocopy ; do
cp $f $tmpdir/$name/$f
done
pushd $tmpdir
tar -czf $name.tar.gz $name
popd
builddir="$tmpdir/test-prooftree"
rm -rf $builddir
mkdir -p $builddir
pushd $builddir
tar -xzf $tmpdir/$name.tar.gz
cd $name
set -x
./configure --prefix $builddir/install
set +x
make
if [ $? = 0 ] ; then
echo =====================================================================
echo ========= COMPILATION TEST PASSED
echo =====================================================================
else
echo =====================================================================
echo ========= COMPILATION TEST FAILED
echo =====================================================================
exit 1
fi
popd
echo
echo copy prooftree.man.html $name.tar.gz
echo to $webdir
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
exit 0
fi
cp prooftree.man.html $webdir
cp $tmpdir/$name.tar.gz $webdir/releases
release_tag=prooftree-release-$(echo $version | sed -e 's/\./-/g')
echo
echo Fix source download links in website ?
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
exit 0
fi
oldlink=$(sed -n -e '/LATEST VERSION LINK/ {s/<![^>]*>//
s/\[prooftree-//
s/.tar.gz\]//
s/>$/>,/
p
}' < $webdir/index.shtml)
tgzfile="$name.tar.gz"
newlink="<!-- LATEST VERSION LINK --><A HREF=\"releases/$tgzfile\">[$tgzfile]<\\/A>"
cp $webdir/index.shtml $webdir/index.shtml.$(date +%s)~
sed -e "/LATEST VERSION LINK/ c$newlink" \
-e "/^<P>Previous versions:/ {p
c$oldlink
}" \
-e "/UPDATE VERSION/ s/prooftree_[^-]*-/prooftree_$version-/" \
< $webdir/index.shtml > $webdir/indexnew.shtml
#diff -u $webdir/index.shtml $webdir/indexnew.shtml
#exit 0
mv $webdir/indexnew.shtml $webdir/index.shtml
git tag $release_tag
echo
echo Upload website?
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
exit 0
fi
/home/tews/www/update-sys -web
echo
echo bump version number?
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
exit 0
fi
pt_old_version=$(sed -e 's/0\.//' < version.txt)
pt_version=$(($pt_old_version + 1))
cp version.txt version.txt.$(date +%s)~
echo 0.$pt_version > version.txt
releasetime=$(TZ=UTC date '+%Y-%m-%d %H:%M:%S %Z')
message="release version 0.$pt_old_version on $releasetime"
cat - ChangeLog > newchangelog <<EOF
$(date +%Y-%m-%d) Hendrik Tews <prooftree@askra.de>
* $message
EOF
mv newchangelog ChangeLog
git status
git diff
echo
echo git commit -a -m "$message" ??
echo -n [Y/n]?
read answer
if [ ${answer:=y} = n -o $answer = N ] ; then
exit 0
fi
git commit -a -m "$message"