Bug 1509962: [mozrelease] Add mozrelease to in-tree lint config; r=mtabara

Differential Revision: https://phabricator.services.mozilla.com/D12975

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2018-12-03 06:44:08 +00:00
Родитель 68fc4da217
Коммит 5cacb2dfc9
7 изменённых файлов: 32 добавлений и 9 удалений

Просмотреть файл

@ -10,7 +10,7 @@ class ChunkingError(Exception):
def getChunk(things, chunks, thisChunk):
if thisChunk > chunks:
raise ChunkingError("thisChunk (%d) is greater than total chunks (%d)" %
(thisChunk, chunks))
(thisChunk, chunks))
possibleThings = copy(things)
nThings = len(possibleThings)
for c in range(1, chunks + 1):

Просмотреть файл

@ -6,6 +6,7 @@ product_ftp_map = {
"fennec": "mobile",
}
def product2ftp(product):
return product_ftp_map.get(product, product)
@ -16,7 +17,7 @@ def getCandidatesDir(product, version, buildNumber, protocol=None, server=None):
product = product2ftp(product)
directory = "/{}/candidates/{}-candidates/build{}".format(
product, str(version), str(buildNumber)
product, str(version), str(buildNumber),
)
if protocol:

Просмотреть файл

@ -39,12 +39,15 @@ info_file_platform_map = {
"win64": "win64",
}
def ftp2updatePlatforms(platform):
return update_platform_map.get(platform, platform)
def ftp2shippedLocales(platform):
return sl_platform_map.get(platform, platform)
def shippedLocales2ftp(platform):
matches = []
try:
@ -54,5 +57,6 @@ def shippedLocales2ftp(platform):
except IndexError:
return [platform]
def ftp2infoFile(platform):
return info_file_platform_map.get(platform, platform)

Просмотреть файл

@ -1,4 +1,9 @@
from __future__ import absolute_import
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import os
import re
@ -50,15 +55,16 @@ class UpdateVerifyConfig(object):
def _parseLine(self, line):
entry = {}
items = re.findall("\w+=[\"'][^\"']*[\"']", line)
items = re.findall(r"\w+=[\"'][^\"']*[\"']", line)
for i in items:
m = re.search(
"(?P<key>\w+)=[\"'](?P<value>.+)[\"']", i).groupdict()
r"(?P<key>\w+)=[\"'](?P<value>.+)[\"']", i).groupdict()
if m["key"] not in self.global_keys and m["key"] not in self.release_keys:
raise UpdateVerifyError(
"Unknown key '%s' found on line:\n%s" % (m["key"], line))
if m["key"] in entry:
raise UpdateVerifyError("Multiple values found for key '%s' on line:\n%s" % (m["key"], line))
raise UpdateVerifyError(
"Multiple values found for key '%s' on line:\n%s" % (m["key"], line))
entry[m["key"]] = m["value"]
if not entry:
raise UpdateVerifyError("No parseable data in line '%s'" % line)
@ -119,7 +125,9 @@ class UpdateVerifyConfig(object):
If a string is passed, they will be converted to a list for internal
storage"""
if self.getRelease(build_id, from_path):
raise UpdateVerifyError("Couldn't add release identified by build_id '%s' and from_path '%s': already exists in config" % (build_id, from_path))
raise UpdateVerifyError(
"Couldn't add release identified by build_id '%s' and from_path '%s': "
"already exists in config" % (build_id, from_path))
if isinstance(locales, basestring):
locales = sorted(list(locales.split()))
if isinstance(patch_types, basestring):
@ -140,7 +148,9 @@ class UpdateVerifyConfig(object):
def addLocaleToRelease(self, build_id, locale, from_path=None):
r = self.getRelease(build_id, from_path)
if not r:
raise UpdateVerifyError("Couldn't add '%s' to release identified by build_id '%s' and from_path '%s': '%s' doesn't exist in this config." % (locale, build_id, from_path, build_id))
raise UpdateVerifyError(
"Couldn't add '%s' to release identified by build_id '%s' and from_path '%s': "
"'%s' doesn't exist in this config." % (locale, build_id, from_path, build_id))
r["locales"].append(locale)
r["locales"] = sorted(r["locales"])

Просмотреть файл

@ -3,6 +3,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import json
@ -110,7 +115,7 @@ def test_get_previous_tag_version(version, tag, previous_tag):
mock_hg_json = {
'tags': [
{'tag': tag} for tag in ff_48_tags
{'tag': ff_48_tag} for ff_48_tag in ff_48_tags
],
}

Просмотреть файл

@ -3,6 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
from md5 import md5
import os
from tempfile import mkstemp

Просмотреть файл

@ -22,6 +22,7 @@ flake8:
- python/mozboot
- python/mozbuild/mozpack/path.py
- python/mozlint
- python/mozrelease
- python/mozterm
- python/mozversioncontrol
- python/safety