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:
Tom Ritter 2022-08-25 19:37:49 +00:00
parent 709d56796c
commit 8c11e2117e

View File

@ -361,42 +361,6 @@ def load_moz_yaml(filename, verify=True, require_license_file=True):
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():
"""Returns Voluptuous Schema object."""
return Schema(
@ -579,10 +543,6 @@ def _schema_1_additional(filename, manifest, require_license_file=True):
if not has_schema:
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.
# Everythig is parsed as a string to (a) not cause problems with revisions that