1 |
slords |
1.1 |
#!/bin/bash |
2 |
|
|
|
3 |
slords |
1.2 |
export CVS_RSH=ssh |
4 |
|
|
|
5 |
|
|
rm -rf /var/lib/pootle/cvs/patch/* |
6 |
|
|
cd /var/lib/pootle/cvs/patch |
7 |
|
|
|
8 |
jpp |
1.5 |
#newpatch=/var/www/html/patches/smeserver-sme7admin-1.1.1-locale-2009-03-05.patch |
9 |
|
|
ls /var/www/html/patches/*/*.patch | cut -d/ --output-delimiter " " -f6,7 | while read ver newpatch |
10 |
slords |
1.1 |
do |
11 |
jpp |
1.5 |
[ ! -s "/var/www/html/patches/$ver/$newpatch" ] && continue |
12 |
slords |
1.2 |
pkg=$(echo $newpatch | sed 's,-[0-9.]\+-locale-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}.patch,,') |
13 |
|
|
chglog=$(echo $newpatch | sed "s,$pkg-[0-9.]\+-locale-,locale ,;s,\.patch, patch,") |
14 |
|
|
|
15 |
|
|
if [ ! -d "$pkg" ] |
16 |
|
|
then |
17 |
|
|
if echo $ver | grep -q contribs |
18 |
|
|
then |
19 |
jpp |
1.4 |
cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/smecontribs co -P $pkg |
20 |
slords |
1.2 |
else |
21 |
jpp |
1.4 |
cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/smeserver co -P $pkg |
22 |
slords |
1.2 |
fi |
23 |
|
|
fi |
24 |
|
|
spec=$(ls $pkg/$ver/*.spec 2> /dev/null) |
25 |
|
|
if [ ! -z "$spec" ] |
26 |
|
|
then |
27 |
|
|
source=$(sed -n 's,^\(Source[0-9]*:\).*,\1,ip' $spec | tail -1) |
28 |
|
|
patch=$(sed -n 's,^\(Patch[0-9]*:\).*,\1,ip' $spec | tail -1) |
29 |
|
|
[ -z "$patch" ] && pnum="1" || pnum=$(echo $patch | perl -pe 's,^Patch([0-9]*):,$1+1,ie') |
30 |
|
|
[ -z "$patch" ] && insert2="%setup" || insert2=$(echo $patch | perl -pe 's,^(Patch[0-9]*):,"%".lc($1),ie') |
31 |
|
|
insert1=${patch:=$source} |
32 |
slords |
1.1 |
|
33 |
jpp |
1.5 |
perl -i -pe 's,^(%define\s+release\s+)([0-9]+)\s*,"$1".($2+1)."\n",ie;s,^(Release:\s+)([0-9]+)(%{\?dist})\s*,"$1".($2+1)."$3\n",ie;' $spec |
34 |
slords |
1.2 |
verrel=$(rpm -q -D 'dist .sme' --qf '%{VERSION}-%{RELEASE}\n' --specfile $spec | head -1) |
35 |
|
|
sed -i "/^$insert1/aPatch$pnum: $(basename $newpatch)" $spec |
36 |
|
|
sed -i "/^$insert2\b/a%patch$pnum -p1" $spec |
37 |
|
|
sed -i "/^%changelog/a* $(date +'%a %b %d %G') SME Translation Server <translations@contribs.org> $verrel\n- apply $chglog\n" $spec |
38 |
jpp |
1.5 |
cp /var/www/html/patches/$ver/$newpatch $(dirname $spec) |
39 |
slords |
1.2 |
pushd $(dirname $spec) > /dev/null |
40 |
|
|
cvs -Q add $(basename $newpatch) |
41 |
|
|
[ "$1" == "commit" ] && make commit tag > /dev/null |
42 |
|
|
popd > /dev/null |
43 |
|
|
fi |
44 |
slords |
1.1 |
done |
45 |
|
|
|