/[smeserver]/builds_bin/genpatches
ViewVC logotype

Diff of /builds_bin/genpatches

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

Revision 1.7 by slords, Thu Mar 5 21:41:33 2009 UTC Revision 1.8 by slords, Tue Mar 2 21:16:48 2010 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  # Functions  # Functions
4  . /etc/pootle/bin/functions  . /var/lib/pootle/bin/functions
5    
6  # Clean up tmp dir  # Clean up tmp dir
7  rm -rf /etc/pootle/tmp  rm -rf /var/lib/pootle/tmp
8  mkdir -p /etc/pootle/tmp /var/www/html/{patches,errors,anaconda}  mkdir -p /var/lib/pootle/tmp/ /var/www/html/{patches,errors,anaconda}
9    
10  #==========================================================  #==========================================================
11    
12  cd /etc/pootle/tmp  cd /var/lib/pootle/tmp
13    
14  # Build diffs for languages  # Build diffs for languages
15  for lang in $(ls /etc/pootle/po/sme7bp -I templates)  for pkg in $(ls /var/lib/pootle/po/{sme,contribs}[0-9]/templates/ | sed -n 's@\.pot@@p' | sort -u)
16  do  do
17      # Build anaconda files      pkgs=$(find /var/lib/pootle/cvs/*/*/*/*/root/etc/e-smith/locale/en-us -name $pkg -not -regex '.*\+ldap/.*')
18      mkdir -p /var/www/html/anaconda/sme7/$lang/LC_MESSAGES      if [ -z "$pkgs" ]
     anacondagen sme7 $lang > /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo  
     [ -s /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme7/$lang  
   
     mkdir -p /var/www/html/anaconda/sme8/$lang/LC_MESSAGES  
     anacondagen sme8 $lang > /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo  
     [ -s /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme8/$lang  
   
     # Build console files  
     pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8)  
     mkdir -p ${pkgname}.update/po/$lang  
     for pkg in $(ls /etc/pootle/po/sme7bc/templates/ -I anaconda.pot | sed -n 's@\.pot@\.po@p')  
     do  
         msgcat -F --no-wrap /etc/pootle/po/sme7bc/$lang/$pkg \  
         | grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \  
         | sed '0,/msgid ""/{/^#/d};/^#,/d' \  
         > ${pkgname}.update/po/$lang/$pkg  
     done  
   
     # Build sme7admin file  
     pkgname=$(ls -d /etc/pootle/cvs/smecontribs/smeserver-sme7admin/*7/*/root | cut -d/ -f8)  
     mkdir -p ${pkgname}.update/po/$lang  
     msgcat -F --no-wrap /etc/pootle/po/sme7cp/$lang/sme7admin.po \  
     | grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \  
     | sed '0,/msgid ""/{/^#/d};/^#,/d' \  
     > ${pkgname}.update/po/$lang/sme7admin.po  
 done  
   
 # Build translated xml files  
 for pkg in $(ls /etc/pootle/po/sme7*p/templates/ -I sme7admin.pot | sed -n 's@\.pot@@p')  
 do  
     pkgname=$(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg | cut -d/ -f8)  
     if [ -z "$pkgname" ]  
19      then      then
20          if [ -z "$(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg)" ]          if [ $pkg == "anaconda" ]
21          then          then
22              echo -e "\n *** Can't find package for $pkg ***\n"              ls /var/lib/pootle/po/*/*/$pkg.po | cut -d/ --output-delimiter " " -f6,7 | while read ver lang
23              continue              do
24          fi                  mkdir -p /var/www/html/anaconda/$ver/$lang/LC_MESSAGES
25          pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8)                  anacondagen $ver $lang > /var/www/html/anaconda/$ver/$lang/LC_MESSAGES/anaconda.mo
26                    [ -s /var/www/html/anaconda/$ver/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/$ver/$lang
27                done
28            else
29                pkgs=$(ls -d /var/lib/pootle/cvs/*/smeserver-$pkg/*/*/root 2> /dev/null)
30                [ -z "$pkgs" ] && pkgs=$(ls -d /var/lib/pootle/cvs/*/smeserver-locale/*/*/root)
31    
32                echo "$pkgs" | cut -d/ --output-delimiter " " -f8,9 | while read ver pkgname
33                do
34                    for lang in $(ls -I templates /var/lib/pootle/po/$ver/ 2> /dev/null | grep '[[:alpha:]]$' | sort -u)
35                    do
36                        mkdir -p diff/$ver/${pkgname}.update/po/$lang
37                        msgcat -F --no-wrap /var/lib/pootle/po/$ver/$lang/${pkg}.po \
38                        | grep -v 'Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \
39                        | sed '0,/msgid ""/{/^#/d};/^#,/d;s@^\(#: \)[^/]\+/root@\1root@' \
40                        > diff/$ver/${pkgname}.update/po/$lang/${pkg/backup-console/backup}.po
41                    done
42                done
43            fi
44      else      else
45          mkdir -p ${pkgname}.update/$(localedir en-us $pkg)          echo "$pkgs" | grep -qv '/contribs[0-9]/' && pkgs=$(echo "$pkgs" | grep '/contribs[0-9]/'; ls -d /var/lib/pootle/cvs/*/smeserver-locale/*/*/root)
46          cat /etc/pootle/templates/$pkg.orig \          echo "$pkgs" | cut -d/ --output-delimiter " " -f8,9 | while read ver pkgname
47          | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \          do
48          > ${pkgname}.update/$(localedir en-us $pkg)/$pkg              if echo $ver | grep -q contribs
49                then
50                    mkdir -p diff/$ver/${pkgname}.update/$(localedir en-us $pkg)
51                    cat /var/lib/pootle/templates/$ver/$pkg.orig \
52                    | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
53                    > diff/$ver/${pkgname}.update/$(localedir en-us $pkg)/$pkg
54                fi
55                for lang in $(ls -I templates /var/lib/pootle/po/$ver/ 2> /dev/null | grep '[[:alpha:]]$' | sort -u)
56                do
57                    mkdir -p diff/$ver/${pkgname}.update/$(localedir $lang $pkg)
58                    xmlgen $ver /var/lib/pootle/po/$ver/$lang/${pkg}.po \
59                    > diff/$ver/${pkgname}.update/$(localedir $lang $pkg)/$pkg
60                done
61            done
62      fi      fi
     for lang in $(ls /etc/pootle/po/sme7bp -I templates)  
     do  
         mkdir -p ${pkgname}.update/$(localedir $lang $pkg)  
         xmlgen /etc/pootle/po/sme7*p/$lang/${pkg}.po \  
         > ${pkgname}.update/$(localedir $lang $pkg)/$pkg  
     done  
63  done  done
64    
65  # Build xml diffs  # Build diffs
66  for pkg in $(ls -d *.update | sed 's@.update$@@')  ls -d diff/*/* | sed 's@.update$@@' | cut -d/ --output-delimiter " " -f2,3 | while read ver pkg
67  do  do
68      rm -f /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch      mkdir -p /var/www/html/patches/$ver
69      [ -d $pkg.update/root/etc/e-smith/locale ] || continue      rm -f /var/www/html/patches/$ver/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch
70      orig=/etc/pootle/cvs/sme*/*/*7/$pkg/root/etc/e-smith/locale      if [ -d "diff/$ver/$pkg.update/root" ]
71      diff -ruN $orig $pkg.update/root/etc/e-smith/locale \      then
72      | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \          diff -ruN {/var/lib/pootle/cvs/*/*/$ver/$pkg,diff/$ver/$pkg.update}/root/etc/e-smith/locale \
73      > /var/www/html/patches/$pkg-locale-$(date +%F).patch          | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \
74            >> /var/www/html/patches/$ver/$pkg-locale-$(date +%F).patch
75        fi
76        if [ -d "diff/$ver/$pkg.update/po" ]
77        then
78            diff -ruN {/var/lib/pootle/cvs/*/*/$ver/$pkg,diff/$ver/$pkg.update}/po \
79            | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \
80            >> /var/www/html/patches/$ver/$pkg-locale-$(date +%F).patch
81        fi
82  done  done
83    
 # Build console diffs  
 pkg=$(ls -d smeserver-locale-* | sed 's@.update$@@')  
 orig=/etc/pootle/cvs/smeserver/smeserver-locale/*7/$pkg/po  
 diff -ruN $orig $pkg.update/po \  
 | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \  
 >> /var/www/html/patches/$pkg-locale-$(date +%F).patch  
   
 # Build sme7admin diff  
 pkg=$(ls -d smeserver-sme7admin-* | sed 's@.update$@@')  
 orig=/etc/pootle/cvs/smecontribs/smeserver-sme7admin/*7/$pkg/po  
 diff -ruN $orig $pkg.update/po \  
 | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \  
 >> /var/www/html/patches/$pkg-locale-$(date +%F).patch  
   


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