Bug 1792224: Make the tracking field validation simpler r=jewilde

Differential Revision: https://phabricator.services.mozilla.com/D158049
This commit is contained in:
Tom Ritter 2022-10-18 16:56:07 +00:00
parent 8f09cde190
commit 012f41dcbf
3 changed files with 5 additions and 24 deletions

View File

@ -181,7 +181,6 @@ updatebot:
"vendoring": {
"url": "https://example.com",
"source-hosting": "gitlab",
"tracking": "commit",
},
"updatebot": {
"maintainer-phab": "tjr",
@ -232,7 +231,6 @@ updatebot:
"vendoring": {
"url": "https://example.com",
"source-hosting": "gitlab",
"tracking": "commit",
},
"updatebot": {
"maintainer-phab": "tjr",
@ -285,7 +283,6 @@ updatebot:
"vendoring": {
"url": "https://example.com",
"source-hosting": "gitlab",
"tracking": "commit",
},
"updatebot": {
"maintainer-phab": "tjr",
@ -405,7 +402,7 @@ updatebot:
"vendoring": {
"url": "https://example.com",
"source-hosting": "gitlab",
"tracking": "commit",
"tracking": "tag",
"flavor": "rust",
},
"updatebot": {
@ -438,7 +435,7 @@ origin:
revision: AA001122334455
vendoring:
url: https://example.com
tracking: commit
tracking: tag
source-hosting: gitlab
flavor: rust
bugzilla:
@ -473,7 +470,6 @@ updatebot:
"bugzilla": {"component": "Graphics", "product": "Core"},
"vendoring": {
"url": "https://example.com",
"tracking": "commit",
"source-hosting": "gitlab",
},
"updatebot": {
@ -552,7 +548,6 @@ updatebot:
"bugzilla": {"component": "Graphics", "product": "Core"},
"vendoring": {
"url": "https://example.com",
"tracking": "commit",
"source-hosting": "gitlab",
},
"updatebot": {
@ -631,7 +626,6 @@ updatebot:
"bugzilla": {"component": "Graphics", "product": "Core"},
"vendoring": {
"url": "https://example.com",
"tracking": "commit",
"source-hosting": "gitlab",
},
"updatebot": {
@ -757,7 +751,6 @@ updatebot:
"bugzilla": {"component": "Graphics", "product": "Core"},
"vendoring": {
"url": "https://example.com",
"tracking": "commit",
"source-hosting": "gitlab",
"flavor": "individual-files",
"individual-files": [

View File

@ -124,6 +124,7 @@ vendoring:
flavor: rust
# Type of git reference (commit, tag) to track updates from.
# You cannot use tag tracking with the individual-files flavor
# If omitted, will default to tracking commits.
tracking: commit
@ -424,7 +425,7 @@ def _schema_1():
Length(min=1),
In(VALID_SOURCE_HOSTS, msg="Unsupported Source Hosting"),
),
"tracking": All(str, Length(min=1)),
"tracking": Match(r"^(commit|tag)$"),
"flavor": Match(r"^(regular|rust|individual-files)$"),
"skip-vendoring-steps": Unique([str]),
"vendor-directory": All(str, Length(min=1)),
@ -517,19 +518,6 @@ def _schema_1_additional(filename, manifest, require_license_file=True):
'If "vendoring" is present, "revision" must be present in "origin"'
)
# Only commit and tag are allowed for tracking
if "vendoring" in manifest:
if "tracking" not in manifest["vendoring"]:
manifest["vendoring"]["tracking"] = "commit"
if (
manifest["vendoring"]["tracking"] != "commit"
and manifest["vendoring"]["tracking"] != "tag"
):
raise ValueError(
"Only commit or tag is supported for git references to track, %s was given."
% manifest["vendoring"]["tracking"]
)
# If there are Updatebot tasks, then certain fields must be present and
# defaults need to be set.
if "updatebot" in manifest and "tasks" in manifest["updatebot"]:

View File

@ -91,7 +91,7 @@ class VendorManifest(MozbuildObject):
# ==========================================================
self.source_host = self.get_source_host()
ref_type = self.manifest["vendoring"]["tracking"]
ref_type = self.manifest["vendoring"].get("tracking", "commit")
flavor = self.manifest["vendoring"].get("flavor", "regular")
if revision == "tip":