]>
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 | |
db82db79 AM |
37 | [ -d "$version/patches" ] && dir=$version/patches || dir=$version |
38 | for patch in $(cat $dir/series | filter_names); do | |
cccd68b3 ER |
39 | # if patch already existed, use mysql- prefix |
40 | if [ -f mysql-$patch ]; then | |
41 | file=mysql-$patch | |
42 | else | |
43 | file=$patch | |
44 | fi | |
db82db79 | 45 | cat $dir/$patch | filter_files > $file |
3eb07758 ER |
46 | |
47 | if [ -z "$(awk -vfile=$file -F/ '$2 == file{print}' CVS/Entries)" ]; then | |
48 | cvs add $file | |
49 | ${branch:+cvs up -r $branch $file} | |
50 | fi | |
51 | ||
afb072c5 ER |
52 | if [ "$patch" != "$file" ]; then |
53 | echo >&2 "Adding: $file ($patch)" | |
54 | else | |
55 | echo >&2 "Adding: $file" | |
56 | fi | |
cccd68b3 | 57 | printf "Patch%d:\t%s\n" $i $(echo "$file" | sed -e 's,^mysql-,%{name}-,') >> .percona.spec |
3eb07758 ER |
58 | printf "%%patch%d -p1\n" $i >> .patch.spec |
59 | i=$((i+1)) | |
60 | done | |
61 | ||
62 | # update PatchX section | |
63 | sed -i -e ' | |
64 | /^# <percona patches/,/^# <\/percona>/ { | |
65 | /^ <\/percona>/b | |
66 | /^# <percona patches/ { | |
67 | p # print header | |
68 | r .percona.spec | |
69 | a# </percona> | |
70 | } | |
71 | d | |
72 | } | |
73 | ' mysql.spec | |
74 | ||
75 | # update %patchX section | |
76 | sed -i -e ' | |
77 | /^# <percona %patches/,/^# <\/percona>/ { | |
78 | /^ <\/percona>/b | |
79 | /^# <percona %patches/ { | |
80 | p # print header | |
81 | r .patch.spec | |
82 | a# </percona> | |
83 | } | |
84 | d | |
85 | } | |
86 | ' mysql.spec |