Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bug 747457 - add per-locale status properties in mobile_l10n. r=rail

  • Loading branch information...
commit d2099028cc06ffd15b497a8665a99e4b4749e6ab 1 parent aa7c2c3
@escapewindow escapewindow authored
View
31 mozharness/mozilla/buildbot.py
@@ -34,6 +34,7 @@
class BuildbotMixin(object):
buildbot_config = None
+ buildbot_properties = {}
def read_buildbot_config(self):
c = self.config
@@ -55,3 +56,33 @@ def buildbot_status(self, tbpl_status, level=None):
if not level:
level = TBPL_STATUS_DICT[tbpl_status]
self.add_summary("# TBPL %s #" % tbpl_status, level=level)
+
+ def set_buildbot_property(self, prop_name, prop_value, write_to_file=False):
+ self.info("Setting buildbot property %s to %s" % (prop_name, prop_value))
+ self.buildbot_properties[prop_name] = prop_value
+ if write_to_file:
+ return self.dump_buildbot_properties(prop_list=[prop_name], file_name=prop_name)
+ return self.buildbot_properties[prop_name]
+
+ def query_buildbot_property(self, prop_name):
+ return self.buildbot_properties.get(prop_name)
+
+ def dump_buildbot_properties(self, prop_list=None, file_name="properties", error_level=ERROR):
+ c = self.config
+ if not os.path.isabs(file_name):
+ file_name = os.path.join(c['base_work_dir'], "properties", file_name)
+ dir_name = os.path.dirname(file_name)
+ if not os.path.isdir(dir_name):
+ self.mkdir_p(dir_name)
+ if not prop_list:
+ prop_list = self.buildbot_properties.keys()
+ self.info("Writing buildbot properties to %s" % file_name)
+ else:
+ if not isinstance(prop_list, (list, tuple)):
+ self.log("dump_buildbot_properties: Can't dump non-list prop_list %s!" % str(prop_list), level=error_level)
+ return
+ self.info("Writing buildbot properties %s to %s" % (str(prop_list), file_name))
+ contents = ""
+ for prop in prop_list:
+ contents += "%s:%s\n" % (prop, self.buildbot_properties.get(prop, "None"))
+ return self.write_to_file(file_name, contents)
View
2  mozharness/mozilla/l10n/locales.py
@@ -98,9 +98,11 @@ def run_compare_locales(self, locale, halt_on_failure=False):
self.mkdir_p(dirs['abs_merge_dir'])
command = "python %s -m %s l10n.ini %s %s" % (compare_locales_script,
dirs['abs_merge_dir'], dirs['abs_l10n_dir'], locale)
+ self.info("*** BEGIN compare-locales %s" % locale)
status = self.run_command(command, error_list=compare_locales_error_list,
cwd=dirs['abs_locales_src_dir'], env=env,
halt_on_failure=halt_on_failure)
+ self.info("*** END compare-locales %s" % locale)
return status
def query_abs_dirs(self):
View
28 scripts/mobile_l10n.py
@@ -15,12 +15,18 @@
import re
import sys
+try:
+ import simplejson as json
+except ImportError:
+ import json
+
# load modules from parent dir
sys.path.insert(1, os.path.dirname(sys.path[0]))
from mozharness.base.errors import BaseErrorList, MakefileErrorList
from mozharness.base.log import OutputParser
from mozharness.base.transfer import TransferMixin
+from mozharness.mozilla.buildbot import BuildbotMixin
from mozharness.mozilla.release import ReleaseMixin
from mozharness.mozilla.signing import MobileSigningMixin
from mozharness.base.vcs.vcsbase import MercurialScript
@@ -30,7 +36,7 @@
# MobileSingleLocale {{{1
class MobileSingleLocale(LocalesMixin, ReleaseMixin, MobileSigningMixin,
- TransferMixin, MercurialScript):
+ TransferMixin, BuildbotMixin, MercurialScript):
config_options = [[
['--locale',],
{"action": "extend",
@@ -113,6 +119,7 @@ def __init__(self, require_config_file=True):
self.upload_env = None
self.version = None
self.upload_urls = {}
+ self.locales_property = {}
# Helper methods {{{2
def query_repack_env(self):
@@ -244,6 +251,25 @@ def query_upload_url(self, locale):
self.error("Can't determine the upload url for %s!" % locale)
self.error("You either need to run --upload-repacks before --create-nightly-snippets, or specify the 'snippet_base_url' in self.config!")
+ def add_failure(self, locale, message, **kwargs):
+ self.locales_property[locale] = "Failed"
+ prop_key = "%s_failure" % locale
+ prop_value = self.query_buildbot_property(prop_key)
+ if prop_value:
+ prop_value = "%s %s" % (prop_value, message)
+ else:
+ prop_value = message
+ self.set_buildbot_property(prop_key, prop_value, write_to_file=True)
+ MercurialScript.add_failure(self, locale, message=message, **kwargs)
+
+ def summary(self):
+ MercurialScript.summary(self)
+ # TODO we probably want to make this configurable on/off
+ locales = self.query_locales()
+ for locale in locales:
+ self.locales_property.setdefault(locale, "Success")
+ self.set_buildbot_property("locales", json.dumps(self.locales_property), write_to_file=True)
+
# Actions {{{2
def pull(self):
c = self.config
Please sign in to comment.
Something went wrong with that request. Please try again.