-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnewversion
executable file
·79 lines (64 loc) · 1.54 KB
/
newversion
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
#!/bin/bash
# Automate the release process.
# Author: Jan wielemaker
#
# Usage: first update VERSION, then run this script.
function confirm ()
{ while true; do
echo -n "$1 "
read answer
case "$answer" in
y*) return 0
;;
n*) return 1
;;
*)
echo "Please answer yes or no"
;;
esac
done
}
version=`cat VERSION`
versiondate=`date +"%B %Y"`
vpat='\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\(-\([a-z0-9]*\)\)\{0,1\}'
major=$(echo $version | sed "s/$vpat/\1/")
minor=$(echo $version | sed "s/$vpat/\2/")
patch=$(echo $version | sed "s/$vpat/\3/")
vtag=$(echo $version | sed "s/$vpat/\5/")
# echo "major=$major minor=$minor patch=$patch tag=$vtag"
# exit 0
numversion=$(($major * 10000 + $minor * 100 + $patch))
vlong=${major}.${minor}.${patch}
if [ ! -z "$vtag" ]; then
vlong="$vlong-$vtag"
fi
tmp=.tmp$$
f=setup.py
sed -e "s/version=.*/version='$vlong',/" $f > $tmp
if cmp $f $tmp; then
rm -f $tmp
else
cat $tmp > $f
rm $tmp
echo "Updated version in $f"
fi
rm -f $tmp
f=janus/janus.py
sed -e "s/^version_num=.*/version_num=$numversion/" $f > $tmp
if cmp $f $tmp; then
rm -f $tmp
else
cat $tmp > $f
rm $tmp
echo "Updated version_num in $f"
fi
rm -f $tmp
if [ ! -z "$(git diff --stat)" ]; then
if confirm "Commit final changes? "; then
git commit -a -m "Preparing version ${vlong}"
fi
fi
gittag="janus-${vlong}"
if confirm "Tag the GIT repository with $gittag? "; then
git tag -s -f -m "Janus release ${vlong}" $gittag
fi