Friday, May 15, 2009

L10n nightly updates starts with...

The main bug that I am currently working on is to generate MAR files for the different locales we have. This will be one more step towards having nightly updates for all the different locales.

A MAR file (Mozilla ARchive) is basically a zip file but custom made for Mozilla purposes. This type of file is downloaded by Firefox through the update mechanisms; These update systems are used by Firefox to know where the next available update will be.

These MAR files can be partial or complete updates. What does this mean? When you are in the previous release to the new update you just receive a small/partial MAR file which only contains the differences between your current release and the new one. When you skip an update falling behind one or more releases you will get a full/complete MAR file with all the files for the new release meaning that Firefox will download a larger file.

Currently I have been able to create locally with the help of a script a complete MAR file for the French locale. Check the code that I used at the end of this post.

What comes next? I have to make changes to the factory that produces the l10n nightly builds to generate them with the MAR files.

There are many more things to consider but I will skip the details for when I make a little bit more of progress.

To keep yourself up-to-date with this work, CC yourself to the following bug:
Bug 480081 - Generate partial & complete mars for nightly l10n builds

Here is a document explaining what a MAR file is:

NOTE: Remove "dist/l10n-stage" if you run into weird problems

Here is the script I used to create the MAR file (check under dist/update):
# Author: Armen Zambrano Gasparnian
# Contact:
# Purpose: Repackage a locale in hg
export BRANCH='mozilla-central'
#export BRANCH='mozilla-1.9.1'
export REPO_PATH='mozilla-central'
#export REPO_PATH='releases/mozilla-1.9.1'
export L10N_REPO_PATH='l10n-central'
#export L10N_REPO_PATH='releases/l10n-mozilla-1.9.1'
export LOCALE='fr'
# 1) Get ready
set -ex
# Let's isolate our work depending on the branch
mkdir -p $BRANCH && cd $BRANCH
mkdir -p l10n
rm -rf $BRANCH/dist/upload
# 2) checkout the main repo
if [ -d $BRANCH ]; then
hg -R $BRANCH pull -r tip ;
hg clone$REPO_PATH/ ;
hg -R $BRANCH update

# 3) checkout the locale's repo
cd l10n
if [ -d $LOCALE ]; then
hg -R $LOCALE pull -r tip ;
hg clone$L10N_REPO_PATH/$LOCALE/ ;
hg -R $LOCALE update
cd ..
# 4) generate the configure file
cd js/src
cd ../..
# 5) configure
./configure --enable-application='browser' --with-l10n-base=../l10n --enable-update-packaging
# 5.A) tools needed
make -C nsprpub
make -C config
make -C modules/libmar
# 6) get the en-US binary
make -C browser/locales wget-en-US
# 7) generate the xpi and the installers
make -C browser/locales installers-$LOCALE MOZ_MAKE_COMPLETE_MAR=1
# 8) rearrange the packages in the correct structure for a nightly on ftp
make -C browser/locales prepare-upload-latest-$LOCALE
# 9) list the packages in the correct place, the correct naming and the correct chmod
ls -l dist/upload/latest
ls -l dist/update
# I do not have an ftp server so I won't be running this command
# sh -c 'scp -i $KEY_PATH -r * $USER@$SERVER:$UPLOAD_PATH'

Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

No comments:

Post a Comment