]>
Commit | Line | Data |
---|---|---|
3eb07758 ER |
1 | #!/bin/sh |
2 | # updates percona patches | |
3 | # http://www.percona.com/docs/wiki/repositories:start | |
4 | # https://launchpad.net/percona-server/5.5 | |
5 | # bzr branch lp:percona-server/5.5 | |
6 | ||
7 | version=5.5 | |
8 | bzr_branch=lp:percona-server/$version | |
9 | branch= | |
10 | ||
11 | filter_names() { | |
3eb07758 ER |
12 | grep -v 'percona-support.patch' | \ |
13 | grep -v 'mysqld_safe_syslog.patch' | \ | |
14 | grep -v 'mysql-test.diff' | |
15 | } | |
16 | ||
17 | filter_files() { | |
18 | filterdiff -x '*/configure' | |
19 | } | |
20 | ||
21 | if [ -d $version ]; then | |
22 | cd $version | |
23 | bzr pull | |
24 | cd .. | |
25 | else | |
26 | bzr branch $bzr_branch $version | |
27 | fi | |
28 | ||
29 | > .percona.spec | |
30 | > .patch.spec | |
31 | i=100 | |
32 | for patch in $(cat $version/series | filter_names); do | |
cccd68b3 ER |
33 | # if patch already existed, use mysql- prefix |
34 | if [ -f mysql-$patch ]; then | |
35 | file=mysql-$patch | |
36 | else | |
37 | file=$patch | |
38 | fi | |
3eb07758 ER |
39 | cat $version/$patch | filter_files > $file |
40 | ||
41 | if [ -z "$(awk -vfile=$file -F/ '$2 == file{print}' CVS/Entries)" ]; then | |
42 | cvs add $file | |
43 | ${branch:+cvs up -r $branch $file} | |
44 | fi | |
45 | ||
46 | echo >&2 "Adding: $patch" | |
cccd68b3 | 47 | printf "Patch%d:\t%s\n" $i $(echo "$file" | sed -e 's,^mysql-,%{name}-,') >> .percona.spec |
3eb07758 ER |
48 | printf "%%patch%d -p1\n" $i >> .patch.spec |
49 | i=$((i+1)) | |
50 | done | |
51 | ||
52 | # update PatchX section | |
53 | sed -i -e ' | |
54 | /^# <percona patches/,/^# <\/percona>/ { | |
55 | /^ <\/percona>/b | |
56 | /^# <percona patches/ { | |
57 | p # print header | |
58 | r .percona.spec | |
59 | a# </percona> | |
60 | } | |
61 | d | |
62 | } | |
63 | ' mysql.spec | |
64 | ||
65 | # update %patchX section | |
66 | sed -i -e ' | |
67 | /^# <percona %patches/,/^# <\/percona>/ { | |
68 | /^ <\/percona>/b | |
69 | /^# <percona %patches/ { | |
70 | p # print header | |
71 | r .patch.spec | |
72 | a# </percona> | |
73 | } | |
74 | d | |
75 | } | |
76 | ' mysql.spec |