- Supplementary scripts improvements:
* Support for pot-only run (COLLECT_UPSTREAM=false). * Implemented check for possible strings in patches. OBS-URL: https://build.opensuse.org/package/show/Base:System/translation-update-upstream?expand=0&rev=27
This commit is contained in:
parent
6293a4f0f4
commit
53262446b9
@ -12,16 +12,15 @@ set -o errexit
|
||||
|
||||
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
|
||||
osc ${OSC_APIURL:+--apiurl=$OSC_APIURL} list $REPOSITORY >create-tlst-temp-osc-projects.lst
|
||||
done
|
||||
osc ${OSC_APIURL:+--apiurl=$OSC_APIURL} list $REPOSITORY
|
||||
done | sort -u >create-tlst-temp-osc-projects.lst
|
||||
|
||||
# branches tried for all apps:
|
||||
KNOWN_BRANCHES="gnome-2-32"
|
||||
KNOWN_BRANCHES="gnome-3-0"
|
||||
# branches tried apps with the same name base:
|
||||
# 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
|
||||
|
||||
echo "# This file was generated $(LANG=C LC_ALL=C date) by create-tlst-step2-create-gnome_gtp.sh." >upstream-gnome_gtp.tlst
|
||||
|
@ -1,6 +1,5 @@
|
||||
# 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:
|
||||
#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
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 18 18:27:20 CEST 2011 - sbrabec@suse.cz
|
||||
|
||||
- Supplementary scripts improvements:
|
||||
* Support for pot-only run (COLLECT_UPSTREAM=false).
|
||||
* Implemented check for possible strings in patches.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 7 20:57:26 CEST 2011 - sbrabec@suse.cz
|
||||
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
# Debug mode. Set to true if you want to keep working directories.
|
||||
DEBUG=false
|
||||
# Set to false to generate only pot files, true to collect po files.
|
||||
COLLECT_UPSTREAM=true
|
||||
# FIXME: false has problems with stamps!!!
|
||||
# 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
|
||||
@ -28,8 +31,20 @@ function rpmprep {
|
||||
%_builddir $PWD/BUILD
|
||||
EOF
|
||||
|
||||
# remove <RELEASE> tag from Release and delete shell escape comments.
|
||||
sed -i '/^Release:/s/[<>]//g;/#%(bash/d' *.spec
|
||||
sed -i '
|
||||
# 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}
|
||||
rm -rf $RPMDIR
|
||||
trap - 0
|
||||
@ -56,7 +71,7 @@ esac
|
||||
rm -rf UPSTREAM
|
||||
mkdir UPSTREAM
|
||||
if ! test -d STAMPS ; then
|
||||
mkdir -p pot
|
||||
mkdir -p pot pot-tuu pot-diff
|
||||
mkdir OSC PACKAGES UPDATE STAMPS
|
||||
rm -f upstream-collect.log
|
||||
fi
|
||||
@ -67,6 +82,10 @@ cat >~/.upstream-collect.tmp/translation-update-upstream <<EOF
|
||||
#!/bin/sh
|
||||
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
|
||||
cd ${1:-po}
|
||||
# Generate and save a copy of the pot file now and compare later.
|
||||
\${3:-intltool-update --gettext-package=\${2:-\$T_U_U_DOMAIN} --pot}
|
||||
mv \${2:-\$T_U_U_DOMAIN}.pot \${2:-\$T_U_U_DOMAIN}-t-u-u.pot
|
||||
EOF
|
||||
chmod +x ~/.upstream-collect.tmp/translation-update-upstream
|
||||
|
||||
@ -79,8 +98,13 @@ chmod +x msgheadermerge msgheadermerge-compose msgheadermerge-parse upstream-col
|
||||
for FILE in gnome-patch-translation-prepare gnome-patch-translation-update ; do
|
||||
cat >~/.upstream-collect.tmp/$FILE <<EOF
|
||||
#!/bin/sh
|
||||
set -x
|
||||
echo "Dummy $FILE for upstream-collect.sh. Skipping gnome-patch-translation."
|
||||
mkdir -p 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
|
||||
fi
|
||||
touch po/.gnome-patch-translation-implemented
|
||||
EOF
|
||||
chmod +x ~/.upstream-collect.tmp/$FILE
|
||||
done
|
||||
@ -226,9 +250,20 @@ for TLST in *.tlst ; do
|
||||
fi
|
||||
|
||||
cd $RPMPODIR
|
||||
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 bash ./.translation-update-upstream-implemented ; then
|
||||
cp -a $DOMAIN.pot $WORK_DIR/pot/
|
||||
cp -a $DOMAIN-t-u-u.pot $WORK_DIR/pot-tuu/$DOMAIN.pot
|
||||
# Verify that patches don't introduce new strings.
|
||||
msgcomm --uniq $DOMAIN.pot $DOMAIN-t-u-u.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 gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)}: new pot file contains unique strings, please check gnome-patch-translation"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# translation-update-upstream is implemented but fails:
|
||||
if test -f $DOMAIN.pot ; then
|
||||
@ -253,124 +288,125 @@ for TLST in *.tlst ; do
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $WORK_DIR/UPSTREAM
|
||||
let SERIAL++ || :
|
||||
mkdir $SERIAL
|
||||
cd $SERIAL
|
||||
if $COLLECT_UPSTREAM ; then
|
||||
cd $WORK_DIR/UPSTREAM
|
||||
let SERIAL++ || :
|
||||
mkdir $SERIAL
|
||||
cd $SERIAL
|
||||
|
||||
case "$METHOD" in
|
||||
cvs )
|
||||
cvs -z3 -d:pserver:anoncvs@$REPO co $REPODIR $BRANCH
|
||||
cd $REPODIR
|
||||
;;
|
||||
svn )
|
||||
if test -z "$BRANCH" ; then
|
||||
svn co $REPO/${REPODIR%%/*}/trunk/${REPODIR#*/}
|
||||
else
|
||||
svn co $REPO/${REPODIR%%/*}/branches/$BRANCH/${REPODIR#*/}
|
||||
fi
|
||||
cd ${REPODIR##*/}
|
||||
;;
|
||||
git )
|
||||
if ! test -d $WORK_DIR/GIT/${REPO//[\/:.]/_} ; then
|
||||
mkdir -p $WORK_DIR/GIT/${REPO//[\/:.]/_}
|
||||
cd $WORK_DIR/GIT/${REPO//[\/:.]/_}
|
||||
git clone $REPO
|
||||
cd $OLDPWD
|
||||
fi
|
||||
cp -a $WORK_DIR/GIT/${REPO//[\/:.]/_}/* .
|
||||
if test -n "$BRANCH" ; then
|
||||
cd *
|
||||
git checkout remotes/origin/$BRANCH
|
||||
cd $OLDPWD
|
||||
fi
|
||||
cd $REPODIR
|
||||
;;
|
||||
# Web-based Git repository viewer makes possible to download particular file.
|
||||
cgit )
|
||||
# Some tricks to be able to recycle git:// URI
|
||||
CGIT_URI=$REPO
|
||||
CGIT_URI=${CGIT_URI/git:\/\/anongit./http://cgit.}
|
||||
CGIT_URI=${CGIT_URI/git:\/\//http://}
|
||||
CGIT_BRANCH=${BRANCH:+?id=$BRANCH}
|
||||
CGIT_SERVER=${CGIT_URI#http://}
|
||||
CGIT_SERVER=${CGIT_SERVER%%/*}
|
||||
curl $CGIT_URI/tree/${REPODIR#*/}$CGIT_BRANCH | sed -n 's:^.*class='\''ls-blob[^'\'']*'\'' href='\''\([^'\'']*\)'\''.*$:\1:p' |
|
||||
while read ; do
|
||||
wget -N http://$CGIT_SERVER${REPLY/\/tree\///plain/}
|
||||
done
|
||||
;;
|
||||
# standard http directory with po files (BRANCH is not supported)
|
||||
http )
|
||||
wget -N -r --no-parent --level=1 http://$REPO/$REPODIR/$DIR
|
||||
cd $REPO/$REPODIR/$DIR
|
||||
;;
|
||||
# GNOME Translation project l10n directory
|
||||
gtp )
|
||||
GTP_NAME_BASE=${REPODIR%%/*}
|
||||
# Projects with multiple domains have custom handling in GTP.
|
||||
case $DOMAIN in
|
||||
gimp20-libgimp ) GTP_NAME_BASE=gimp-libgimp ;;
|
||||
gimp20-python ) GTP_NAME_BASE=gimp-python ;;
|
||||
gimp20-script-fu ) GTP_NAME_BASE=gimp-script-fu ;;
|
||||
gimp20-std-plug-ins ) GTP_NAME_BASE=gimp-plug-ins ;;
|
||||
gimp20-tags ) GTP_NAME_BASE=gimp-tags ;;
|
||||
gimp20-tips ) GTP_NAME_BASE=gimp-tips ;;
|
||||
gnumeric-functions ) GTP_NAME_BASE=gnumeric-functions ;;
|
||||
gtk20-properties ) GTP_NAME_BASE=gtk+-properties ;;
|
||||
libgweather-locations ) GTP_NAME_BASE=locations ;;
|
||||
esac
|
||||
curl http://$REPO/${REPODIR%%/*}.${BRANCH:-master}/ | sed -n 's:^.*href="\([^"]*\.po\)".*$:\1:p' |
|
||||
while read ; do
|
||||
case $REPLY in
|
||||
*.reduced.po )
|
||||
;;
|
||||
$GTP_NAME_BASE.${BRANCH:-master}.*)
|
||||
wget -N http://$REPO/${REPODIR%%/*}.${BRANCH:-master}/$REPLY
|
||||
mv $REPLY ${REPLY#$GTP_NAME_BASE.${BRANCH:-master}.}
|
||||
;;
|
||||
case "$METHOD" in
|
||||
cvs )
|
||||
cvs -z3 -d:pserver:anoncvs@$REPO co $REPODIR $BRANCH
|
||||
cd $REPODIR
|
||||
;;
|
||||
svn )
|
||||
if test -z "$BRANCH" ; then
|
||||
svn co $REPO/${REPODIR%%/*}/trunk/${REPODIR#*/}
|
||||
else
|
||||
svn co $REPO/${REPODIR%%/*}/branches/$BRANCH/${REPODIR#*/}
|
||||
fi
|
||||
cd ${REPODIR##*/}
|
||||
;;
|
||||
git )
|
||||
if ! test -d $WORK_DIR/GIT/${REPO//[\/:.]/_} ; then
|
||||
mkdir -p $WORK_DIR/GIT/${REPO//[\/:.]/_}
|
||||
cd $WORK_DIR/GIT/${REPO//[\/:.]/_}
|
||||
git clone $REPO
|
||||
cd $OLDPWD
|
||||
fi
|
||||
cp -a $WORK_DIR/GIT/${REPO//[\/:.]/_}/* .
|
||||
if test -n "$BRANCH" ; then
|
||||
cd *
|
||||
git checkout remotes/origin/$BRANCH
|
||||
cd $OLDPWD
|
||||
fi
|
||||
cd $REPODIR
|
||||
;;
|
||||
# Web-based Git repository viewer makes possible to download particular file.
|
||||
cgit )
|
||||
# Some tricks to be able to recycle git:// URI
|
||||
CGIT_URI=$REPO
|
||||
CGIT_URI=${CGIT_URI/git:\/\/anongit./http://cgit.}
|
||||
CGIT_URI=${CGIT_URI/git:\/\//http://}
|
||||
CGIT_BRANCH=${BRANCH:+?id=$BRANCH}
|
||||
CGIT_SERVER=${CGIT_URI#http://}
|
||||
CGIT_SERVER=${CGIT_SERVER%%/*}
|
||||
curl $CGIT_URI/tree/${REPODIR#*/}$CGIT_BRANCH | sed -n 's:^.*class='\''ls-blob[^'\'']*'\'' href='\''\([^'\'']*\)'\''.*$:\1:p' |
|
||||
while read ; do
|
||||
wget -N http://$CGIT_SERVER${REPLY/\/tree\///plain/}
|
||||
done
|
||||
;;
|
||||
# standard http directory with po files (BRANCH is not supported)
|
||||
http )
|
||||
wget -N -r --no-parent --level=1 http://$REPO/$REPODIR/$DIR
|
||||
cd $REPO/$REPODIR/$DIR
|
||||
;;
|
||||
# GNOME Translation project l10n directory
|
||||
gtp )
|
||||
GTP_NAME_BASE=${REPODIR%%/*}
|
||||
# Projects with multiple domains have custom handling in GTP.
|
||||
case $DOMAIN in
|
||||
gimp20-libgimp ) GTP_NAME_BASE=gimp-libgimp ;;
|
||||
gimp20-python ) GTP_NAME_BASE=gimp-python ;;
|
||||
gimp20-script-fu ) GTP_NAME_BASE=gimp-script-fu ;;
|
||||
gimp20-std-plug-ins ) GTP_NAME_BASE=gimp-plug-ins ;;
|
||||
gimp20-tags ) GTP_NAME_BASE=gimp-tags ;;
|
||||
gimp20-tips ) GTP_NAME_BASE=gimp-tips ;;
|
||||
gnumeric-functions ) GTP_NAME_BASE=gnumeric-functions ;;
|
||||
gtk20-properties ) GTP_NAME_BASE=gtk+-properties ;;
|
||||
libgweather-locations ) GTP_NAME_BASE=locations ;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
tbz )
|
||||
wget -N $REPO
|
||||
tar -jxf ${REPO##*/}
|
||||
cd $REPODIR
|
||||
;;
|
||||
tgz )
|
||||
wget -N $REPO
|
||||
tar -zxf ${REPO##*/}
|
||||
cd $REPODIR
|
||||
;;
|
||||
lcn )
|
||||
if ! test -d $WORK_DIR/LCN-${BRANCH:-trunk} ; then
|
||||
mkdir $WORK_DIR/LCN-${BRANCH:-trunk}
|
||||
cd $WORK_DIR/LCN-${BRANCH:-trunk}
|
||||
if test "${BRANCH:-trunk}" = "trunk" ; then
|
||||
BRANCH_PATH="${BRANCH:-trunk}"
|
||||
else
|
||||
BRANCH_PATH="branches/$BRANCH"
|
||||
fi
|
||||
svn co https://svn.berlios.de/svnroot/repos/opensuse-i18n/$BRANCH_PATH/lcn
|
||||
for PO in lcn/*/po/*.po ; do
|
||||
LCN_LANG=${PO%/*}
|
||||
LCN_LANG=${LCN_LANG#lcn/}
|
||||
LCN_LANG=${LCN_LANG%%/*}
|
||||
LCN_DOMAIN=${PO##*/}
|
||||
LCN_DOMAIN=${LCN_DOMAIN%.$LCN_LANG.po}
|
||||
mkdir -p data/$LCN_DOMAIN
|
||||
ln $PO data/$LCN_DOMAIN/$LCN_LANG.po
|
||||
done
|
||||
cd -
|
||||
fi
|
||||
cp -a $WORK_DIR/LCN-${BRANCH:-trunk}/data/${REPODIR%/po} .
|
||||
cd ${REPODIR%/po}
|
||||
;;
|
||||
* )
|
||||
echo "$PACKAGE: Unknown update method $METHOD"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
curl http://$REPO/${REPODIR%%/*}.${BRANCH:-master}/ | sed -n 's:^.*href="\([^"]*\.po\)".*$:\1:p' |
|
||||
while read ; do
|
||||
case $REPLY in
|
||||
*.reduced.po )
|
||||
;;
|
||||
$GTP_NAME_BASE.${BRANCH:-master}.*)
|
||||
wget -N http://$REPO/${REPODIR%%/*}.${BRANCH:-master}/$REPLY
|
||||
mv $REPLY ${REPLY#$GTP_NAME_BASE.${BRANCH:-master}.}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
tbz )
|
||||
wget -N $REPO
|
||||
tar -jxf ${REPO##*/}
|
||||
cd $REPODIR
|
||||
;;
|
||||
tgz )
|
||||
wget -N $REPO
|
||||
tar -zxf ${REPO##*/}
|
||||
cd $REPODIR
|
||||
;;
|
||||
lcn )
|
||||
if ! test -d $WORK_DIR/LCN-${BRANCH:-trunk} ; then
|
||||
mkdir $WORK_DIR/LCN-${BRANCH:-trunk}
|
||||
cd $WORK_DIR/LCN-${BRANCH:-trunk}
|
||||
if test "${BRANCH:-trunk}" = "trunk" ; then
|
||||
BRANCH_PATH="${BRANCH:-trunk}"
|
||||
else
|
||||
BRANCH_PATH="branches/$BRANCH"
|
||||
fi
|
||||
svn co https://svn.berlios.de/svnroot/repos/opensuse-i18n/$BRANCH_PATH/lcn
|
||||
for PO in lcn/*/po/*.po ; do
|
||||
LCN_LANG=${PO%/*}
|
||||
LCN_LANG=${LCN_LANG#lcn/}
|
||||
LCN_LANG=${LCN_LANG%%/*}
|
||||
LCN_DOMAIN=${PO##*/}
|
||||
LCN_DOMAIN=${LCN_DOMAIN%.$LCN_LANG.po}
|
||||
mkdir -p data/$LCN_DOMAIN
|
||||
ln $PO data/$LCN_DOMAIN/$LCN_LANG.po
|
||||
done
|
||||
cd -
|
||||
fi
|
||||
cp -a $WORK_DIR/LCN-${BRANCH:-trunk}/data/${REPODIR%/po} .
|
||||
cd ${REPODIR%/po}
|
||||
;;
|
||||
* )
|
||||
echo "$PACKAGE: Unknown update method $METHOD"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# Files created in this section:
|
||||
@ -391,167 +427,168 @@ for TLST in *.tlst ; do
|
||||
# foo-updatesraw.po: fixes + additions in a single file, raw form
|
||||
# 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
|
||||
if test -f $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO ; then
|
||||
msgcat --use-first $PO $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO -o $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO~
|
||||
mv $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO~ $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO
|
||||
else
|
||||
msgcat $PO -o $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO
|
||||
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
|
||||
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
|
||||
if test -f $RPMPODIR/$PO ; then
|
||||
# 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
|
||||
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$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.
|
||||
continue
|
||||
fi
|
||||
# Do the magic:
|
||||
# step 2: Merge new upstream po and previous upstream updates to RPM po (if any).
|
||||
OLD_UPDATE=false
|
||||
if test -f $WORK_DIR/UPDATE/po/$DOMAIN/$PO ; then
|
||||
if $WORK_DIR/msgheadermerge $WORK_DIR/UPDATE/po/$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"
|
||||
OLD_UPDATE=true
|
||||
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
|
||||
if test -f $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO ; then
|
||||
msgcat --use-first $PO $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO -o $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO~
|
||||
mv $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO~ $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO
|
||||
else
|
||||
msgcat $PO -o $WORK_DIR/UPDATE/po-mandatory/$DOMAIN/$PO
|
||||
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
|
||||
else
|
||||
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~
|
||||
# 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~
|
||||
# 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
|
||||
else
|
||||
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.
|
||||
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
|
||||
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
|
||||
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~
|
||||
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
|
||||
cp -a ${PO%.po}-fixes-review.po $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR/$DOMAIN-review.po
|
||||
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
|
||||
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
|
||||
else
|
||||
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-review.po $WORK_DIR/po-review/${PO%.po}/changes/$DOMAIN-review.po
|
||||
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/changes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# 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).
|
||||
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
|
||||
# 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
|
||||
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
|
||||
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"
|
||||
if test -f $RPMPODIR/$PO ; then
|
||||
# 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
|
||||
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$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.
|
||||
continue
|
||||
fi
|
||||
mv $RPMPODIR/${PO%.po}-updates.po~ $RPMPODIR/${PO%.po}-updates.po
|
||||
# Do the magic:
|
||||
# step 2: Merge new upstream po and previous upstream updates to RPM po (if any).
|
||||
OLD_UPDATE=false
|
||||
if test -f $WORK_DIR/UPDATE/po/$DOMAIN/$PO ; then
|
||||
if $WORK_DIR/msgheadermerge $WORK_DIR/UPDATE/po/$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"
|
||||
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
|
||||
else
|
||||
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~
|
||||
# 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~
|
||||
# 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
|
||||
else
|
||||
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.
|
||||
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
|
||||
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
|
||||
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~
|
||||
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
|
||||
cp -a ${PO%.po}-fixes-review.po $WORK_DIR/po-review/${PO%.po}/excluded-changes/${REPO//[\/:.]/_}/$REPODIR/$DOMAIN-review.po
|
||||
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
|
||||
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
|
||||
else
|
||||
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-review.po $WORK_DIR/po-review/${PO%.po}/changes/$DOMAIN-review.po
|
||||
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/changes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# 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
|
||||
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgcat error"
|
||||
continue
|
||||
# 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).
|
||||
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"
|
||||
continue
|
||||
fi
|
||||
mv $RPMPODIR/${PO%.po}-updates.po~ $RPMPODIR/${PO%.po}-updates.po
|
||||
else
|
||||
# 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
|
||||
echo >>$WORK_DIR/upstream-collect.log "package=$PACKAGE gettext-package=$DOMAIN method=$METHOD repository=$REPO directory=$DIR branch=${BRANCH:(default)} po=$PO: msgcat error"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
# step 2: Prepare texts for review.
|
||||
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
|
||||
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/new-files
|
||||
fi
|
||||
fi
|
||||
# step 2: Prepare texts for review.
|
||||
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
|
||||
rmdir --ignore-fail-on-non-empty --parents $WORK_DIR/po-review/${PO%.po}/new-files
|
||||
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
|
||||
) &
|
||||
if test $CPUS -le 1 ; then
|
||||
wait
|
||||
else
|
||||
echo -n "~"
|
||||
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
|
||||
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
|
||||
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
|
||||
for POX in *-updates.po ; do
|
||||
PO=${POX/-updates/}
|
||||
cp -a $POX $WORK_DIR/UPDATE/po/$DOMAIN/$PO
|
||||
done
|
||||
mkdir -p $WORK_DIR/UPDATE/po/$DOMAIN
|
||||
cd $RPMPODIR
|
||||
for POX in *-updates.po ; do
|
||||
PO=${POX/-updates/}
|
||||
cp -a $POX $WORK_DIR/UPDATE/po/$DOMAIN/$PO
|
||||
done
|
||||
|
||||
if ! $DEBUG ; then
|
||||
rm -rf $WORK_DIR/UPSTREAM/$SERIAL
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
mkdir -p $WORK_DIR/STAMPS/$PACKAGE/$DOMAIN/$METHOD/${REPO//[\/:.]/_}/$DIR/${BRANCH:-__HEAD__}
|
||||
touch $WORK_DIR/STAMPS/$PACKAGE/.builddir_ok
|
||||
|
||||
if ! $DEBUG ; then
|
||||
rm -rf $WORK_DIR/UPSTREAM/$SERIAL
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
|
||||
if ! $DEBUG ; then
|
||||
@ -560,12 +597,14 @@ if ! $DEBUG ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $WORK_DIR/UPDATE
|
||||
if test -d po ; then
|
||||
tar -j -c -f $WORK_DIR/translation-update-upstream-$SNAPSHOT.tar.bz2 po
|
||||
fi
|
||||
if test -d po-mandatory ; then
|
||||
tar -j -c -f $WORK_DIR/translation-update-mandatory-$SNAPSHOT.tar.bz2 po-mandatory
|
||||
if $COLLECT_UPSTREAM ; then
|
||||
cd $WORK_DIR/UPDATE
|
||||
if test -d po ; then
|
||||
tar -j -c -f $WORK_DIR/translation-update-upstream-$SNAPSHOT.tar.bz2 po
|
||||
fi
|
||||
if test -d po-mandatory ; then
|
||||
tar -j -c -f $WORK_DIR/translation-update-mandatory-$SNAPSHOT.tar.bz2 po-mandatory
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $WORK_DIR
|
||||
|
Loading…
x
Reference in New Issue
Block a user