Bug 1637845 - Add 'file-updates' to the moz.yaml schema r=glob

This section is for expressing actions that occur after extracting
the files, before vendoring is completed. While we support running
scripts (or at least, we will...) this section can be used for simple
actions that don't need scripts.

Also, add the dav1d excluded files.

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

Depends on D75695
This commit is contained in:
Tom Ritter 2020-06-10 14:42:13 +00:00
parent 7c4c1b39f3
commit 4d9b87747c
2 changed files with 49 additions and 0 deletions

View File

@ -38,3 +38,17 @@ vendoring:
url: https://code.videolan.org/videolan/dav1d.git
source-hosting: gitlab
vendor-directory: third_party/dav1d
exclude:
- build/.gitattributes
- build/.gitignore
file-updates:
- action: replace-in-file
pattern: '@VCS_TAG@'
with: '{revision}'
file: include/vcs_version.h.in
- action: replace-in-file
pattern: '@VCS_TAG@'
with: '{revision}'
file: '{yaml_dir}/vcs_version.h'

View File

@ -161,6 +161,28 @@ vendoring:
run_after:
- script
- another script
# Strings to replace in various files after vendoring.
# All subfields are required
# Action must be 'replace-in-file'
# Pattern is what in the file to search for. It is an exact strng match
# With is the string to replace it with. Accepts the special keyword
# '{revision}' for the commit we are updating to.
# File is the file to replace it in. It is relative to the vendor-directory.
# If the vendor-directory is different from the directory of the yaml file,
# the keyword '{yaml_dir}' may be used to make the path relative to that
# directory
# optional
file-updates:
- action: replace-in-file
pattern: '@VCS_TAG@'
with: '{revision}'
file: include/vcs_version.h.in
- action: replace-in-file
pattern: '@VCS_TAG@'
with: '{revision}'
file: '{yaml_dir}/vcs_version.h'
"""
RE_SECTION = re.compile(r"^(\S[^:]*):").search
@ -278,6 +300,19 @@ def _schema_1():
"exclude": Unique([str]),
"include": Unique([str]),
"run_after": Unique([str]),
"file-updates": [
{
Required("action"): All(
In(
["replace-in-file"],
msg="Invalid action specified in file-updates",
)
),
Required("pattern"): All(str, Length(min=1)),
Required("with"): All(str, Length(min=1)),
Required("file"): All(str, Length(min=1)),
}
],
},
}
)