/[smeserver]/builds_bin/locale-patch
ViewVC logotype

Diff of /builds_bin/locale-patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

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


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed