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