forked from angr/angr-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreleaser.sh
executable file
·185 lines (162 loc) · 3.69 KB
/
releaser.sh
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
#!/bin/bash -e
#while getopt "v" opt
#do
# case $opt in
# v)
# VERSION=$OPTARG
# ;;
# esac
#done
CMD=$1
shift
function today_version
{
echo 5.$(($(date +%y)-10)).$(date +%m.%d | sed -e "s/^0*//g" -e "s/\.0*/./g")
}
function build_docs
{
cd angr-doc
git checkout master
git push github master
cd -
make -C angr-doc/api-doc html
rm -rf angr.github.io/api-doc
cp -r angr-doc/api-doc/build/html angr.github.io/api-doc
cd angr.github.io
git commit --author "angr release bot <[email protected]>" -m "updated api-docs for version $VERSION" api-doc
git push origin master
cd -
}
function extract_version
{
[ ! -d $1 ] && echo "$1 does not exist.">2 && return
cd $1
ver=$(sed -n -e "s/.*version='\(.\+\)'.*/\1/p" setup.py)
cd ..
echo $ver
}
export REPOS=${REPOS-angr-management angr-doc angr simuvex claripy cle pyvex archinfo vex binaries}
case $CMD in
release)
VERSION=$1
shift || true
[ -z "$VERSION" ] && VERSION=$(today_version)
./git_all.sh checkout master
$0 version $VERSION
$0 update_dep
./git_all.sh commit --author "angr release bot <[email protected]>" -m "ticked version number to $VERSION" setup.py
./git_all.sh diff origin/master master | cat
echo
echo -n "Does the diff look good (y|n)? "
read a
[ "$a" == "y" ] || exit 1
./git_all.sh push origin master
./git_all.sh push github master
./git_all.sh checkout @{-1}
$0 register
$0 sdist
build_docs
#[[ $REPOS == *pyvex* ]] && REPOS=pyvex $0 wheel pyvex
;;
docs)
build_docs
;;
sync)
./git_all.sh checkout master
./git_all.sh pull origin master
./git_all.sh pull github master
./git_all.sh push github master
./git_all.sh push origin master
./git_all.sh checkout @{-1}
;;
version)
VERSION=$1
shift || true
[ -z "$VERSION" ] && VERSION=$(today_version)
for i in $REPOS
do
[ ! -e $i/setup.py ] && continue
cd $i
if [ "$(git show --format="%aN" -s HEAD)" == 'angr release bot' ]
then
echo "Skipping $i -- no changes"
cd ..
continue
fi
echo "Ticking version number of $i to $VERSION"
sed -i -e "s/version=['\"][^'\"]*['\"]/version='$VERSION'/g" setup.py
cd ..
done
;;
update_dep)
VERSION=$1
shift || true
[ -z "$VERSION" ] && VERSION=$(today_version)
MAIN_REPOS=( angr )
DEP_REPOS=( simuvex claripy cle archinfo pyvex )
for i in "${MAIN_REPOS[@]}"
do
[ ! -e $i/setup.py ] && continue
cd $i
if [ "$(git show --format="%aN" -s HEAD)" == 'angr release bot' ]
then
echo "Dependency version number of $i has already been updated."
cd ..
continue
fi
cd ..
for j in "${DEP_REPOS[@]}"
do
version=$(extract_version $j)
[ -z $version ] && echo "Cannot determine version of $j. Skip" && continue
cd $i
echo "Updating dependency version number for $j"
sed -i -e "s/'$j[^']*'/'$j>=$version'/g" setup.py
sed -i -e "s/$j[\s\S]*/$j>=$version/g" requirements.txt
cd ..
done
done
;;
remote)
NAME=$1
shift
PREFIX=$1
shift
for i in $REPOS
do
cd $i
git remote rm $NAME || echo "no remote $NAME set for $i"
git remote add $NAME $PREFIX/$i
cd ..
done
;;
sdist)
for i in $REPOS
do
[ ! -e $i/setup.py ] && continue
cd $i
python setup.py sdist
SDIST_EXTENSION=.tar.gz
python setup.py rotate -m $SDIST_EXTENSION -k 1 -d dist
twine register dist/*$SDIST_EXTENSION
twine upload dist/*$SDIST_EXTENSION
cd ..
done
;;
wheel)
for i in $REPOS
do
[ ! -e $i/setup.py ] && continue
cd $i
python setup.py bdist_wheel
WHEEL_EXTENSION=.whl
python setup.py rotate -m $WHEEL_EXTENSION -k 1 -d dist
twine register dist/*$WHEEL_EXTENSION
twine upload dist/*$WHEEL_EXTENSION
cd ..
done
;;
*)
echo "Unknown command."
;;
esac