[opensuse-translation-commit] r94965 - trunk/packages/50-tools
Author: minton Date: 2015-11-15 18:47:27 +0100 (Sun, 15 Nov 2015) New Revision: 94965 Added: trunk/packages/50-tools/prepare_split_tw.sh trunk/packages/50-tools/prepare_split_tw_leap.sh Removed: trunk/packages/50-tools/prepare_split.sh Modified: trunk/packages/50-tools/translate_packages.pl trunk/packages/50-tools/tx-merge.sh Log: Updated tooling for tumbleweed and leap simultaneous translation + several bugs fixed Deleted: trunk/packages/50-tools/prepare_split.sh =================================================================== --- trunk/packages/50-tools/prepare_split.sh 2015-11-15 16:59:02 UTC (rev 94964) +++ trunk/packages/50-tools/prepare_split.sh 2015-11-15 17:47:27 UTC (rev 94965) @@ -1,78 +0,0 @@ -#! /bin/sh - -set -e -#curl -s http://download.opensuse.org/factory/repo/oss/suse/setup/descr/packages.en.g... | gzip -c -d > packages.en -#curl -s http://download.opensuse.org/factory/repo/oss/suse/setup/descr/packages.gz | gzip -c -d > packages -#git clone --depth 1 git://gitorious.org/opensuse/package-lists.git -curl -s http://download.opensuse.org/tumbleweed/repo/oss/suse/setup/descr/packages.e... | gzip -c -d > packages.en -curl -s http://download.opensuse.org/tumbleweed/repo/oss/suse/setup/descr/packages.g... | gzip -c -d > packages -git clone --depth 1 https://github.com/openSUSE/package-lists.git -rm -rf lists -mv package-lists/output/opensuse lists -rm -rf package-lists -cd lists -cat gnome_cd.i586.list gnome_cd.x86_64.list | sort -o gnome.list -u -rm gnome_cd.i586.list gnome_cd.x86_64.list -cat kde4_cd.i586.list kde4_cd.x86_64.list | sort -o kde.list -u -rm kde4_cd.i586.list kde4_cd.x86_64.list -cat gnome.list kde.list | sort | uniq -c | grep " 2 " | sed -e "s,.* 2 ,," > base.list -cat base.list kde.list | sort | uniq -u > kde.list.new && mv kde.list.new kde.list -cat base.list gnome.list | sort | uniq -u > gnome.list.new && mv gnome.list.new gnome.list -cat dvd-* | sort -u > dvd.list -# duplicate -cat base.list kde.list gnome.list >> dvd.list -rm dvd-* -cat base.list dvd.list kde.list gnome.list | sort | uniq -u > dvd.new && mv dvd.new dvd.list -grep =Pkg: ../packages | cut '-d ' -f2 > factory.list -cat base.list dvd.list kde.list gnome.list dvd.list factory.list | sort | uniq -u > factory.new && mv factory.new factory.list - -head -n 500 base.list > base1.list -tail -n +501 base.list > base2.list -rm base.list - -for i in `seq 1 7`; do - head -n 500 dvd.list > dvd$i.list - tail -n +501 dvd.list > new && mv new dvd.list -done -mv dvd.list dvd8.list - -for i in `seq 1 8`; do - head -n 880 factory.list > factory$i.list - tail -n +881 factory.list > new && mv new factory.list -done -mv factory.list factory9.list - -cd .. - -perl 50-tools/translate_packages.pl lists/base1.list packages packages.en > 50-pot/base1.pot -perl 50-tools/translate_packages.pl lists/base2.list packages packages.en > 50-pot/base2.pot -perl 50-tools/translate_packages.pl lists/kde.list packages packages.en > 50-pot/kde.pot -perl 50-tools/translate_packages.pl lists/gnome.list packages packages.en > 50-pot/gnome.pot -for i in `seq 1 8`; do - perl 50-tools/translate_packages.pl lists/dvd$i.list packages packages.en > 50-pot/dvd$i.pot -done -for i in `seq 1 9`; do - perl 50-tools/translate_packages.pl lists/factory$i.list packages packages.en > 50-pot/factory$i.pot -done - -for i in 50-pot/*.pot; do - msguniq --use-first -o $i $i -done - -cd 50-pot -prev=base1.pot -for pot in base2.pot kde.pot gnome.pot dvd*.pot factory*.pot; do - for oldpot in $prev; do - # first duplicate - msgcat --use-first -o $pot $pot $oldpot - # then take uniques - msgcat -s --use-first -u -o $pot $pot $oldpot - done - prev="$prev $pot" -done - -for i in *.pot; do echo -n "$i: "; msgfmt --statistics $i; done - -cd .. - -rm -rf lists packages.en packages Copied: trunk/packages/50-tools/prepare_split_tw.sh (from rev 94964, trunk/packages/50-tools/prepare_split.sh) =================================================================== --- trunk/packages/50-tools/prepare_split_tw.sh (rev 0) +++ trunk/packages/50-tools/prepare_split_tw.sh 2015-11-15 17:47:27 UTC (rev 94965) @@ -0,0 +1,78 @@ +#! /bin/sh + +set -e +#curl -s http://download.opensuse.org/factory/repo/oss/suse/setup/descr/packages.en.g... | gzip -c -d > packages.en +#curl -s http://download.opensuse.org/factory/repo/oss/suse/setup/descr/packages.gz | gzip -c -d > packages +#git clone --depth 1 git://gitorious.org/opensuse/package-lists.git +curl -s http://download.opensuse.org/tumbleweed/repo/oss/suse/setup/descr/packages.e... | gzip -c -d > packages.en +curl -s http://download.opensuse.org/tumbleweed/repo/oss/suse/setup/descr/packages.g... | gzip -c -d > packages +git clone --depth 1 https://github.com/openSUSE/package-lists.git +rm -rf lists +mv package-lists/output/opensuse lists +rm -rf package-lists +cd lists +cat gnome_cd.i586.list gnome_cd.x86_64.list | sort -o gnome.list -u +rm gnome_cd.i586.list gnome_cd.x86_64.list +cat kde4_cd.i586.list kde4_cd.x86_64.list | sort -o kde.list -u +rm kde4_cd.i586.list kde4_cd.x86_64.list +cat gnome.list kde.list | sort | uniq -c | grep " 2 " | sed -e "s,.* 2 ,," > base.list +cat base.list kde.list | sort | uniq -u > kde.list.new && mv kde.list.new kde.list +cat base.list gnome.list | sort | uniq -u > gnome.list.new && mv gnome.list.new gnome.list +cat dvd-* | sort -u > dvd.list +# duplicate +cat base.list kde.list gnome.list >> dvd.list +rm dvd-* +cat base.list dvd.list kde.list gnome.list | sort | uniq -u > dvd.new && mv dvd.new dvd.list +grep =Pkg: ../packages | cut '-d ' -f2 > factory.list +cat base.list dvd.list kde.list gnome.list dvd.list factory.list | sort | uniq -u > factory.new && mv factory.new factory.list + +head -n 500 base.list > base1.list +tail -n +501 base.list > base2.list +rm base.list + +for i in `seq 1 7`; do + head -n 500 dvd.list > dvd$i.list + tail -n +501 dvd.list > new && mv new dvd.list +done +mv dvd.list dvd8.list + +for i in `seq 1 8`; do + head -n 880 factory.list > factory$i.list + tail -n +881 factory.list > new && mv new factory.list +done +mv factory.list factory9.list + +cd .. + +perl 50-tools/translate_packages.pl lists/base1.list packages packages.en > 50-pot/base1.pot +perl 50-tools/translate_packages.pl lists/base2.list packages packages.en > 50-pot/base2.pot +perl 50-tools/translate_packages.pl lists/kde.list packages packages.en > 50-pot/kde.pot +perl 50-tools/translate_packages.pl lists/gnome.list packages packages.en > 50-pot/gnome.pot +for i in `seq 1 8`; do + perl 50-tools/translate_packages.pl lists/dvd$i.list packages packages.en > 50-pot/dvd$i.pot +done +for i in `seq 1 9`; do + perl 50-tools/translate_packages.pl lists/factory$i.list packages packages.en > 50-pot/factory$i.pot +done + +for i in 50-pot/*.pot; do + msguniq --use-first -o $i $i +done + +cd 50-pot +prev=base1.pot +for pot in base2.pot kde.pot gnome.pot dvd*.pot factory*.pot; do + for oldpot in $prev; do + # first duplicate + msgcat --use-first -o $pot $pot $oldpot + # then take uniques + msgcat -s --use-first -u -o $pot $pot $oldpot + done + prev="$prev $pot" +done + +for i in *.pot; do echo -n "$i: "; msgfmt --statistics $i; done + +cd .. + +rm -rf lists packages.en packages Added: trunk/packages/50-tools/prepare_split_tw_leap.sh =================================================================== --- trunk/packages/50-tools/prepare_split_tw_leap.sh (rev 0) +++ trunk/packages/50-tools/prepare_split_tw_leap.sh 2015-11-15 17:47:27 UTC (rev 94965) @@ -0,0 +1,155 @@ +#! /bin/sh +set -e +## get package lists +git clone --depth 1 https://github.com/openSUSE/package-lists.git +rm -rf 50-lists + +mv package-lists/output/opensuse/Factory 50-lists +rm -rf package-lists + +## split package lists +cd 50-lists +cat gnome_cd.i586.list gnome_cd.x86_64.list | sort -o gnome.list -u +rm gnome_cd.i586.list gnome_cd.x86_64.list +grep -v patterns-openSUSE gnome.list > gnome.list.new && mv gnome.list.new gnome.list + +cat kde4_cd.i586.list kde4_cd.x86_64.list | sort -o kde.list -u +rm kde4_cd.i586.list kde4_cd.x86_64.list +grep -v patterns-openSUSE kde.list > kde.list.new && mv kde.list.new kde.list + +cat dvd-* | sort -u > dvd.list +rm dvd-* +grep -v patterns-openSUSE dvd.list > dvd.list.new && mv dvd.list.new dvd.list + +cat kde.list gnome.list dvd.list | sort | uniq -u > dvd.new && mv dvd.new dvd.list + +cat gnome.list kde.list | sort | uniq -c | grep " 2 " | sed -e "s,.* 2 ,," > base.list +cat base.list kde.list | sort | uniq -u > kde.list.new && mv kde.list.new kde.list +cat base.list gnome.list | sort | uniq -u > gnome.list.new && mv gnome.list.new gnome.list + +rm -f base?.list +cat base.list | while read line; do +#firstChar=${line:0:1} +newline=${line,,} +# base +case $newline in +lib*) echo $line >> base2.list;; +*) echo $line >> base1.list;; +esac +done + +#for i in base?.list; do echo -n "$i: "; cat $i | wc -l;done + +rm -f dvd?.list +cat dvd.list | while read line; do +#firstChar=${line:0:1} +newline=${line,,} +case $newline in +[0-9]*) echo $line >> dvd1.list;; +[a-e]*) echo $line >> dvd1.list;; +[f-i]*) echo $line >> dvd2.list;; +[j-k]*) echo $line >> dvd3.list;; +libreoffice*) echo $line >> dvd3.list;; +lib[a-m]*) echo $line >> dvd4.list;; +lib*) echo $line >> dvd5.list;; +[l]*) echo $line >> dvd3.list;; + perl*|php*|python*) echo $line >> dvd7.list;; +[m-p]*) echo $line >> dvd6.list;; +[q-s]*) echo $line >> dvd7.list;; +[t-z]*) echo $line >> dvd8.list;; +esac + +done + +#for i in dvd?.list; do echo -n "$i: "; cat $i | wc -l;done + +## generate message catalogs +pots="patterns base1 base2 kde gnome" +for i in `seq 1 8`; do + pots="$pots dvd$i" +done +for i in `seq 1 9`; do + pots="$pots factory$i" +done + +for distro in tumbleweed leap; do +## set URLs +case $distro in +"leap") URL="distribution/leap/42.1";; +"tumbleweed") URL="tumbleweed";; +*) continue;; +esac + +## get package descriptions +curl -s http://download.opensuse.org/$URL/repo/oss/suse/setup/descr/packages.en.gz | gzip -c -d > $distro-packages.en +curl -s http://download.opensuse.org/$URL/repo/oss/suse/setup/descr/packages.gz | gzip -c -d > $distro-packages + +## split out factory.list +grep =Pkg: $distro-packages | cut '-d ' -f2 | sort -o factory.list -u +grep patterns-openSUSE factory.list > patterns.list +grep -v patterns-openSUSE factory.list > factory.new && mv factory.new factory.list + +cat base?.list kde.list gnome.list dvd?.list factory.list | sort | uniq -u > factory.new && mv factory.new factory.list + +rm -f factory?.list +cat factory.list | while read line; do +#firstChar=${line:0:1} +newline=${line,,} +# factory +case $newline in +[0-9]*) echo $line >> factory1.list;; +[a-e]*) echo $line >> factory1.list;; +[f-h]*) echo $line >> factory2.list;; +[i-k]*) echo $line >> factory3.list;; +libreoffice*) echo $line >> factory3.list;; +lib*) echo $line >> factory4.list;; +[l]*) echo $line >> factory3.list;; +perl*|php*|python*) echo $line >> factory6.list;; +[m-p]*) echo $line >> factory5.list;; +[q-s]*) echo $line >> factory7.list;; +texlive*) echo $line >> factory8.list;; +[t]*) echo $line >> factory9.list;; +[u-z]*) echo $line >> factory9.list;; +esac +done + +#for i in factory?.list; do echo -n "$i: "; cat $i | wc -l;done + +echo "Converting $distro: " +for pot in $pots; do + echo -n " $pot" + perl ../50-tools/translate_packages.pl $pot.list $distro-packages $distro-packages.en $distro > $distro-$pot.pot + msguniq -o $distro-$pot.pot $distro-$pot.pot +done +echo " done!" + +echo "$distro done!" +done +## Merge distros +echo "Merging: " +for pot in $pots; do + echo -n "$pot " + cp tumbleweed-$pot.pot $pot.pot + tail -n +8 leap-$pot.pot >> $pot.pot + msguniq $pot.pot | grep -v "#-#-#-#" > ../50-pot/$pot.pot +done +echo " done!" + +## filter out duplicate mesages +echo "Unifying: " +cd ../50-pot +prev="patterns.pot" +for pot in base*.pot kde.pot gnome.pot dvd*.pot factory*.pot; do + echo -n "$pot " + for oldpot in $prev; do + # first duplicate + msgcat -o $pot --use-first $pot $oldpot + # then take uniques + msgcat -u -o $pot --use-first $pot $oldpot + done + prev="$prev $pot" +done +echo " done!" + +echo "Statistics: " +for i in *.pot; do echo -n "$i: "; msgfmt --statistics -o /dev/null $i; done Modified: trunk/packages/50-tools/translate_packages.pl =================================================================== --- trunk/packages/50-tools/translate_packages.pl 2015-11-15 16:59:02 UTC (rev 94964) +++ trunk/packages/50-tools/translate_packages.pl 2015-11-15 17:47:27 UTC (rev 94965) @@ -122,7 +122,8 @@ } open(DESCR, "<:encoding(UTF-8)", $ARGV[0]); - +shift @ARGV; +my $distro = $ARGV[0]; my $lastpack = ''; my $lastname; while ( <DESCR> ) { @@ -133,16 +134,14 @@ $lastpack = $1; $lastname = $1; if ($sources{$lastpack} ne $lastpack) { - $lastname = $sources{$lastpack} . ":" . $lastpack; + $lastname = $sources{$lastpack} . "/" . $lastpack; } next; } if ($_ =~ m/^=Sum:\s*(.*)\s*$/) { my $summary = $1; next if ignore($lastpack); - # evil hack to avoid UTF-8 errors - #$summary =~ s,.*is a new XML,XML is cool,; - output($summary, "summary($lastname)"); + output($summary, $distro . "/" . $lastname . "/summary"); next; } if ($_ =~ m/^\+Des:/) { @@ -151,13 +150,11 @@ } if ($_ =~ m/^-Des:/) { $indesc = 0; - # evil hack to avoid UTF-8 errors - #$descr =~ s,Plattd[^ ]*,Plattgerman,; if (!ignore($lastpack)) { $descr =~ s,\s*Authors:\n--------[.\s\n]*,\@AUTHORS\@,g; $descr =~ s,\@AUTHORS\@[\S\s\n]*,\@AUTHORS\@,g; $descr =~ s,\@AUTHORS\@,,g; - output($descr, "description($lastname)"); + output($descr, $distro . "/" . $lastname . "/description"); } $descr = ''; next; Modified: trunk/packages/50-tools/tx-merge.sh =================================================================== --- trunk/packages/50-tools/tx-merge.sh 2015-11-15 16:59:02 UTC (rev 94964) +++ trunk/packages/50-tools/tx-merge.sh 2015-11-15 17:47:27 UTC (rev 94965) @@ -1,40 +1,43 @@ #!/bin/bash # Merging script for bidirectional update of a transifex project with svn -LANGNAME="ru" -# Usage validation -[ $# -ne 0 ] || { - echo "Usage: tx-merge.sh <language name>" + +[ -d 50-tx ] || { + echo "Transifex directory not found! CWD must be in your project's root." exit 1 - } -# Set language's name -LANGNAME=$1 +} -[ -d $LANGNAME/po ] || { - echo "Specified language not found or invalid! CWD must be in your project's root." - exit 2 - } +wanted_lang=${@:-*} +langs= +for i in $wanted_lang; do + if test -d $i/po; then + langs="$langs $i" + fi +done -WD="$LANGNAME/po" -#tx pull --> заполнить память переводов --> svn update echo "Checking for new translations..." -tx pull -l $LANGNAME -msgcat -o $WD/../packages.$LANGNAME.po --no-wrap --use-first $WD/gnome.$LANGNAME.po $WD/kde.$LANGNAME.po $WD/base*.$LANGNAME.po $WD/dvd*.$LANGNAME.po $WD/factory*.$LANGNAME.po -echo "Updating working copy..." -svn update -#использовать память переводов --> svn commit --> tx push +cd 50-tx +tx pull +cd .. + echo "Merging new translations..." -for resource in gnome kde base1 base2 dvd1 dvd2 dvd3 dvd4 dvd5 dvd6 dvd7 dvd8 factory1 factory2 factory3 factory4 factory5 factory6 factory7 factory8 factory9; -do - if [ -f $WD/../p.po ] - then - msgmerge --no-wrap -C $WD/../p.po -C $WD/../packages.$LANGNAME.po -U --previous $WD/$resource.$LANGNAME.po 50-pot/$resource.pot - else - msgmerge --no-wrap -C $WD/../packages.$LANGNAME.po -U --previous $WD/$resource.$LANGNAME.po 50-pot/$resource.pot - fi -done +for LANGNAME in $langs; do + msgcat -o 50-tx/packages-$LANGNAME.po --no-wrap --use-first 50-tx/*.$LANGNAME.po + msgcat -o 50-tx/$LANGNAME.po --no-wrap --use-first $LANGNAME/po/*.$LANGNAME.po + svn update $LANGNAME + for resource in patterns gnome kde base1 base2 dvd1 dvd2 dvd3 dvd4 dvd5 dvd6 dvd7 dvd8 factory1 factory2 factory3 factory4 factory5 factory6 factory7 factory8 factory9; + do + echo -n "$resource.$LANGNAME " + if [ -f $LANGNAME.po ] + then + msgmerge --no-wrap -C 50-tx/$LANGNAME.po -C 50-tx/packages.$LANGNAME.po -U --previous $LANGNAME/po/$resource.$LANGNAME.po 50-pot/$resource.pot + else + msgmerge --no-wrap -C 50-tx/packages-$LANGNAME.po -U --previous $LANGNAME/po/$resource.$LANGNAME.po 50-pot/$resource.pot + fi + done echo "Committing to SVN..." -svn ci -m "Automerged from transifex" +svn ci $LANGNAME -m "$LANGNAME automerged from transifex" echo "Pushing to transifex..." tx push -t -l $LANGNAME --skip +done echo "All done!" exit 0
participants (1)
-
minton@svn2.opensuse.org