diff --git a/lcn-sle.hook b/lcn-sle.hook deleted file mode 100644 index b5b917b..0000000 --- a/lcn-sle.hook +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if test -z "$PACKAGE" ; then - echo "This is a hook file for upstream-collect.sh. It cannot be called separately." - exit 255 -fi - -# Hack for compiz that has a non-standard po location -if test $DOMAIN = compiz ; then - RPMPODIR=$(echo $RPMPKGDIR/BUILD/compiz/compiz-*/${DIR#*/}) -fi diff --git a/lcn-sle.tlst b/lcn-sle.tlst index e4b84cc..8b0f160 100644 --- a/lcn-sle.tlst +++ b/lcn-sle.tlst @@ -97,7 +97,7 @@ sabayon sabayon lcn - sa #NA: scpm_groups scpm_groups lcn - scpm_groups/po SLE11SP1 #NA: scpm_lib scpm_lib lcn - scpm_lib/po SLE11SP1 shared-mime-info shared-mime-info lcn - shared-mime-info/po SLE11SP1 -simple-ccsm-kde simple-ccsm-kde lcn - simple-ccsm-kde/po SLE11SP1 +#DROPPED: simple-ccsm-kde simple-ccsm-kde lcn - simple-ccsm-kde/po SLE11SP1 #NA: slideshow slideshow lcn - slideshow/po SLE11SP1 #NA: slideshow-sled slideshow-sled lcn - slideshow-sled/po SLE11SP1 #NA: suseplugger suseplugger lcn - suseplugger/po SLE11SP1 diff --git a/misc.tlst b/misc.tlst index bebb2d6..377f8c7 100644 --- a/misc.tlst +++ b/misc.tlst @@ -3,3 +3,4 @@ #pam Linux-PAM cvs pam.cvs.sourceforge.net:/cvsroot/pam Linux-PAM/po # No update available yet: #pidgin pidgin tbz http://downloads.sourceforge.net/pidgin/pidgin-2.7.10.tar.bz2 pidgin-2.7.10/po +gtkspell gtkspell tgz http://downloads.sourceforge.net/gtkspell/gtkspell-2.0.16.tar.gz gtkspell-2.0.16/po diff --git a/msgheadermerge b/msgheadermerge index 5b1c86b..3febb5e 100644 --- a/msgheadermerge +++ b/msgheadermerge @@ -5,7 +5,7 @@ # This tool merges headers of two .po files and never loses extra info (e. g. plurals). rm -rf {${1%.po},${2%.po}}-msgheadermerge-temp.{merge-dir,order} -trap "rm -rf {${1%.po},${2%.po}}-msgheadermerge-temp.{merge-dir,order} ${2%.po}-msgheadermerge-tempheader.po" 0 +trap "rm -rf {${1%.po},${2%.po}}-msgheadermerge-temp.{merge-dir,order} ${2%.po}-msgheadermerge-tempheader{,1}.po" 0 RC=0 @@ -44,7 +44,7 @@ mv ${2%.po}-msgheadermerge-temp.merge-dir/* ${1%.po}-msgheadermerge-temp.merge-d cat ${1%.po}-msgheadermerge-temp.order >>${2%.po}-msgheadermerge-temp.order msgmerge --quiet --force-po $2 $0-empty.pot -o ${2%.po}-msgheadermerge-tempheader.po -sed -i '/^#~/,$d' ${2%.po}-msgheadermerge-tempheader.po -msgfilter --force-po -i ${2%.po}-msgheadermerge-tempheader.po -o $3 $0-compose ${1%.po}-msgheadermerge-temp.merge-dir ${2%.po}-msgheadermerge-temp.order +msgattrib --no-obsolete --force-po ${2%.po}-msgheadermerge-tempheader.po -o ${2%.po}-msgheadermerge-tempheader1.po +msgfilter --force-po -i ${2%.po}-msgheadermerge-tempheader1.po -o $3 $0-compose ${1%.po}-msgheadermerge-temp.merge-dir ${2%.po}-msgheadermerge-temp.order exit $RC diff --git a/msgheadermerge-compose b/msgheadermerge-compose index eda801f..2b5d7ee 100644 --- a/msgheadermerge-compose +++ b/msgheadermerge-compose @@ -17,7 +17,11 @@ if test -d $1 ; then fi rm -f "$PO_HEADER_DIR/$REPLY" done - rmdir $PO_HEADER_DIR + if ! rmdir $PO_HEADER_DIR ; then + echo "WARNING: These items of $PO_HEADER_DIR were not processed:" >&2 + ls -1 $PO_HEADER_DIR >&2 + echo "This can happen if the file lacks one of mandatory header items." >&2 + fi else exit 1 fi diff --git a/opensuse.tlst b/opensuse.tlst index 58c751d..f27e31b 100644 --- a/opensuse.tlst +++ b/opensuse.tlst @@ -35,7 +35,7 @@ pam_krb5 pam_krb5 lcn - pa #NA: pam_unix2 pam_unix2 lcn - pam_unix2/po #TODO: patterns patterns lcn - patterns/po #YAST: sax sax lcn - sax/po -simple-ccsm-kde simple-ccsm-kde lcn - simple-ccsm-kde/po +#DROPPED: simple-ccsm-kde simple-ccsm-kde lcn - simple-ccsm-kde/po #NA: slideshow slideshow lcn - slideshow/po #NA: SUSEgreeter SUSEgreeter lcn - SUSEgreeter/po #NA: susetranslations susetranslations lcn - susetranslations/po diff --git a/translation-update-mandatory-20110211.tar.bz2 b/translation-update-mandatory-20110222.tar.bz2 similarity index 100% rename from translation-update-mandatory-20110211.tar.bz2 rename to translation-update-mandatory-20110222.tar.bz2 diff --git a/translation-update-upstream-20110211.tar.bz2 b/translation-update-upstream-20110211.tar.bz2 deleted file mode 100644 index ae3a96b..0000000 --- a/translation-update-upstream-20110211.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7a7ac7aba0799483f3a692dcb613fe71aa54aa389f11868abda47efb04cc7d27 -size 6426167 diff --git a/translation-update-upstream-20110222.tar.bz2 b/translation-update-upstream-20110222.tar.bz2 new file mode 100644 index 0000000..83c27d1 --- /dev/null +++ b/translation-update-upstream-20110222.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50b71d7338106a8831bf69a26ed0f7367d08c53108c88b37b98ec917aa62de5c +size 6788659 diff --git a/translation-update-upstream.changes b/translation-update-upstream.changes index 9c10286..3437748 100644 --- a/translation-update-upstream.changes +++ b/translation-update-upstream.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Feb 23 17:11:45 CET 2011 - sbrabec@suse.cz + +- Added translations for more packages (bnc#673924). +- Supplementary scripts improvements: + * Improved support for partial translations update. + * Added support for parallel processing of po files. + * Do not generate empty new translations. + * Use gettext-tools instead of sed hacks. + ------------------------------------------------------------------- Mon Feb 14 15:12:54 CET 2011 - sbrabec@suse.cz diff --git a/translation-update-upstream.spec b/translation-update-upstream.spec index 7573e4a..7774777 100644 --- a/translation-update-upstream.spec +++ b/translation-update-upstream.spec @@ -21,9 +21,11 @@ Name: translation-update-upstream License: GPLv2+ Group: System/Localization -Version: 20110211 +Version: 20110222 Release: 1 Summary: Tool for Translation Update from Upstream +# Ignore cracklib, as it causes build loop cracklib <-> translation-update-upstream +#!BuildIgnore: cracklib libcrack2 Provides: translation-update-tool Source: %{name}-%{version}.tar.bz2 Source1: %{name}.in @@ -50,7 +52,6 @@ Source60: upstream-gnome_gtp.tlst Source61: upstream-gnome_gtp.hook Source62: freedesktop_org.tlst Source63: lcn-sle.tlst -Source64: lcn-sle.hook Source65: misc.tlst Source66: opensuse.tlst BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/upstream-collect.sh b/upstream-collect.sh index 7f4c6db..ea3897f 100644 --- a/upstream-collect.sh +++ b/upstream-collect.sh @@ -6,8 +6,11 @@ # If you want to use po files for completing of translations, you can remove --no-fuzzy-matching. # It will run much slower, but you could start with fuzzy matches. -WORK_DIR=$PWD +# Debug mode. Set to true if you want to keep working directories. DEBUG=false +# Number of CPUs. When > 1, then parallel processing of more po files is possible. +CPUS=$(cat /proc/cpuinfo | grep processor | wc -l) +WORK_DIR=$PWD set -o errexit shopt -s nullglob @@ -32,7 +35,7 @@ EOF trap - 0 } -ONLY_PACKAGE= +ONLY_PACKAGES=() FULL_PROCESS=true SNAPSHOT=$(LC_ALL=C LANG=C date +%Y%m%d) case $1 in @@ -45,7 +48,7 @@ case $1 in "" ) ;; * ) - ONLY_PACKAGE="$1" + ONLY_PACKAGES=("$@") FULL_PROCESS=false ;; esac @@ -53,7 +56,8 @@ esac rm -rf UPSTREAM mkdir UPSTREAM if ! test -d STAMPS ; then - mkdir OSC PACKAGES UPDATE STAMPS pot + mkdir -p pot + mkdir OSC PACKAGES UPDATE STAMPS rm -f upstream-collect.log fi @@ -96,6 +100,7 @@ if ! $FULL_PROCESS ; then tar -jxf ../$ARCHIVE # If it is not a full process, increment only release # SNAPSHOT 20090213 -> 20090213.1, 20090213.1 -> 20090213.2 + cd .. fi SNAPSHOT=${ARCHIVE#translation-update-upstream-} SNAPSHOT=${SNAPSHOT%.tar.bz2} @@ -107,7 +112,6 @@ if ! $FULL_PROCESS ; then let SNAPSHOT_PART2++ fi SNAPSHOT=$SNAPSHOT_PART1.$SNAPSHOT_PART2 - cd .. fi SERIAL=0 @@ -147,8 +151,15 @@ for TLST in *.tlst ; do continue fi - if test -n "$ONLY_PACKAGE" ; then - if test "$ONLY_PACKAGE" != "$PACKAGE" ; then + if test "${#ONLY_PACKAGES}" -gt 0 ; then + SKIP_PACKAGE=true + for ONLY_PACKAGE in "${ONLY_PACKAGES[@]}" ; do + if test "$ONLY_PACKAGE" = "$PACKAGE" ; then + SKIP_PACKAGE=false + break + fi + done + if $SKIP_PACKAGE ; then if test -d $WORK_DIR/UPDATE_OLD/po/$DOMAIN ; then if test -d $WORK_DIR/UPDATE/po/$DOMAIN ; then echo "Should not happen. Internal error." @@ -379,6 +390,7 @@ for TLST in *.tlst ; do # foo-updates.po: fixes + additions in a single file, clean form with an useful header (this file will be copied to UPDATE/) # for PO in *.po ; do + ( if $MANDATORY ; then # Mandatory sources: copy the whole source to the mandatory po directory. Strings must not be skipped. mkdir -p $WORK_DIR/UPDATE/po-mandatory/$DOMAIN @@ -390,7 +402,7 @@ for TLST in *.tlst ; do fi else # step 0: Merge new po file into old project. Removes unused (too new) translations. - if ! msgmerge --no-fuzzy-matching $PO $RPMPODIR/$DOMAIN.pot -o ${PO%.po}-backport.po ; then + if ! msgmerge --no-fuzzy-matching $PO $RPMPODIR/$DOMAIN.pot -o ${PO%.po}-backport.po~ ; then echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgmerge error" continue fi @@ -409,49 +421,49 @@ for TLST in *.tlst ; do echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN repository=$REPO directory=$RPMPODIR branch=${BRANCH:(default)} po=$PO: old po file, skipping fixes" OLD_UPDATE=true fi - msgcat --force-po --use-first ${PO%.po}-uheader.po ${PO%.po}-backport.po $WORK_DIR/UPDATE/po/$DOMAIN/$PO -o ${PO%.po}-upstream.po + msgcat --force-po --use-first ${PO%.po}-uheader.po ${PO%.po}-backport.po~ $WORK_DIR/UPDATE/po/$DOMAIN/$PO -o ${PO%.po}-upstream.po else - cp -a ${PO%.po}-backport.po ${PO%.po}-upstream.po + cp -a ${PO%.po}-backport.po~ ${PO%.po}-upstream.po fi # step 3: Join both translations, without --use-first string changes will disappear as fuzzy. msgcat --force-po ${PO%.po}-upstream.po $RPMPODIR/${PO%.po}-downstream.po -o ${PO%.po}-allfz.po msgcat --use-first --force-po ${PO%.po}-upstream.po $RPMPODIR/${PO%.po}-downstream.po -o ${PO%.po}-all.po # step 4: Find string fixes (existed before, now different). - msgcat --force-po --unique ${PO%.po}-all.po ${PO%.po}-allfz.po -o ${PO%.po}-fixes.po + msgcat --force-po --unique ${PO%.po}-all.po ${PO%.po}-allfz.po -o ${PO%.po}-fixes.po~ # step 5: Find newly translated strings (translation removal is not supported). - msgcat --force-po --unique $RPMPODIR/${PO%.po}-downstream.po ${PO%.po}-all.po -o ${PO%.po}-additions.po + msgcat --force-po --unique $RPMPODIR/${PO%.po}-downstream.po ${PO%.po}-all.po -o ${PO%.po}-additions.po~ # step 6: Join both to collect all known fixes. if $OLD_UPDATE ; then # If the update has an old time stamp, don't include fixes. Use just additions. - msgcat ${PO%.po}-additions.po -o $RPMPODIR/${PO%.po}-updatesraw.po + msgcat ${PO%.po}-additions.po~ -o $RPMPODIR/${PO%.po}-updatesraw.po else - msgcat ${PO%.po}-fixes.po ${PO%.po}-additions.po -o $RPMPODIR/${PO%.po}-updatesraw.po + msgcat ${PO%.po}-fixes.po~ ${PO%.po}-additions.po~ -o $RPMPODIR/${PO%.po}-updatesraw.po fi # Are there any updated? If no, game over. if test -f $RPMPODIR/${PO%.po}-updatesraw.po ; then # step 7: Compose the best po file header. $WORK_DIR/msgheadermerge $RPMPODIR/$PO ${PO%.po}-upstream.po ${PO%.po}-header.po --newdate # step 8: And yet another ugly game to get rid commented out garbage. - sed '/#~/d' <$RPMPODIR/${PO%.po}-updatesraw.po >$RPMPODIR/${PO%.po}-updates.po~ + msgattrib --no-obsolete --force-po $RPMPODIR/${PO%.po}-updatesraw.po -o $RPMPODIR/${PO%.po}-updates.po~ # step 9: Merge correct header to the updates file. msgcat --no-location --use-first ${PO%.po}-header.po $RPMPODIR/${PO%.po}-updates.po~ -o $RPMPODIR/${PO%.po}-updates.po fi # step 10: Prepare texts for review. We created them in previous steps, but files need cleanup. if test -f ${PO%.po}-header.po ; then - if test -f ${PO%.po}-additions.po ; then - sed -i '/#~/d' ${PO%.po}-additions.po + if test -f ${PO%.po}-additions.po~ ; then + msgattrib --no-obsolete --force-po ${PO%.po}-additions.po~ -o ${PO%.po}-additions.po mkdir -p $WORK_DIR/po-review/${PO%.po}/additions msgcat --use-first ${PO%.po}-header.po ${PO%.po}-additions.po -o $WORK_DIR/po-review/${PO%.po}/additions/$DOMAIN.po rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/additions fi - if test -f ${PO%.po}-fixes.po ; then - sed -i '/#~/d' ${PO%.po}-fixes.po + if test -f ${PO%.po}-fixes.po~ ; then + msgattrib --no-obsolete --force-po ${PO%.po}-fixes.po~ -o ${PO%.po}-fixes.po msgcat --use-first ${PO%.po}-header.po ${PO%.po}-fixes.po -o ${PO%.po}-fixes-clean.po fi if test -f ${PO%.po}-fixes-clean.po ; then msgmerge ${PO%.po}-allfz.po ${PO%.po}-fixes-clean.po -o ${PO%.po}-fixes-review.po~ - sed -i '/#~/d' ${PO%.po}-fixes-review.po~ - msgcat ${PO%.po}-fixes-review.po~ -o ${PO%.po}-fixes-review.po + msgattrib --no-obsolete --force-po ${PO%.po}-fixes-review.po~ -o ${PO%.po}-fixes-review.po~~ + msgcat ${PO%.po}-fixes-review.po~~ -o ${PO%.po}-fixes-review.po if $OLD_UPDATE ; then mkdir -p $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR cp -a ${PO%.po}-fixes-clean.po $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR/$DOMAIN.po @@ -469,10 +481,14 @@ for TLST in *.tlst ; do fi fi else - # If backport was empty, no file was generated. - if test -f ${PO%.po}-backport.po ; then + # Test is not needed in current msgmerge, file is generated even if there is nothing inside. + if test -f ${PO%.po}-backport.po~ ; then # step 1: Merge new po and previous updates (if any). - sed -i '/#~/d' ${PO%.po}-backport.po + msgattrib --no-obsolete --no-fuzzy --translated ${PO%.po}-backport.po~ -o ${PO%.po}-backport.po + if ! test -f ${PO%.po}-backport.po ; then + # backport file does not contain anything useful + continue + fi if test -f $RPMPODIR/${PO%.po}-updates.po ; then if ! msgcat --force-po --use-first ${PO%.po}-backport.po $RPMPODIR/${PO%.po}-updates.po -o $RPMPODIR/${PO%.po}-updates.po~ ; then echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgcat error" @@ -493,7 +509,30 @@ for TLST in *.tlst ; do fi fi fi + ) & + if test $CPUS -le 1 ; then + wait + else + echo "JOBS: New job launched." + SHOWME=true + while test $(jobs -p | wc -l) -ge $CPUS ; do + if $SHOWME ; then + echo -n "JOBS: $CPUS jobs running. Will check later~" + SHOWME=false + else + echo -n "~" + fi + sleep 3 + done + fi + if ! $SHOWME ; then + echo "JOBS: Releasing." + fi done + if test $CPUS -gt 1 ; then + echo "JOBS: All tasks launched. Waiting for results." + wait + fi mkdir -p $WORK_DIR/UPDATE/po/$DOMAIN cd $RPMPODIR diff --git a/upstream-gnome_gtp.hook b/upstream-gnome_gtp.hook index 3003e25..a3b3084 100644 --- a/upstream-gnome_gtp.hook +++ b/upstream-gnome_gtp.hook @@ -13,9 +13,6 @@ fi if test $DOMAIN = banshee-1 ; then REPODIR=banshee/banshee/po fi -if test $DOMAIN = beagle -a "$BRANCH" = "" ; then - REPODIR=beagle/beagle/po -fi # Hack for gnome-themes, which bundles several projects in SuSE: if test $DOMAIN = gnome-themes ; then RPMPODIR=$(echo $RPMPKGDIR/BUILD/gnome-themes-*/${DIR#*/})