7b08d5
#!/bin/bash
7b08d5
# This checks out and builds the language sources.  The lightning source needs
7b08d5
# to already be unpacked
7b08d5
#lver=`awk '/^%global *lightning_ver/ { print $3; exit }' thunderbird.spec`
7b08d5
tbver=`awk '/^Version:/ { print $2; exit }' thunderbird.spec`
7b08d5
#tag=CALENDAR_${lver//./_}_RELEASE
7b08d5
tag=THUNDERBIRD_${tbver//./_}_RELEASE
7b08d5
branch=`awk '/^%define *tarballdir/ { print $3; exit }' thunderbird.spec`
7b08d5
locales=$PWD/thunderbird-${tbver}/${branch}/calendar/locales/shipped-locales
7b08d5
#locales=$PWD/shipped-locales
7b08d5
if [ ! -f $locales ]
7b08d5
then
7b08d5
  echo "ERROR: missing $locales, try fedpkg prep first"
7b08d5
  exit 1
7b08d5
fi
7b08d5
[ ! -d l10n ] && mkdir l10n
7b08d5
cd l10n
7b08d5
for lang in $(<$locales)
7b08d5
do
7b08d5
  if [ -d $lang ]
7b08d5
  then
7b08d5
    pushd $lang
7b08d5
    hg pull
7b08d5
    hg update $tag
7b08d5
    #hg update
7b08d5
    popd
7b08d5
  else
7b08d5
    hg clone -u $tag http://hg.mozilla.org/releases/l10n/mozilla-release/$lang
7b08d5
    #hg clone http://hg.mozilla.org/l10n-central/$lang
7b08d5
  fi
7b08d5
done
7b08d5
cd ..
7b08d5
# Need to merge by compare-locale tool
7b08d5
# More info here: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/compare-locales
7b08d5
# how to get compare-locales: sudo easy_install -U compare-locales
7b08d5
7b08d5
# Make copy to merge with
7b08d5
rm -rf l10n-merged
7b08d5
cp -R l10n l10n-merged
7b08d5
for lang in $(<$locales)
7b08d5
do
7b08d5
  compare-locales --merge l10n-merged/$lang $PWD/thunderbird-${tbver}/${branch}/calendar/locales/l10n.ini l10n $lang
7b08d5
done
7b08d5
7b08d5
7b08d5
# Tar up, minus the mercurial files
7b08d5
rm -f l10n-${lver}.tar.xz
7b08d5
tar caf l10n-lightning-${tbver}.tar.xz --exclude='.hg*'  l10n-merged