def verify_l10n_dashboard(l10n_changesets, l10n_dashboard_version=None): """Checks the l10n-changesets against the l10n dashboard""" success = True locales = query_locale_revisions(l10n_changesets) if l10n_dashboard_version: l10n_dashboard_version = getL10nDashboardVersion( l10n_dashboard_version, releaseConfig['productName'], parse_version=False) else: l10n_dashboard_version = getL10nDashboardVersion( releaseConfig['version'], releaseConfig['productName']) dash_url = 'https://l10n.mozilla.org/shipping/l10n-changesets?ms=%s' % \ l10n_dashboard_version log.info("Comparing l10n changesets on dashboard %s to on-disk %s ..." % (dash_url, l10n_changesets)) try: dash_changesets = {} for line in urllib2.urlopen(dash_url): locale, revision = line.split() dash_changesets[locale] = revision for locale in locales: revision = locales[locale] dash_revision = dash_changesets.pop(locale, None) if not dash_revision: log.error("\tlocale %s missing on dashboard" % locale) success = False error_tally.add('verify_l10n_dashboard') elif revision != dash_revision: log.error("\tlocale %s revisions not matching: %s (config)" " vs. %s (dashboard)" % (locale, revision, dash_revision)) success = False error_tally.add('verify_l10n_dashboard') for locale in dash_changesets: log.error("\tlocale %s missing in config" % locale) success = False error_tally.add('verify_l10n_dashboard') except urllib2.HTTPError: log.error("cannot find l10n dashboard at %s" % dash_url) success = False error_tally.add('verify_l10n_dashboard') return success
def get_l10_dashboard_changeset(version, product): """Helper function to retrieve l10n dashboard changesets >>> get_l10_dashboard_changeset('47.0, 'firefox') ach revision_123 af revision_245 an revision_456 ... """ l10n_dashboard_version = getL10nDashboardVersion(version, product) url = L10N_DASHBOARD_URL_TEMPLATE.format(milestone=l10n_dashboard_version) ret = make_generic_get_request(url).strip() dash_dict = dict() for line in ret.splitlines(): locale, revision = line.split() dash_dict[locale] = revision return dash_dict
def _doTest(self, expected, version): self.assertEquals(expected, getL10nDashboardVersion(version, "firefox"))