Lars Vogdt 2011-09-19 16:06:24 +00:00 committed by Git OBS Bridge
commit 1f52eb1137
6 changed files with 376 additions and 312 deletions

View File

@ -12,16 +12,15 @@ set -o errexit
source ${0%create-tlst-step2-create-gnome_gtp.sh}upstream-collect.conf source ${0%create-tlst-step2-create-gnome_gtp.sh}upstream-collect.conf
rm -f create-tlst-temp-osc-projects.lst
for REPOSITORY in ${OSC_REPOSITORIES[@]} ; do for REPOSITORY in ${OSC_REPOSITORIES[@]} ; do
osc ${OSC_APIURL:+--apiurl=$OSC_APIURL} list $REPOSITORY >create-tlst-temp-osc-projects.lst osc ${OSC_APIURL:+--apiurl=$OSC_APIURL} list $REPOSITORY
done done | sort -u >create-tlst-temp-osc-projects.lst
# branches tried for all apps: # branches tried for all apps:
KNOWN_BRANCHES="gnome-2-32" KNOWN_BRANCHES="gnome-3-0"
# branches tried apps with the same name base: # branches tried apps with the same name base:
# Do not forget hardcoded strings in the code below! # Do not forget hardcoded strings in the code below!
APP_BRANCHES="|gimp-2-6" APP_BRANCHES="|gimp-2-6|gtk-3-0|glib-2-28"
# FIXME: support for libgda:release-3-0-branch gnome-background:gnome-2-22 # FIXME: support for libgda:release-3-0-branch gnome-background:gnome-2-22
echo "# This file was generated $(LANG=C LC_ALL=C date) by create-tlst-step2-create-gnome_gtp.sh." >upstream-gnome_gtp.tlst echo "# This file was generated $(LANG=C LC_ALL=C date) by create-tlst-step2-create-gnome_gtp.sh." >upstream-gnome_gtp.tlst

View File

@ -1,6 +1,5 @@
# package domain method repository dir branch # package domain method repository dir branch
# PAM CVS is currently broken: pam Linux-PAM cvs pam.cvs.sourceforge.net:/cvsroot/pam Linux-PAM/po
#pam Linux-PAM cvs pam.cvs.sourceforge.net:/cvsroot/pam Linux-PAM/po
# No update available yet: # No update available yet:
#pidgin pidgin tbz http://downloads.sourceforge.net/pidgin/pidgin-2.7.10.tar.bz2 pidgin-2.7.10/po #pidgin pidgin tbz http://downloads.sourceforge.net/pidgin/pidgin-2.7.11.tar.bz2 pidgin-2.7.11/po
gtkspell gtkspell tgz http://downloads.sourceforge.net/gtkspell/gtkspell-2.0.16.tar.gz gtkspell-2.0.16/po gtkspell gtkspell tgz http://downloads.sourceforge.net/gtkspell/gtkspell-2.0.16.tar.gz gtkspell-2.0.16/po

View File

@ -1,6 +1,6 @@
--- translation-update-upstream-embedded.sh --- translation-update-upstream-embedded.sh
+++ translation-update-upstream-embedded.sh +++ translation-update-upstream-embedded.sh
@@ -34,6 +34,7 @@ @@ -44,6 +44,7 @@
fi fi
} }
@ -8,7 +8,7 @@
DIR=${1:-po} DIR=${1:-po}
DOMAIN=$2 DOMAIN=$2
@@ -91,7 +92,7 @@ @@ -144,7 +145,7 @@
echo "WARNING: Missing $DOMAIN in translation-update-upstream configuration! No updates available." echo "WARNING: Missing $DOMAIN in translation-update-upstream configuration! No updates available."
fi fi
else else

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Sep 7 14:44:21 CEST 2011 - sbrabec@suse.cz
- Supplementary scripts improvements:
* Support for pot-only run (COLLECT_UPSTREAM=false).
* Implemented check for possible strings in patches.
* Support for import of strings from different gettext domain.
* Allow to skip time consuming update by setting SKIP_TUU=true.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jul 7 20:57:26 CEST 2011 - sbrabec@suse.cz Thu Jul 7 20:57:26 CEST 2011 - sbrabec@suse.cz

