Skip to content
Browse files

bug 753545 - make multil10n.py easier to run for developers. r=rail

  • Loading branch information...
1 parent afc781e commit 1c0ab2348b5bd1e20434d0aecdb183a54adf0f02 @escapewindow escapewindow committed May 30, 2012
View
50 configs/multi_locale/standalone_mozilla-central.py
@@ -0,0 +1,50 @@
+import os
+# The name of the directory we'll pull our source into.
+BUILD_DIR = "mozilla-central"
+# This is everything that comes after http://hg.mozilla.org/
+# e.g. "releases/mozilla-aurora"
+REPO_PATH = "mozilla-central"
+# This is where the l10n repos are (everything after http://hg.mozilla.org/)
+# for mozilla-central, that's "l10n-central".
+# For mozilla-aurora, that's "releases/l10n/mozilla-aurora"
+L10N_REPO_PATH = "l10n-central"
+# Currently this is assumed to be a subdirectory of your build dir
+OBJDIR = "objdir-droid"
+# Set this to mobile/xul for XUL Fennec
+ANDROID_DIR = "mobile/android"
+# Absolute path to your mozconfig.
+# By default it looks at "./mozconfig"
+MOZCONFIG = os.path.join(os.getcwd(), "mozconfig")
+
+config = {
+ "work_dir": ".",
+ "log_name": "multilocale",
+ "objdir": OBJDIR,
+ "locales_file": "%s/%s/locales/maemo-locales" % (BUILD_DIR, ANDROID_DIR),
+ "locales_dir": "%s/locales" % ANDROID_DIR,
+ "ignore_locales": ["en-US", "multi"],
+ "repos": [{
+ "repo": "http://hg.mozilla.org/%s" % REPO_PATH,
+ "tag": "default",
+ "dest": BUILD_DIR,
+ }],
+ "l10n_repos": [{
+ "repo": "http://hg.mozilla.org/build/compare-locales",
+ "tag": "RELEASE_AUTOMATION"
+ }],
+ "hg_l10n_base": "http://hg.mozilla.org/%s" % L10N_REPO_PATH,
+ "hg_l10n_tag": "default",
+ "l10n_dir": "l10n",
+ "merge_locales": True,
+ "mozilla_dir": BUILD_DIR,
+ "mozconfig": MOZCONFIG,
+ "default_actions": [
+ "pull-locale-source",
+ "build",
+ "package-en-US",
+ "backup-objdir",
+ "restore-objdir",
+ "add-locales",
+ "package-multi",
+ ],
+}
View
2 mozharness/base/errors.py
@@ -78,7 +78,7 @@ class VCSException(Exception):
# We may need to have various MakefileErrorLists for differing amounts of
# warning-ignoring-ness.
-MakefileErrorList = BaseErrorList + [
+MakefileErrorList = BaseErrorList + PythonErrorList + [
{'substr': r'''No rule to make target ''', 'level': ERROR},
{'regex': re.compile(r'''akefile.*was not found\.'''), 'level': ERROR},
{'regex': re.compile(r'''Stop\.$'''), 'level': ERROR},
View
7 mozharness/mozilla/l10n/locales.py
@@ -125,8 +125,11 @@ def query_abs_dirs(self):
dirs['abs_l10n_dir'] = os.path.join(dirs['abs_work_dir'],
c['l10n_dir'])
if 'objdir' in c:
- dirs['abs_objdir'] = os.path.join(dirs['abs_mozilla_dir'],
- c['objdir'])
+ if os.path.isabs(c['objdir']):
+ dirs['abs_objdir'] = c['objdir']
+ else:
+ dirs['abs_objdir'] = os.path.join(dirs['abs_mozilla_dir'],
+ c['objdir'])
dirs['abs_merge_dir'] = os.path.join(dirs['abs_objdir'],
'merged')
dirs['abs_locales_dir'] = os.path.join(dirs['abs_objdir'],
View
37 mozharness/mozilla/l10n/multi_locale_build.py
@@ -14,7 +14,7 @@
sys.path.insert(1, os.path.dirname(os.path.dirname(sys.path[0])))
-from mozharness.base.errors import MakefileErrorList
+from mozharness.base.errors import MakefileErrorList, SSHErrorList
from mozharness.base.log import FATAL
from mozharness.base.vcs.vcsbase import MercurialScript
from mozharness.mozilla.l10n.locales import LocalesMixin
@@ -96,6 +96,8 @@ def __init__(self, require_config_file=True):
'pull-locale-source',
'build', 'package-en-US',
'upload-en-US',
+ 'backup-objdir',
+ 'restore-objdir',
'add-locales', 'package-multi',
'upload-multi'],
require_config_file=require_config_file)
@@ -133,9 +135,10 @@ def build(self):
error_level=FATAL)
command = "make -f client.mk build"
env = self.query_env()
- self._process_command(command=command, cwd=dirs['abs_mozilla_dir'],
- env=env, error_list=MakefileErrorList,
- halt_on_failure=True)
+ if self._process_command(command=command,
+ cwd=dirs['abs_mozilla_dir'],
+ env=env, error_list=MakefileErrorList):
+ self.fatal("Erroring out after the build failed.")
def add_locales(self):
c = self.config
@@ -205,6 +208,32 @@ def upload_en_US(self):
# TODO
self.info("Not written yet.")
+ def backup_objdir(self):
+ dirs = self.query_abs_dirs()
+ if not os.path.isdir(dirs['abs_objdir']):
+ self.warning("%s doesn't exist! Skipping..." % dirs['abs_objdir'])
+ return
+ rsync = self.query_exe('rsync')
+ backup_dir = '%s-bak' % dirs['abs_objdir']
+ self.rmtree(backup_dir)
+ self.mkdir_p(backup_dir)
+ self.run_command([rsync, '-a', '--delete', '--partial',
+ '%s/' % dirs['abs_objdir'],
+ '%s/' % backup_dir],
+ error_list=SSHErrorList)
+
+ def restore_objdir(self):
+ dirs = self.query_abs_dirs()
+ rsync = self.query_exe('rsync')
+ backup_dir = '%s-bak' % dirs['abs_objdir']
+ if not os.path.isdir(dirs['abs_objdir']) or not os.path.isdir(backup_dir):
+ self.warning("Both %s and %s need to exist to restore the objdir! Skipping..." % dirs['abs_objdir'], backup_dir)
+ return
+ self.run_command([rsync, '-a', '--delete', '--partial',
+ '%s/' % backup_dir,
+ '%s/' % dirs['abs_objdir']],
+ error_list=SSHErrorList)
+
def upload_multi(self):
# TODO
self.info("Not written yet.")

0 comments on commit 1c0ab23

Please sign in to comment.
Something went wrong with that request. Please try again.