Re: [translate-pootle] Make commits from command line

2008-03-02 Thread Normando Hall
  Thank you Friedel, Miklos, Lars, and Christian for your helpful advices.

We implement a cron auto-commit script to make the commits without force 
user to make this. This is because in the future we implement an 
automatic system to make patchs and rpms automatically, so yet at 
testing only.
I will try to add a message log from pocount and last username 
translator, via -F commit option.
For those are interested in the script, here I add a dirty non refined 
script, the same we are using now.

SVN-CI-PO

#!/bin/bash -
/usr/bin/svn -q ci --username pootle --password  -m Automatic 
updating from Pootle /usr/lib/python2.4/site-packages/Pootle/po/project1/*
/usr/bin/svn -q ci --username pootle --password  -m Automatic 
updating from Pootle /usr/lib/python2.4/site-packages/Pootle/po/project2/*
/usr/bin/svn -q ci --username pootle --password  -m Automatic 
updating from Pootle /usr/lib/python2.4/site-packages/Pootle/po/project3/*

In our system we have implemented two svn repositories. One for PO 
translated files, and one only for Templates. Each repo has anonymous 
access for checkout and update, but authenticated for import and commit.

Because pootle has not yet a way to upload templates, we can do through 
SVN and other cron script.

Follow is the templates script, that run an update from svn to pootle 
templates.

SVN-UP-TMPL

#!/bin/bash -
/usr/bin/svn -q update 
/usr/lib/python2.4/site-packages/Pootle/po/project1/templates
/usr/bin/svn -q update 
/usr/lib/python2.4/site-packages/Pootle/po/project2/templates
/usr/bin/svn -q update 
/usr/lib/python2.4/site-packages/Pootle/po/project3/templates

Now, because we can't give admin access to users for run Update from 
templates or Update languages from pootle web admin inteface, we also 
make another script to run this:

UPDATE-PO-FROM-TMPL

#!/bin/bash

lup=/tmp/langupd
mkdir $lup
#BASE=pootleLang
BASE=/usr/lib/python2.4/site-packages/Pootle/po/

cd $BASE
#echo `pwd`

for project in  project1 project2 project3
do

 cd $project
 #echo `pwd`

  for dir in  `ls -I templates`
  do

#echo $dir
mkdir $lup/$dir
cp -r $dir/*.po $lup/$dir
/usr/bin/python2.4 /usr/bin/pot2po --progress=none -t $lup/$dir 
templates $dir
rm -rf $lup/$dir

  done
cd ..

done
rm -rf $lup

Finally we make a script to add new files to repository. This is because 
if you have upload (add + commit) a new template to svn, then this 
template is parsed through all languages PO files with the above script, 
generating new files (if this is the cace) or modifying. But this new PO 
file is not added to the PO repo. The follow is the script to add new 
files to PO repo from Pootle PO files.

SVN-ADD-PO

#!/bin/bash

poadd=/tmp/svnadd

echo #!/bin/bash  $poadd
echo   $poadd
svn status /usr/lib/python2.4/site-packages/Pootle/po/project1/??/*.po 
|grep ?  $poadd
perl -pi -e 's/\? /svn add -q/g' $poadd
chmod 755 $poadd
$poadd
rm -f $poadd

echo #!/bin/bash  $poadd
echo   $poadd
svn status /usr/lib/python2.4/site-packages/Pootle/po/project2/??/*.po 
|grep ?  $poadd
perl -pi -e 's/\? /svn add -q/g' $poadd
chmod 755 $poadd
$poadd
rm -f $poadd

echo #!/bin/bash  $poadd
echo   $poadd
svn status /usr/lib/python2.4/site-packages/Pootle/po/project3/??/*.po 
|grep ?  $poadd
perl -pi -e 's/\? /svn add -q/g' $poadd
chmod 755 $poadd
$poadd
rm -f $poadd


It i better if I use for-do-done :)

Run these scripts once an hour. I was made a mistake running every 5 or 
6 minutes and at some time two or more scripts overlap and make locked 
repo, generatin lock errors from svn.

We will try to refine these scripts, and publish them.

Thanks again for all your replies.

regards, Normando



F Wolff escribió:
 Op Vrydag 2008-02-29 skryf Miklos Vajna:
   
 On Fri, Feb 29, 2008 at 07:19:05AM +0100, Christian Perrier [EMAIL 
 PROTECTED] wrote:
 
 I want to make commit from command line. I can make commits through cron 
 scripts, but I want through pootle, because add a message about 
 translator and translated strings.

 Is this possible?
 
 As far as I know, no.

 This is something we also need for Debian's experimental Pootle
 server.
   
 hmm. i think it's good to force users to commit manually, so that you
 can run 'git blame' (or other similar command for other vcses) to see
 who committed for example a mistake. if you do anonymous commits, then
 you can't blame anybody when a bug is found.
 


 Well, the Last-Translator header field helps a little bit, and if people
 commit manually, that can also help. In XLIFF files, you might be able
 to store all sorts of interesting meta information (like who, when,
 etc.), but the tool support is not really there yet.

 I guess the support provided by Pootle is really meant for cases where
 we want to give VCS access to more people that might not know or care
 about the differences. And of course, no extra accounts necessary, as
 the Pootle accounts are used.

 It is not ideal for everything, but solves some problems for some
 people. 

Re: [translate-pootle] Make commits from command line

2008-03-02 Thread Normando Hall
Becareful with scripts because email wrap lines.

Normando

Normando Hall escribió:
   Thank you Friedel, Miklos, Lars, and Christian for your helpful advices.

 We implement a cron auto-commit script to make the commits without force 
 user to make this. This is because in the future we implement an 
 automatic system to make patchs and rpms automatically, so yet at 
 testing only.
 I will try to add a message log from pocount and last username 
 translator, via -F commit option.
 For those are interested in the script, here I add a dirty non refined 
 script, the same we are using now.

 SVN-CI-PO

 #!/bin/bash -
 /usr/bin/svn -q ci --username pootle --password  -m Automatic 
 updating from Pootle /usr/lib/python2.4/site-packages/Pootle/po/project1/*
 /usr/bin/svn -q ci --username pootle --password  -m Automatic 
 updating from Pootle /usr/lib/python2.4/site-packages/Pootle/po/project2/*
 /usr/bin/svn -q ci --username pootle --password  -m Automatic 
 updating from Pootle /usr/lib/python2.4/site-packages/Pootle/po/project3/*

 In our system we have implemented two svn repositories. One for PO 
 translated files, and one only for Templates. Each repo has anonymous 
 access for checkout and update, but authenticated for import and commit.

 Because pootle has not yet a way to upload templates, we can do through 
 SVN and other cron script.

 Follow is the templates script, that run an update from svn to pootle 
 templates.

 SVN-UP-TMPL

 #!/bin/bash -
 /usr/bin/svn -q update 
 /usr/lib/python2.4/site-packages/Pootle/po/project1/templates
 /usr/bin/svn -q update 
 /usr/lib/python2.4/site-packages/Pootle/po/project2/templates
 /usr/bin/svn -q update 
 /usr/lib/python2.4/site-packages/Pootle/po/project3/templates

 Now, because we can't give admin access to users for run Update from 
 templates or Update languages from pootle web admin inteface, we also 
 make another script to run this:

 UPDATE-PO-FROM-TMPL

 #!/bin/bash

 lup=/tmp/langupd
 mkdir $lup
 #BASE=pootleLang
 BASE=/usr/lib/python2.4/site-packages/Pootle/po/

 cd $BASE
 #echo `pwd`

 for project in  project1 project2 project3
 do

  cd $project
  #echo `pwd`

   for dir in  `ls -I templates`
   do

 #echo $dir
 mkdir $lup/$dir
 cp -r $dir/*.po $lup/$dir
 /usr/bin/python2.4 /usr/bin/pot2po --progress=none -t $lup/$dir 
 templates $dir
 rm -rf $lup/$dir

   done
 cd ..

 done
 rm -rf $lup

 Finally we make a script to add new files to repository. This is because 
 if you have upload (add + commit) a new template to svn, then this 
 template is parsed through all languages PO files with the above script, 
 generating new files (if this is the cace) or modifying. But this new PO 
 file is not added to the PO repo. The follow is the script to add new 
 files to PO repo from Pootle PO files.

 SVN-ADD-PO

 #!/bin/bash

 poadd=/tmp/svnadd

 echo #!/bin/bash  $poadd
 echo   $poadd
 svn status /usr/lib/python2.4/site-packages/Pootle/po/project1/??/*.po 
 |grep ?  $poadd
 perl -pi -e 's/\? /svn add -q/g' $poadd
 chmod 755 $poadd
 $poadd
 rm -f $poadd

 echo #!/bin/bash  $poadd
 echo   $poadd
 svn status /usr/lib/python2.4/site-packages/Pootle/po/project2/??/*.po 
 |grep ?  $poadd
 perl -pi -e 's/\? /svn add -q/g' $poadd
 chmod 755 $poadd
 $poadd
 rm -f $poadd

 echo #!/bin/bash  $poadd
 echo   $poadd
 svn status /usr/lib/python2.4/site-packages/Pootle/po/project3/??/*.po 
 |grep ?  $poadd
 perl -pi -e 's/\? /svn add -q/g' $poadd
 chmod 755 $poadd
 $poadd
 rm -f $poadd


 It i better if I use for-do-done :)

 Run these scripts once an hour. I was made a mistake running every 5 or 
 6 minutes and at some time two or more scripts overlap and make locked 
 repo, generatin lock errors from svn.

 We will try to refine these scripts, and publish them.

 Thanks again for all your replies.

 regards, Normando



 F Wolff escribió:
   
 Op Vrydag 2008-02-29 skryf Miklos Vajna:
   
 
 On Fri, Feb 29, 2008 at 07:19:05AM +0100, Christian Perrier [EMAIL 
 PROTECTED] wrote:
 
   
 I want to make commit from command line. I can make commits through cron 
 scripts, but I want through pootle, because add a message about 
 translator and translated strings.

 Is this possible?
 
   
 As far as I know, no.

 This is something we also need for Debian's experimental Pootle
 server.
   
 
 hmm. i think it's good to force users to commit manually, so that you
 can run 'git blame' (or other similar command for other vcses) to see
 who committed for example a mistake. if you do anonymous commits, then
 you can't blame anybody when a bug is found.
 
   
 Well, the Last-Translator header field helps a little bit, and if people
 commit manually, that can also help. In XLIFF files, you might be able
 to store all sorts of interesting meta information (like who, when,
 etc.), but the tool support is not really there yet.

 I guess the support provided by Pootle is really meant for cases where
 we want to give VCS