View File

@ -60,8 +60,9 @@ else
fi fi
POT_NOT_UNIQUE=false POT_NOT_UNIQUE=false
MISSING=true NO_POT=true
for POT in *.pot ; do for POT in *.pot ; do
MISSING=true
if $POT_NOT_UNIQUE ; then if $POT_NOT_UNIQUE ; then
echo "ERROR: Directory $DIR contains more than one .pot file." echo "ERROR: Directory $DIR contains more than one .pot file."
exit 1 exit 1
@ -82,7 +83,12 @@ for POT in *.pot ; do
PO=${PO_PATH##*/} PO=${PO_PATH##*/}
LNG=${PO%.po} LNG=${PO%.po}
if test -f $PO ; then if test -f $PO ; then
if test "$SKIP_TUU" = true ; then
echo "SKIP_TUU is set. Skipping update of $PO."
continue
fi
echo "Updating $PO using translation-update-upstream." echo "Updating $PO using translation-update-upstream."
echo "(You can skip update by setting environment variable SKIP_TUU=true.)"
# PO_PATH is first: Update any string, even if it was already translated. # PO_PATH is first: Update any string, even if it was already translated.
# Swap $PO_PATH and $PO to disable this behavior. # Swap $PO_PATH and $PO to disable this behavior.
msgcat --use-first $PO_PATH $PO -o $PO.new msgcat --use-first $PO_PATH $PO -o $PO.new
@ -109,7 +115,12 @@ for POT in *.pot ; do
PO=${PO_PATH##*/} PO=${PO_PATH##*/}
LNG=${PO%.po} LNG=${PO%.po}
if test -f $PO ; then if test -f $PO ; then
if test "$SKIP_TUU" = true ; then
echo "SKIP_TUU is set. Skipping update of $PO."
continue
fi
echo "Updating $PO using translation-update-upstream mandatory source." echo "Updating $PO using translation-update-upstream mandatory source."
echo "(You can skip update by setting environment variable SKIP_TUU=true.)"
# PO_PATH is first: Update any string, even if it was already translated. # PO_PATH is first: Update any string, even if it was already translated.
# Swap $PO_PATH and $PO to disable this behavior. # Swap $PO_PATH and $PO to disable this behavior.
msgcat --use-first $PO_PATH $PO -o $PO.new msgcat --use-first $PO_PATH $PO -o $PO.new
@ -137,4 +148,9 @@ for POT in *.pot ; do
exit 1 exit 1
fi fi
fi fi
NO_POT=false
done done
if $NO_POT ; then
echo "ERROR: Pot file was not created. Please fix or set command line arguments properly!"
exit 1
fi

View File

@ -8,6 +8,8 @@
# Debug mode. Set to true if you want to keep working directories. # Debug mode. Set to true if you want to keep working directories.
DEBUG=false DEBUG=false
# Set to false to generate only pot files, true to collect po files.
COLLECT_UPSTREAM=true
# Number of CPUs. When > 1, then parallel processing of more po files is possible. # Number of CPUs. When > 1, then parallel processing of more po files is possible.
CPUS=$(cat /proc/cpuinfo | grep processor | wc -l) CPUS=$(cat /proc/cpuinfo | grep processor | wc -l)
WORK_DIR=$PWD WORK_DIR=$PWD
@ -17,6 +19,13 @@ shopt -s nullglob
source ${0%.sh}.conf source ${0%.sh}.conf
function get_pot_name {
POT=
for POT in *.pot ; do
:
done
}
function rpmprep { function rpmprep {
RPMDIR=$HOME/.var.rpmpatch$$ RPMDIR=$HOME/.var.rpmpatch$$
rm -rf BUILD $HOME/.var.rpmpatch$$ rm -rf BUILD $HOME/.var.rpmpatch$$
@ -28,8 +37,20 @@ function rpmprep {
%_builddir $PWD/BUILD %_builddir $PWD/BUILD
EOF EOF
# remove <RELEASE> tag from Release and delete shell escape comments. sed -i '
sed -i '/^Release:/s/[<>]//g;/#%(bash/d' *.spec # Remove <RELEASE> tag from Release and delete shell escape comments.
/^Release:/s/[<>]//g
# Remove bash shell escape comments (gstreamer, calls autoreconf that can fail).
/#%(bash/d
# Remove negative expressions in BuildRequires.
:1
s/^\(BuildRequires:.*[[:space:]]\)-[^[:space:]]*/\1/
t1
/^BuildRequires:[[:space:]]*$/d
# Modify some requirements to work without relevant packages installed.
s/%{xulrunner_version}/dummy/g
s/%{mozilla_ver}/dummy/g
' *.spec
eval rpmbuild --macros=/usr/lib/rpm/macros:/usr/lib/rpm/suse_macros:/usr/lib/rpm/platform/$(uname -i)-linux/macros:/etc/rpm/\\\*:$RPMDIR/macros --nodeps -bp ${*:-*.spec} eval rpmbuild --macros=/usr/lib/rpm/macros:/usr/lib/rpm/suse_macros:/usr/lib/rpm/platform/$(uname -i)-linux/macros:/etc/rpm/\\\*:$RPMDIR/macros --nodeps -bp ${*:-*.spec}
rm -rf $RPMDIR rm -rf $RPMDIR
trap - 0 trap - 0
@ -56,7 +77,7 @@ esac
rm -rf UPSTREAM rm -rf UPSTREAM
mkdir UPSTREAM mkdir UPSTREAM
if ! test -d STAMPS ; then if ! test -d STAMPS ; then
mkdir -p pot mkdir -p pot pot-tuu pot-diff
mkdir OSC PACKAGES UPDATE STAMPS mkdir OSC PACKAGES UPDATE STAMPS
rm -f upstream-collect.log rm -f upstream-collect.log
fi fi
@ -66,7 +87,14 @@ mkdir -p ~/.upstream-collect.tmp
cat >~/.upstream-collect.tmp/translation-update-upstream <<EOF cat >~/.upstream-collect.tmp/translation-update-upstream <<EOF
#!/bin/sh #!/bin/sh
echo "Dummy translation-update-upstream for upstream-collect.sh. Skipping merge of old translations." echo "Dummy translation-update-upstream for upstream-collect.sh. Skipping merge of old translations."
echo \${3:-intltool-update --gettext-package=\${2:-\$T_U_U_DOMAIN} --pot} >\${1:-po}/.translation-update-upstream-implemented echo \${3:-intltool-update\${2+ --gettext-package=\$2} --pot} >\${1:-po}/.translation-update-upstream-implemented
cd \${1:-po}
# Generate and save a copy of the pot file now and compare later.
eval \${3:-intltool-update\${2+ --gettext-package=\$2} --pot}
mkdir -p tuu
for POT in *.pot ; do
mv \$POT tuu/
done
EOF EOF
chmod +x ~/.upstream-collect.tmp/translation-update-upstream chmod +x ~/.upstream-collect.tmp/translation-update-upstream
@ -79,8 +107,13 @@ chmod +x msgheadermerge msgheadermerge-compose msgheadermerge-parse upstream-col
for FILE in gnome-patch-translation-prepare gnome-patch-translation-update ; do for FILE in gnome-patch-translation-prepare gnome-patch-translation-update ; do
cat >~/.upstream-collect.tmp/$FILE <<EOF cat >~/.upstream-collect.tmp/$FILE <<EOF
#!/bin/sh #!/bin/sh
set -x
echo "Dummy $FILE for upstream-collect.sh. Skipping gnome-patch-translation." echo "Dummy $FILE for upstream-collect.sh. Skipping gnome-patch-translation."
# gnome-patch-translation may be a symlink (libgweather), that is why we have to check even with mkdir -p.
if ! test -L gnome-patch-translation ; then
mkdir -p gnome-patch-translation mkdir -p gnome-patch-translation
fi
touch po/.gnome-patch-translation-implemented
EOF EOF
chmod +x ~/.upstream-collect.tmp/$FILE chmod +x ~/.upstream-collect.tmp/$FILE
done done
@ -94,13 +127,13 @@ if ! $FULL_PROCESS ; then
for ARCHIVE_ in translation-update-upstream-*.tar.bz2 ; do for ARCHIVE_ in translation-update-upstream-*.tar.bz2 ; do
ARCHIVE=$ARCHIVE_ ARCHIVE=$ARCHIVE_
done done
if ! test -d UPDATE_OLD ; then if ! test -f STAMPS/UPDATE_old_tarball ; then
mkdir UPDATE_OLD cd UPDATE
cd UPDATE_OLD
tar -jxf ../$ARCHIVE tar -jxf ../$ARCHIVE
# If it is not a full process, increment only release # If it is not a full process, increment only release
# SNAPSHOT 20090213 -> 20090213.1, 20090213.1 -> 20090213.2 # SNAPSHOT 20090213 -> 20090213.1, 20090213.1 -> 20090213.2
cd .. cd ..
touch STAMPS/UPDATE_old_tarball
fi fi
SNAPSHOT=${ARCHIVE#translation-update-upstream-} SNAPSHOT=${ARCHIVE#translation-update-upstream-}
SNAPSHOT=${SNAPSHOT%.tar.bz2} SNAPSHOT=${SNAPSHOT%.tar.bz2}
@ -134,7 +167,7 @@ for TLST in *.tlst ; do
fi fi
echo echo
echo "$(tput setf 3)Processing: package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:-(default)} mandatory=$MANDATORY$(tput init)" echo "$(tput setf 3)Processing: package=$PACKAGE domain=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:-(default)} mandatory=$MANDATORY$(tput init)"
# NOTE: Force a limitation: tlst rules for one package must be placed on contiguous line sequence # NOTE: Force a limitation: tlst rules for one package must be placed on contiguous line sequence
if ! $DEBUG ; then if ! $DEBUG ; then
@ -160,31 +193,16 @@ for TLST in *.tlst ; do
fi fi
done done
if $SKIP_PACKAGE ; then 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."
exit 255
else
echo " Not scheduled to process. Recycling old update..." echo " Not scheduled to process. Recycling old update..."
mkdir -p $WORK_DIR/UPDATE/po #FIXME mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$DIR/${BRANCH:-__HEAD__}
mv $WORK_DIR/UPDATE_OLD/po/$DOMAIN $WORK_DIR/UPDATE/po/ # touch $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok
fi
else
if test -d $WORK_DIR/UPDATE/po/$DOMAIN ; then
echo " Already recycled old update..."
else
echo " Not scheduled to process. No update available..."
fi
fi
mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$DIR/${BRANCH:-__HEAD__}
touch $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok
continue continue
fi fi
fi fi
cd $WORK_DIR/OSC cd $WORK_DIR/OSC
RPMPKGDIR=$(echo $WORK_DIR/PACKAGES/$PACKAGE) RPMPKGDIR=$WORK_DIR/PACKAGES/$PACKAGE
if ! test -f $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok ; then if ! test -f $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok ; then
if ! test -d "$RPMPKGDIR" ; then if ! test -d "$RPMPKGDIR" ; then
@ -211,9 +229,8 @@ for TLST in *.tlst ; do
echo "$(tput setf 4)Removed possibly incorrect temporary files from previous runs. Please re-run $0 now.$(tput init)" echo "$(tput setf 4)Removed possibly incorrect temporary files from previous runs. Please re-run $0 now.$(tput init)"
exit 1 exit 1
fi fi
RPMPKGDIR=$(echo $WORK_DIR/PACKAGES/$PACKAGE)
cd $RPMPKGDIR cd $RPMPKGDIR
T_U_U_DOMAIN=$DOMAIN rpmprep $PACKAGE.spec rpmprep $PACKAGE.spec
else else
# During processing, builddir may contain incomplete po files: # During processing, builddir may contain incomplete po files:
rm $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok rm $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok
@ -226,33 +243,54 @@ for TLST in *.tlst ; do
fi fi
cd $RPMPODIR cd $RPMPODIR
get_pot_name
REAL_DOMAIN=${POT%.pot}
if test -f .gnome-patch-translation-implemented ; then
echo $PACKAGE >>$WORK_DIR/gnome-patch-translation.lst
fi
if test -f .translation-update-upstream-implemented ; then if test -f .translation-update-upstream-implemented ; then
if bash ./.translation-update-upstream-implemented ; then if bash ./.translation-update-upstream-implemented ; then
cp -a $DOMAIN.pot $WORK_DIR/pot/ get_pot_name
REAL_DOMAIN=${POT%.pot}
cp -a $REAL_DOMAIN.pot $WORK_DIR/pot/
# pot-tuu DOMAIN is the external domain - LCN may use different domain
cp -a tuu/$REAL_DOMAIN.pot $WORK_DIR/pot-tuu/$DOMAIN.pot
# Verify that patches don't introduce new strings.
msgcomm --uniq $REAL_DOMAIN.pot tuu/$REAL_DOMAIN.pot -o $WORK_DIR/pot-diff/$DOMAIN.pot
if ! test -f .gnome-patch-translation-implemented ; then
if test -f $WORK_DIR/pot-diff/$DOMAIN.pot ; then
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: new pot file contains unique strings, please check gnome-patch-translation"
fi
fi
else else
# translation-update-upstream is implemented but fails: # translation-update-upstream is implemented but fails:
if test -f $DOMAIN.pot ; then get_pot_name
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: pot file update error, continuing with original $DOMAIN.pot" REAL_DOMAIN=${POT%.pot}
if test -f $REAL_DOMAIN.pot ; then
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: pot file update error, continuing with original $DOMAIN.pot"
cp -a $DOMAIN.pot $WORK_DIR/pot/ cp -a $DOMAIN.pot $WORK_DIR/pot/
else else
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: pot file update error, no way to update" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: pot file update error, no way to update"
mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$REPODIR/${BRANCH:-__HEAD__} mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$REPODIR/${BRANCH:-__HEAD__}
continue continue
fi fi
fi fi
else else
echo "$RPMPODIR: Missing or incorrect translation-update-upstream in the spec file." echo "$RPMPODIR: Missing or incorrect translation-update-upstream in the spec file."
# translation-update-upstream is implemented, try the default: # translation-update-upstream is implemented, try the default with the upstream domain:
if intltool-update --gettext-package=$DOMAIN --pot ; then if intltool-update --gettext-package=$DOMAIN --pot ; then
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: packaging error, package does not call translation-update-upstream properly" get_pot_name
REAL_DOMAIN=${POT%.pot}
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: packaging error, package does not call translation-update-upstream properly"
cp -a $DOMAIN.pot $WORK_DIR/pot/ cp -a $DOMAIN.pot $WORK_DIR/pot/
else else
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: packaging error, package does not call translation-update-upstream properly and intltool-update fails, no way to update" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: packaging error, package does not call translation-update-upstream properly and intltool-update fails, no way to update"
mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$REPODIR/${BRANCH:-__HEAD__} mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$REPODIR/${BRANCH:-__HEAD__}
continue continue
fi fi
fi fi
if $COLLECT_UPSTREAM ; then
cd $WORK_DIR/UPSTREAM cd $WORK_DIR/UPSTREAM
let SERIAL++ || : let SERIAL++ || :
mkdir $SERIAL mkdir $SERIAL
@ -395,35 +433,35 @@ for TLST in *.tlst ; do
( (
if $MANDATORY ; then if $MANDATORY ; then
# Mandatory sources: copy the whole source to the mandatory po directory. Strings must not be skipped. # Mandatory sources: copy the whole source to the mandatory po directory. Strings must not be skipped.
mkdir -p $WORK_DIR/UPDATE/po-mandatory/$DOMAIN mkdir -p $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN
if test -f $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO ; then if test -f $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN/$PO ; then
msgcat --use-first $PO $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO -o $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO~ msgcat --use-first $PO $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN/$PO -o $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN/$PO~
mv $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO~ $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO mv $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN/$PO~ $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN/$PO
else else
msgcat $PO -o $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO msgcat $PO -o $WORK_DIR/UPDATE/po-mandatory/$REAL_DOMAIN/$PO
fi fi
else else
# step 0: Merge new po file into old project. Removes unused (too new) translations. # 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/$REAL_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" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgmerge error"
continue continue
fi fi
if test -f $RPMPODIR/$PO ; then if test -f $RPMPODIR/$PO ; then
# step 1: Clean the RPM po file to be safe. # step 1: Clean the RPM po file to be safe.
if ! msgmerge --no-fuzzy-matching $RPMPODIR/$PO $RPMPODIR/$DOMAIN.pot -o $RPMPODIR/${PO%.po}-downstream.po ; then if ! msgmerge --no-fuzzy-matching $RPMPODIR/$PO $RPMPODIR/$REAL_DOMAIN.pot -o $RPMPODIR/${PO%.po}-downstream.po ; then
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN repository=$REPO directory=$RPMPODIR branch=${BRANCH:(default)} po=$PO: package msgmerge error" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN repository=$REPO directory=$RPMPODIR branch=${BRANCH:(default)} po=$PO: package msgmerge error"
# Failed initial msgmerge is fatal. There is no way to update. Build may fail. # Failed initial msgmerge is fatal. There is no way to update. Build may fail.
continue continue
fi fi
# Do the magic: # Do the magic:
# step 2: Merge new upstream po and previous upstream updates to RPM po (if any). # step 2: Merge new upstream po and previous upstream updates to RPM po (if any).
OLD_UPDATE=false OLD_UPDATE=false
if test -f $WORK_DIR/UPDATE/po/$DOMAIN/$PO ; then if test -f $WORK_DIR/UPDATE/po/$REAL_DOMAIN/$PO ; then
if $WORK_DIR/msgheadermerge $WORK_DIR/UPDATE/po/$DOMAIN/$PO $PO ${PO%.po}-uheader.po --mergemode --continue ; then if $WORK_DIR/msgheadermerge $WORK_DIR/UPDATE/po/$REAL_DOMAIN/$PO $PO ${PO%.po}-uheader.po --mergemode --continue ; then
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" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN repository=$REPO directory=$RPMPODIR branch=${BRANCH:(default)} po=$PO: old po file, skipping fixes"
OLD_UPDATE=true OLD_UPDATE=true
fi 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/$REAL_DOMAIN/$PO -o ${PO%.po}-upstream.po
else else
cp -a ${PO%.po}-backport.po~ ${PO%.po}-upstream.po cp -a ${PO%.po}-backport.po~ ${PO%.po}-upstream.po
fi fi
@ -455,7 +493,7 @@ for TLST in *.tlst ; do
if test -f ${PO%.po}-additions.po~ ; then if test -f ${PO%.po}-additions.po~ ; then
msgattrib --no-obsolete --force-po ${PO%.po}-additions.po~ -o ${PO%.po}-additions.po msgattrib --no-obsolete --force-po ${PO%.po}-additions.po~ -o ${PO%.po}-additions.po
mkdir -p $WORK_DIR/po-review/${PO%.po}/additions 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 msgcat --use-first ${PO%.po}-header.po ${PO%.po}-additions.po -o $WORK_DIR/po-review/${PO%.po}/additions/$REAL_DOMAIN.po
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/additions rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/additions
fi fi
if test -f ${PO%.po}-fixes.po~ ; then if test -f ${PO%.po}-fixes.po~ ; then
@ -468,16 +506,16 @@ for TLST in *.tlst ; do
msgcat ${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 if $OLD_UPDATE ; then
mkdir -p $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR 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 cp -a ${PO%.po}-fixes-clean.po $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR/$REAL_DOMAIN.po
cp -a ${PO%.po}-fixes-review.po $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR/$DOMAIN-review.po cp -a ${PO%.po}-fixes-review.po $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR/$REAL_DOMAIN-review.po
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR
if test -d $WORK_DIR/po-review/${PO%.po}/excluded-changes ; then if test -d $WORK_DIR/po-review/${PO%.po}/excluded-changes ; then
echo -e "Excluded changes contains changes introduced by upstream po files with\ntime stamp older than our package." >$WORK_DIR/po-review/${PO%.po}/excluded-changes/README echo -e "Excluded changes contains changes introduced by upstream po files with\ntime stamp older than our package." >$WORK_DIR/po-review/${PO%.po}/excluded-changes/README
fi fi
else else
mkdir -p $WORK_DIR/po-review/${PO%.po}/changes mkdir -p $WORK_DIR/po-review/${PO%.po}/changes
cp -a ${PO%.po}-fixes-clean.po $WORK_DIR/po-review/${PO%.po}/changes/$DOMAIN.po cp -a ${PO%.po}-fixes-clean.po $WORK_DIR/po-review/${PO%.po}/changes/$REAL_DOMAIN.po
cp -a ${PO%.po}-fixes-review.po $WORK_DIR/po-review/${PO%.po}/changes/$DOMAIN-review.po cp -a ${PO%.po}-fixes-review.po $WORK_DIR/po-review/${PO%.po}/changes/$REAL_DOMAIN-review.po
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/changes rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/changes
fi fi
fi fi
@ -493,20 +531,20 @@ for TLST in *.tlst ; do
fi fi
if test -f $RPMPODIR/${PO%.po}-updates.po ; then 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 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" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgcat error"
continue continue
fi fi
mv $RPMPODIR/${PO%.po}-updates.po~ $RPMPODIR/${PO%.po}-updates.po mv $RPMPODIR/${PO%.po}-updates.po~ $RPMPODIR/${PO%.po}-updates.po
else else
# To get surely a valid po file, use msgcat instead of cp. # To get surely a valid po file, use msgcat instead of cp.
if ! msgcat ${PO%.po}-backport.po -o $RPMPODIR/${PO%.po}-updates.po ; then if ! msgcat ${PO%.po}-backport.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" echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE domain=$DOMAIN gettext-package=$REAL_DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgcat error"
continue continue
fi fi
fi fi
# step 2: Prepare texts for review. # step 2: Prepare texts for review.
mkdir -p $WORK_DIR/po-review/${PO%.po}/new-files mkdir -p $WORK_DIR/po-review/${PO%.po}/new-files
cp -a $RPMPODIR/${PO%.po}-updates.po $WORK_DIR/po-review/${PO%.po}/new-files/$DOMAIN.po cp -a $RPMPODIR/${PO%.po}-updates.po $WORK_DIR/po-review/${PO%.po}/new-files/$REAL_DOMAIN.po
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/new-files rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/new-files
fi fi
fi fi
@ -536,22 +574,23 @@ for TLST in *.tlst ; do
wait wait
fi fi
mkdir -p $WORK_DIR/UPDATE/po/$DOMAIN mkdir -p $WORK_DIR/UPDATE/po/$REAL_DOMAIN
cd $RPMPODIR cd $RPMPODIR
for POX in *-updates.po ; do for POX in *-updates.po ; do
PO=${POX/-updates/} PO=${POX/-updates/}
cp -a $POX $WORK_DIR/UPDATE/po/$DOMAIN/$PO cp -a $POX $WORK_DIR/UPDATE/po/$REAL_DOMAIN/$PO
done done
mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$DIR/${BRANCH:-__HEAD__}
touch $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok
if ! $DEBUG ; then if ! $DEBUG ; then
rm -rf $WORK_DIR/UPSTREAM/$SERIAL rm -rf $WORK_DIR/UPSTREAM/$SERIAL
fi fi
done fi
mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$DIR/${BRANCH:-__HEAD__}
touch $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok
done
done done
if ! $DEBUG ; then if ! $DEBUG ; then
@ -560,6 +599,7 @@ if ! $DEBUG ; then
fi fi
fi fi
if $COLLECT_UPSTREAM ; then
cd $WORK_DIR/UPDATE cd $WORK_DIR/UPDATE
if test -d po ; then if test -d po ; then
tar -j -c -f $WORK_DIR/translation-update-upstream-$SNAPSHOT.tar.bz2 po tar -j -c -f $WORK_DIR/translation-update-upstream-$SNAPSHOT.tar.bz2 po
@ -567,6 +607,7 @@ fi
if test -d po-mandatory ; then if test -d po-mandatory ; then
tar -j -c -f $WORK_DIR/translation-update-mandatory-$SNAPSHOT.tar.bz2 po-mandatory tar -j -c -f $WORK_DIR/translation-update-mandatory-$SNAPSHOT.tar.bz2 po-mandatory
fi fi
fi
cd $WORK_DIR cd $WORK_DIR
if ! $DEBUG ; then if ! $DEBUG ; then