mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1786948: Remove dead code from the moz.yaml schema validation r=jewilde
Differential Revision: https://phabricator.services.mozilla.com/D155596
This commit is contained in:
parent
709d56796c
commit
8c11e2117e
40
python/mozbuild/mozbuild/vendor/moz_yaml.py
vendored
40
python/mozbuild/mozbuild/vendor/moz_yaml.py
vendored
@ -361,42 +361,6 @@ def load_moz_yaml(filename, verify=True, require_license_file=True):
|
|||||||
return manifest
|
return manifest
|
||||||
|
|
||||||
|
|
||||||
def update_moz_yaml(filename, release, revision, verify=True, write=True):
|
|
||||||
"""Update origin:release and vendoring:revision without stripping
|
|
||||||
comments or reordering fields."""
|
|
||||||
|
|
||||||
if verify:
|
|
||||||
load_moz_yaml(filename)
|
|
||||||
|
|
||||||
lines = []
|
|
||||||
with open(filename) as f:
|
|
||||||
found_release = False
|
|
||||||
found_revision = False
|
|
||||||
section = None
|
|
||||||
for line in f.readlines():
|
|
||||||
m = RE_SECTION(line)
|
|
||||||
if m:
|
|
||||||
section = m.group(1)
|
|
||||||
else:
|
|
||||||
m = RE_FIELD(line)
|
|
||||||
if m:
|
|
||||||
(name, value) = m.groups()
|
|
||||||
if section == "origin" and name == "release":
|
|
||||||
line = " release: %s\n" % release
|
|
||||||
found_release = True
|
|
||||||
elif section == "origin" and name == "revision":
|
|
||||||
line = " revision: %s\n" % revision
|
|
||||||
found_revision = True
|
|
||||||
lines.append(line)
|
|
||||||
|
|
||||||
if not found_release and found_revision:
|
|
||||||
raise ValueError("Failed to find origin:release and " "origin:revision")
|
|
||||||
|
|
||||||
if write:
|
|
||||||
with open(filename, "w") as f:
|
|
||||||
f.writelines(lines)
|
|
||||||
|
|
||||||
|
|
||||||
def _schema_1():
|
def _schema_1():
|
||||||
"""Returns Voluptuous Schema object."""
|
"""Returns Voluptuous Schema object."""
|
||||||
return Schema(
|
return Schema(
|
||||||
@ -579,10 +543,6 @@ def _schema_1_additional(filename, manifest, require_license_file=True):
|
|||||||
if not has_schema:
|
if not has_schema:
|
||||||
raise ValueError("Not simple YAML")
|
raise ValueError("Not simple YAML")
|
||||||
|
|
||||||
# Verify YAML can be updated.
|
|
||||||
if "vendor" in manifest:
|
|
||||||
update_moz_yaml(filename, "", "", verify=False, write=True)
|
|
||||||
|
|
||||||
|
|
||||||
# Do type conversion for the few things that need it.
|
# Do type conversion for the few things that need it.
|
||||||
# Everythig is parsed as a string to (a) not cause problems with revisions that
|
# Everythig is parsed as a string to (a) not cause problems with revisions that
|
||||||
|
Loading…
Reference in New Issue
Block a user