[tbb-commits] [tor-browser-bundle/master] Bug 12967: Add support for a multi-lingual Tor Browser.

gk at torproject.org gk at torproject.org
Tue Oct 20 20:12:35 UTC 2015


commit 10a8f2badf8294d8a69d9898fee805750789da86
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue Oct 20 11:30:19 2015 -0400

    Bug 12967: Add support for a multi-lingual Tor Browser.
    
    Include all locales (language packs) in one installable package.
    The downloadable file names use "ALL" instead of a locale name, e.g.,
      tor-browser-linux64-5.5a3_ALL.tar.xz
    "ALL" is also used as the locale within the update check URLs.
    Multi-lingual packaging may be disabled by setting MULTI_LINGUAL=0
    inside the versions files (or by removing that variable entirely).
    
    Also, simplify the code that creates the per-locale packages.
---
 gitian/descriptors/linux/gitian-bundle.yml   |  159 +++++++++++++++-----------
 gitian/descriptors/mac/gitian-bundle.yml     |   98 ++++++++++------
 gitian/descriptors/windows/gitian-bundle.yml |  110 ++++++++++--------
 gitian/versions.nightly                      |    4 +
 4 files changed, 224 insertions(+), 147 deletions(-)

diff --git a/gitian/descriptors/linux/gitian-bundle.yml b/gitian/descriptors/linux/gitian-bundle.yml
index 1a6776d..f1d99e9 100644
--- a/gitian/descriptors/linux/gitian-bundle.yml
+++ b/gitian/descriptors/linux/gitian-bundle.yml
@@ -75,10 +75,14 @@ script: |
   cd ..
 
   mkdir -p $OUTDIR/
-  mkdir -p tor-browser/Browser/TorBrowser/Data/Browser/profile.default/extensions/https-everywhere-eff at eff.org
-  mkdir -p tor-browser/Browser/TorBrowser/Data/Browser/profile.meek-http-helper/extensions
-  mkdir -p tor-browser/Browser/TorBrowser/Data/Browser/Caches
-  mkdir -p tor-browser/Browser/TorBrowser/Docs/sources/
+  # When we build with MULTI_LINGUAL=1, the browser will be packaged inside a
+  # directory named tor-browser (instead of tor-browser_en-US). Therefore we
+  # stage everything under tor-browser-stage to avoid a conflict.
+  TB_STAGE_DIR=tor-browser-stage
+  mkdir -p ${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions/https-everywhere-eff at eff.org
+  mkdir -p ${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.meek-http-helper/extensions
+  mkdir -p ${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/Caches
+  mkdir -p ${TB_STAGE_DIR}/Browser/TorBrowser/Docs/sources/
   # Preparing Python for HTTPS-Everywhere.
   unzip -d $INSTDIR python-linux$GBUILD_BITS-utils.zip
   export PATH=$INSTDIR/python/bin:$PATH
@@ -95,7 +99,7 @@ script: |
   mkdir pkg/tmp
   cd pkg/tmp
   unzip ../*.xpi
-  ~/build/dzip.sh ../../../tor-browser/Browser/TorBrowser/Data/Browser/profile.default/extensions/tor-launcher at torproject.org.xpi .
+  ~/build/dzip.sh ../../../${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions/tor-launcher at torproject.org.xpi .
   cd ../../../
   #
   cd torbutton
@@ -105,7 +109,7 @@ script: |
   mkdir pkg/tmp
   cd pkg/tmp
   unzip ../*.xpi
-  ~/build/dzip.sh ../../../tor-browser/Browser/TorBrowser/Data/Browser/profile.default/extensions/torbutton at torproject.org.xpi .
+  ~/build/dzip.sh ../../../${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions/torbutton at torproject.org.xpi .
   cd ../../../
   #
   cd https-everywhere
@@ -124,11 +128,11 @@ script: |
   fi
   # Since 5.0.2 a .xpi for AMO is built, too. We don't need it.
   rm ./pkg/*-amo.xpi
-  cp pkg/*.xpi ../tor-browser/Browser/TorBrowser/Data/Browser/profile.default/extensions/https-everywhere at eff.org.xpi
+  cp pkg/*.xpi ../${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions/https-everywhere at eff.org.xpi
   cd ..
   #
-  cp *.xpi tor-browser/Browser/TorBrowser/Data/Browser/profile.default/extensions/
-  cd tor-browser/Browser/TorBrowser/Data/Browser/profile.default/extensions
+  cp *.xpi ${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions/
+  cd ${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions
   mv noscript at noscript.net.xpi {73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
   cd https-everywhere-eff at eff.org/
   unzip ../https-everywhere at eff.org.xpi
@@ -136,27 +140,27 @@ script: |
   cd ~/build
   #
   cd meek/firefox
-  ~/build/dzip.sh ../../tor-browser/Browser/TorBrowser/Data/Browser/profile.meek-http-helper/extensions/meek-http-helper at bamsoftware.com.xpi .
+  ~/build/dzip.sh ../../${TB_STAGE_DIR}/Browser/TorBrowser/Data/Browser/profile.meek-http-helper/extensions/meek-http-helper at bamsoftware.com.xpi .
   cd ~/build/
   #
   # Install fonts.
-  mkdir -p tor-browser/Browser/fonts
+  mkdir -p ${TB_STAGE_DIR}/Browser/fonts
   NOTO_FONTS_HINTED="Arimo-Regular.ttf Arimo-Bold.ttf Arimo-Italic.ttf Arimo-BoldItalic.ttf Cousine-Regular.ttf Tinos-Regular.ttf Tinos-Bold.ttf Tinos-Italic.ttf Tinos-BoldItalic.ttf NotoNaskhArabic-Regular.ttf NotoSansArmenian-Regular.ttf NotoSansBengali-Regular.ttf NotoSansDevanagari-Regular.ttf NotoSansEthiopic-Regular.ttf NotoSansGeorgian-Regular.ttf NotoSansGujarati-Regular.ttf NotoSansGurmukhi-Regular.ttf NotoSansHebrew-Regular.ttf NotoSansKannada-Regular.ttf NotoSansKhmer-Regular.ttf NotoSansLao-Regular.ttf NotoSansMalayalam-Regular.ttf NotoSansMyanmar-Regular.ttf NotoSansOriya-Regular.ttf NotoSansSinhala-Regular.ttf NotoSansTamil-Regular.ttf NotoSansTelugu-Regular.ttf NotoSansThaana-Regular.ttf NotoSansThai-Regular.ttf NotoSansTibetan-Regular.ttf NotoSerifArmenian-Regular.ttf NotoSerifKhmer-Regular.ttf NotoSerifLao-Regular.ttf NotoSerifThai-Regular.ttf"
   for fontfile in $NOTO_FONTS_HINTED; do
-    cp "noto-fonts/hinted/$fontfile" tor-browser/Browser/fonts/
+    cp "noto-fonts/hinted/$fontfile" ${TB_STAGE_DIR}/Browser/fonts/
   done
   NOTO_FONTS_UNHINTED="NotoSansCanadianAboriginal-Regular.ttf NotoSansBuginese-Regular.ttf NotoSansCherokee-Regular.ttf NotoSansMongolian-Regular.ttf NotoSansYi-Regular.ttf"
   for fontfile in $NOTO_FONTS_UNHINTED; do
-    cp "noto-fonts/unhinted/$fontfile" tor-browser/Browser/fonts/
+    cp "noto-fonts/unhinted/$fontfile" ${TB_STAGE_DIR}/Browser/fonts/
   done
-  cp NotoSansCJKsc-Regular.otf tor-browser/Browser/fonts/
+  cp NotoSansCJKsc-Regular.otf ${TB_STAGE_DIR}/Browser/fonts/
   unzip -o STIXv1.1.1-latex.zip -d STIX
-  cp "STIX/Fonts/fonts/opentype/public/stix/STIXMath-Regular.otf" tor-browser/Browser/fonts/
+  cp "STIX/Fonts/fonts/opentype/public/stix/STIXMath-Regular.otf" ${TB_STAGE_DIR}/Browser/fonts/
   #
   unzip relativelink-src.zip
-  cp RelativeLink/* tor-browser/Browser/
+  cp RelativeLink/* ${TB_STAGE_DIR}/Browser/
   #
-  cd tor-browser
+  cd ${TB_STAGE_DIR}
   cp Browser/start-tor-browser.desktop ./
   unzip ~/build/tor-browser-linux$GBUILD_BITS-gbuilt.zip
   cd Browser/TorBrowser
@@ -174,12 +178,23 @@ script: |
   cd ../../..
   #
   # Copy reproducibility info
-  cp versions tor-browser/Browser/TorBrowser/Docs/sources/
-  cp bundle.inputs tor-browser/Browser/TorBrowser/Docs/sources/
-  #
-  cp -a tor-browser tor-browser_en-US
+  cp versions ${TB_STAGE_DIR}/Browser/TorBrowser/Docs/sources/
+  cp bundle.inputs ${TB_STAGE_DIR}/Browser/TorBrowser/Docs/sources/
+
+  # Create en-US or multi-lingual package.
+  PKG_LOCALE="en-US"
+  PKG_DIR="tor-browser_${PKG_LOCALE}"
+  # If we are building a multi-lingual package, use "ALL" in the package name
+  # and as the locale for update purposes. We do not include "ALL" in the name
+  # of the directory that is inside the package (in other words, users will
+  # not see tor-browser_ALL after they install Tor Browser).
+  if [ "z$MULTI_LINGUAL" = "z1" ]; then
+    PKG_LOCALE="ALL"
+    PKG_DIR="tor-browser"
+  fi
+  cp -a ${TB_STAGE_DIR} ${PKG_DIR}
   #
-  pushd tor-browser_en-US/Browser/browser/
+  pushd ${PKG_DIR}/Browser/browser/
   unzip omni.ja defaults/preferences/000-tor-browser.js
   cp defaults/preferences/000-tor-browser.js ~/build/
   # Set the locale of the bundle.
@@ -188,56 +203,72 @@ script: |
   rm -rf defaults
   popd
   #
+  unzip linux-langpacks.zip
+  LINUX_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_LINUX"
+  # If we are building a multi-lingual package, add all of the language packs.
+  if [ "z$MULTI_LINGUAL" = "z1" ]; then
+    pushd linux-langpacks
+    for LANG in $LINUX_LOCALES
+    do
+      xpi=$LANG.xpi
+      cp $xpi ../${PKG_DIR}/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+    done
+    popd
+
+    # Set the update.locale (it is used to replace %LOCALE% within
+    # app.update.url).
+    pushd ${PKG_DIR}/Browser/
+    echo ${PKG_LOCALE} > update.locale
+    zip -Xm omni.ja update.locale
+    popd
+  fi
+
   # Recreate precomplete file (needs to be accurate for full MAR updates).
-  pushd tor-browser_en-US/Browser
+  pushd ${PKG_DIR}/Browser
   rm -f precomplete
   python $MARTOOLS/createprecomplete.py
   popd
   #
   # Create full MAR file and compressed package.
-  MAR_FILE=tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_en-US.mar
-  MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE tor-browser_en-US/Browser
-  ~/build/dtar.sh $OUTDIR/tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_en-US.tar.xz tor-browser_en-US
-  rm -rf tor-browser_en-US
+  MAR_FILE=tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_${PKG_LOCALE}.mar
+  MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE ${PKG_DIR}/Browser
+  ~/build/dtar.sh $OUTDIR/tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_${PKG_LOCALE}.tar.xz ${PKG_DIR}
+  rm -rf ${PKG_DIR}
   #
-  unzip linux-langpacks.zip
-  cd linux-langpacks
-  LINUX_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_LINUX"
-  for LANG in $LINUX_LOCALES
-  do
-    xpi=$LANG.xpi
-    cp -a ../tor-browser ../tor-browser_$LANG
-    cp $xpi ../tor-browser_$LANG/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
-    cd ..
+  # If we did not create a multi-lingual package above, create a package for
+  # each locale.
+  if [ "z$MULTI_LINGUAL" != "z1" ]; then
+    for LANG in $LINUX_LOCALES
+    do
+      xpi=linux-langpacks/$LANG.xpi
+      cp -a ${TB_STAGE_DIR} tor-browser_$LANG
+      cp $xpi tor-browser_$LANG/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
 
-    pushd tor-browser_$LANG/Browser/browser/
-    mkdir -p defaults/preferences
-    cp ~/build/000-tor-browser.js defaults/preferences/
-    # Set the locale of the bundle.
-    echo "pref(\"general.useragent.locale\", \"$LANG\");" >> defaults/preferences/000-tor-browser.js
-    zip -Xm omni.ja defaults/preferences/000-tor-browser.js
-    rm -rf defaults
-    popd
+      pushd tor-browser_$LANG/Browser/browser/
+      mkdir -p defaults/preferences
+      cp ~/build/000-tor-browser.js defaults/preferences/
+      # Set the locale of the bundle.
+      echo "pref(\"general.useragent.locale\", \"$LANG\");" >> defaults/preferences/000-tor-browser.js
+      zip -Xm omni.ja defaults/preferences/000-tor-browser.js
+      rm -rf defaults
+      popd
 
-    # Set the update.locale (it is used to replace %LOCALE% within
-    # app.update.url) and remove the en-US spellchecking dictionary.
-    pushd tor-browser_$LANG/Browser/
-    echo "$LANG" > update.locale
-    zip -Xm omni.ja update.locale
-    rm -rf dictionaries
-    popd
-
-    # Recreate precomplete file (needs to be accurate for full MAR updates).
-    pushd tor-browser_$LANG/Browser
-    rm -f precomplete
-    python $MARTOOLS/createprecomplete.py
-    popd
+      # Set the update.locale (it is used to replace %LOCALE% within
+      # app.update.url), remove the en-US spellchecking dictionary, and
+      # recreate precomplete file (needs to be accurate for full MAR updates).
+      pushd tor-browser_$LANG/Browser/
+      echo "$LANG" > update.locale
+      zip -Xm omni.ja update.locale
+      rm -rf dictionaries
+      rm -f precomplete
+      python $MARTOOLS/createprecomplete.py
+      popd
 
-    # Create full MAR file and compressed package for this locale.
-    MAR_FILE=tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_$LANG.mar
-    MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE tor-browser_$LANG/Browser
-    ~/build/dtar.sh $OUTDIR/tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_$LANG.tar.xz tor-browser_$LANG
+      # Create full MAR file and compressed package for this locale.
+      MAR_FILE=tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_$LANG.mar
+      MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE tor-browser_$LANG/Browser
+      ~/build/dtar.sh $OUTDIR/tor-browser-linux${GBUILD_BITS}-${TORBROWSER_VERSION}_$LANG.tar.xz tor-browser_$LANG
 
-    rm -rf tor-browser_$LANG
-    cd linux-langpacks
-  done
+      rm -rf tor-browser_$LANG
+    done
+  fi
diff --git a/gitian/descriptors/mac/gitian-bundle.yml b/gitian/descriptors/mac/gitian-bundle.yml
index f24e521..e3baa3c 100644
--- a/gitian/descriptors/mac/gitian-bundle.yml
+++ b/gitian/descriptors/mac/gitian-bundle.yml
@@ -203,6 +203,29 @@ script: |
   ~/build/background-plist.py ../../../Contents/Info.plist > TorBrowser.app.meek-http-helper/Contents/Info.plist
   unzip ~/build/TorBrowser.app.meek-http-helper.zip
   popd
+
+  unzip mac-langpacks.zip
+  MAC_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_MAC"
+  PKG_LOCALE="en-US"
+  # If we are building a multi-lingual package, add all of the language packs
+  # and use "ALL" in the package name and as the locale for update purposes.
+  if [ "z$MULTI_LINGUAL" = "z1" ]; then
+    PKG_LOCALE="ALL"
+    pushd mac-langpacks
+    for LANG in $MAC_LOCALES
+    do
+      xpi=$LANG.xpi
+      cp $xpi ~/build/$TORBROWSER_NAME.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+    done
+    popd
+
+    # Set the update.locale to ALL (it is used to replace %LOCALE% within
+    # app.update.url).
+    pushd ~/build/$TORBROWSER_NAME.app/Contents/Resources/
+    echo $PKG_LOCALE > update.locale
+    zip -Xm omni.ja update.locale
+    popd
+  fi
   #
   # XXX: We need to insert these placeholders because otherwise mkisofs won't
   # include these otherwise empty dirs:
@@ -214,47 +237,46 @@ script: |
   popd
   #
   # Create full MAR file and disk image.
-  MAR_FILE=tor-browser-osx${GBUILD_BITS}-${TORBROWSER_VERSION}_en-US.mar
+  MAR_FILE=tor-browser-osx${GBUILD_BITS}-${TORBROWSER_VERSION}_${PKG_LOCALE}.mar
   MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE ~/build/$TORBROWSER_NAME.app
   cp -a ~/build/$TORBROWSER_NAME.app ~/build/dmg/$TORBROWSER_APP.app
-  ~/build/ddmg.sh $OUTDIR/TorBrowser-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_en-US.dmg ~/build/dmg
+  ~/build/ddmg.sh $OUTDIR/TorBrowser-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_${PKG_LOCALE}.dmg ~/build/dmg
   rm -rf ~/build/dmg/$TORBROWSER_APP.app
   mv $TORBROWSER_NAME.app ${TORBROWSER_NAME}_plain.app
-  #
-  unzip mac-langpacks.zip
-  cd mac-langpacks
-  MAC_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_MAC"
-  for LANG in $MAC_LOCALES
-  do
-    xpi=$LANG.xpi
-    DEST=$TORBROWSER_APP
-    cp -a ../${TORBROWSER_NAME}_plain.app ~/build/dmg/$DEST.app
-    cp $xpi ~/build/dmg/$DEST.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
-    cd ..
 
-    pushd ~/build/dmg/$DEST.app/Contents/Resources/browser/
-    mkdir -p defaults/preferences
-    cp ~/build/000-tor-browser.js defaults/preferences/
-    # Set the locale of the bundle.
-    echo "pref(\"general.useragent.locale\", \"$LANG\");" >> defaults/preferences/000-tor-browser.js
-    zip -Xm omni.ja defaults/preferences/000-tor-browser.js
-    rm -rf defaults
-    popd
+  # If we did not create a multi-lingual package above, create a package for
+  # each locale.
+  if [ "z$MULTI_LINGUAL" != "z1" ]; then
+    for LANG in $MAC_LOCALES
+    do
+      xpi=mac-langpacks/$LANG.xpi
+      DEST=$TORBROWSER_APP
+      cp -a ${TORBROWSER_NAME}_plain.app ~/build/dmg/$DEST.app
+      cp $xpi ~/build/dmg/$DEST.app/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
 
-    # Set the update.locale (it is used to replace %LOCALE% within
-    # app.update.url), remove the en-US spellchecking dictionary, and recreate
-    # the precomplete file (needs to be accurate for full MAR updates).
-    pushd ~/build/dmg/$DEST.app/Contents/Resources/
-    echo "$LANG" > update.locale
-    zip -Xm omni.ja update.locale
-    rm -rf dictionaries
-    rm -f precomplete
-    python $MARTOOLS/createprecomplete.py
-    popd
-    #
-    MAR_FILE=tor-browser-osx${GBUILD_BITS}-${TORBROWSER_VERSION}_$LANG.mar
-    MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE ~/build/dmg/$DEST.app
-     ~/build/ddmg.sh $OUTDIR/TorBrowser-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_$LANG.dmg ~/build/dmg/
-    rm -rf ~/build/dmg/$DEST.app
-    cd mac-langpacks
-  done
+      pushd ~/build/dmg/$DEST.app/Contents/Resources/browser/
+      mkdir -p defaults/preferences
+      cp ~/build/000-tor-browser.js defaults/preferences/
+      # Set the locale of the bundle.
+      echo "pref(\"general.useragent.locale\", \"$LANG\");" >> defaults/preferences/000-tor-browser.js
+      zip -Xm omni.ja defaults/preferences/000-tor-browser.js
+      rm -rf defaults
+      popd
+
+      # Set the update.locale (it is used to replace %LOCALE% within
+      # app.update.url), remove the en-US spellchecking dictionary, and recreate
+      # the precomplete file (needs to be accurate for full MAR updates).
+      pushd ~/build/dmg/$DEST.app/Contents/Resources/
+      echo "$LANG" > update.locale
+      zip -Xm omni.ja update.locale
+      rm -rf dictionaries
+      rm -f precomplete
+      python $MARTOOLS/createprecomplete.py
+      popd
+      #
+      MAR_FILE=tor-browser-osx${GBUILD_BITS}-${TORBROWSER_VERSION}_$LANG.mar
+      MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE ~/build/dmg/$DEST.app
+      ~/build/ddmg.sh $OUTDIR/TorBrowser-${TORBROWSER_VERSION}-osx${GBUILD_BITS}_$LANG.dmg ~/build/dmg/
+      rm -rf ~/build/dmg/$DEST.app
+    done
+  fi
diff --git a/gitian/descriptors/windows/gitian-bundle.yml b/gitian/descriptors/windows/gitian-bundle.yml
index b54d562..eac3345 100644
--- a/gitian/descriptors/windows/gitian-bundle.yml
+++ b/gitian/descriptors/windows/gitian-bundle.yml
@@ -154,6 +154,30 @@ script: |
   # Copy reproducibility info
   cp ../versions "Tor Browser"/Browser/TorBrowser/Docs/sources/
   cp ../bundle.inputs "Tor Browser"/Browser/TorBrowser/Docs/sources/
+
+  unzip ../win32-langpacks.zip
+  WIN32_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_WIN32"
+  PKG_LOCALE="en-US"
+  # If we are building a multi-lingual package, add all of the language packs
+  # and use "ALL" in the package name and as the locale for update purposes.
+  if [ "z$MULTI_LINGUAL" = "z1" ]; then
+    PKG_LOCALE="ALL"
+    pushd win32-langpacks
+    for LANG in $WIN32_LOCALES
+    do
+      xpi=$LANG.xpi
+      cp $xpi ../"Tor Browser"/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+    done
+    popd
+
+    # Set the update.locale to ALL (it is used to replace %LOCALE% within
+    # app.update.url).
+    pushd "Tor Browser"/Browser/
+    echo $PKG_LOCALE > update.locale
+    zip -Xm omni.ja update.locale
+    popd
+  fi
+
   #
   pushd "Tor Browser"/Browser/browser/
   unzip omni.ja defaults/preferences/000-tor-browser.js
@@ -173,7 +197,7 @@ script: |
   # Create full MAR file and installer.
   # Strangely, mbsdiff is linked as mbsdiff.exe even though it is a host
   # (e.g., Linux) executable.
-  MAR_FILE=tor-browser-win32-${TORBROWSER_VERSION}_en-US.mar
+  MAR_FILE=tor-browser-win32-${TORBROWSER_VERSION}_${PKG_LOCALE}.mar
   MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff.exe $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE "Tor Browser"/Browser
   makensis torbrowser.nsi
   # Working around NSIS braindamage
@@ -181,51 +205,47 @@ script: |
   python ~/build/pe_checksum_fix.py
   mv torbrowser-install-tmp2.exe torbrowser-install.exe
   rm torbrowser-install-tmp.exe
-  mv torbrowser-install.exe $OUTDIR/torbrowser-install-${TORBROWSER_VERSION}_en-US.exe
-  #
-  unzip ../win32-langpacks.zip
-  cd win32-langpacks
-  WIN32_LOCALES="$BUNDLE_LOCALES $BUNDLE_LOCALES_WIN32"
-  for LANG in $WIN32_LOCALES
-  do
-    xpi=$LANG.xpi
-    cp $xpi ../"Tor Browser"/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
-    cd ..
+  mv torbrowser-install.exe $OUTDIR/torbrowser-install-${TORBROWSER_VERSION}_${PKG_LOCALE}.exe
 
-    pushd "Tor Browser"/Browser/browser/
-    mkdir -p defaults/preferences
-    cp ~/build/000-tor-browser.js defaults/preferences/
-    echo "pref(\"general.useragent.locale\", \"$LANG\");" >> defaults/preferences/000-tor-browser.js
-    zip -Xm omni.ja defaults/preferences/000-tor-browser.js
-    rm -rf defaults
-    popd
+  # If we did not create a multi-lingual package above, create a package for
+  # each locale.
+  if [ "z$MULTI_LINGUAL" != "z1" ]; then
+    for LANG in $WIN32_LOCALES
+    do
+      xpi=win32-langpacks/$LANG.xpi
+      cp $xpi "Tor Browser"/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
 
-    # Set the update.locale (it is used to replace %LOCALE% within
-    # app.update.url) and remove the en-US spellchecking dictionary.
-    pushd "Tor Browser"/Browser/
-    echo "$LANG" > update.locale
-    zip -Xm omni.ja update.locale
-    rm -rf dictionaries
-    popd
+      pushd "Tor Browser"/Browser/browser/
+      mkdir -p defaults/preferences
+      cp ~/build/000-tor-browser.js defaults/preferences/
+      echo "pref(\"general.useragent.locale\", \"$LANG\");" >> defaults/preferences/000-tor-browser.js
+      zip -Xm omni.ja defaults/preferences/000-tor-browser.js
+      rm -rf defaults
+      popd
 
-    # Recreate precomplete file (needs to be accurate for full MAR updates).
-    pushd "Tor Browser"/Browser/
-    rm -f precomplete
-    python $MARTOOLS/createprecomplete.py
-    popd
+      # Set the update.locale (it is used to replace %LOCALE% within
+      # app.update.url), remove the en-US spellchecking dictionary, and
+      # recreate precomplete file (needs to be accurate for full MAR updates).
+      pushd "Tor Browser"/Browser/
+      echo "$LANG" > update.locale
+      zip -Xm omni.ja update.locale
+      rm -rf dictionaries
+      rm -f precomplete
+      python $MARTOOLS/createprecomplete.py
+      popd
 
-    # Create full MAR file and installer for this locale.
-    # Strangely, mbsdiff is linked as mbsdiff.exe even though it is a host
-    # (e.g., Linux) executable.
-    MAR_FILE=tor-browser-win32-${TORBROWSER_VERSION}_$LANG.mar
-    MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff.exe $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE "Tor Browser"/Browser
-    makensis torbrowser.nsi
-    # Working around NSIS braindamage
-    mv torbrowser-install.exe torbrowser-install-tmp.exe
-    python ~/build/pe_checksum_fix.py
-    mv torbrowser-install-tmp2.exe torbrowser-install.exe
-    rm torbrowser-install-tmp.exe
-    mv torbrowser-install.exe $OUTDIR/torbrowser-install-${TORBROWSER_VERSION}_$LANG.exe
-    rm "Tor Browser"/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
-    cd win32-langpacks
-  done
+      # Create full MAR file and installer for this locale.
+      # Strangely, mbsdiff is linked as mbsdiff.exe even though it is a host
+      # (e.g., Linux) executable.
+      MAR_FILE=tor-browser-win32-${TORBROWSER_VERSION}_$LANG.mar
+      MAR=$MARTOOLS/mar MBSDIFF=$MARTOOLS/mbsdiff.exe $MARTOOLS/make_full_update.sh -q $OUTDIR/$MAR_FILE "Tor Browser"/Browser
+      makensis torbrowser.nsi
+      # Working around NSIS braindamage
+      mv torbrowser-install.exe torbrowser-install-tmp.exe
+      python ~/build/pe_checksum_fix.py
+      mv torbrowser-install-tmp2.exe torbrowser-install.exe
+      rm torbrowser-install-tmp.exe
+      mv torbrowser-install.exe $OUTDIR/torbrowser-install-${TORBROWSER_VERSION}_$LANG.exe
+      rm "Tor Browser"/Browser/TorBrowser/Data/Browser/profile.default/extensions/langpack-$LANG at firefox.mozilla.org.xpi
+    done
+  fi
diff --git a/gitian/versions.nightly b/gitian/versions.nightly
index 04d2214..4e8cd42 100755
--- a/gitian/versions.nightly
+++ b/gitian/versions.nightly
@@ -8,6 +8,10 @@ BUNDLE_LOCALES_WIN32="ja"
 BUNDLE_LOCALES_MAC="ja-JP-mac"
 BUILD_PT_BUNDLES=1
 
+# If you remove MULTI_LINGUAL=1, be sure to use a version of Tor Launcher
+# that does not include the language prompt.
+MULTI_LINGUAL=1
+
 VERIFY_TAGS=0
 
 FIREFOX_VERSION=38.3.0esr



More information about the tbb-commits mailing list