Bug 1847898 - Part 2: Merge process_regular and process_individual implementation. r=tjr

Differential Revision: https://phabricator.services.mozilla.com/D185868
This commit is contained in:
Tooru Fujisawa 2023-08-10 21:50:42 +00:00
parent 5f9ce53fe2
commit cfc88c67cd

View File

@ -161,7 +161,9 @@ class VendorManifest(MozbuildObject):
new_revision, timestamp, ignore_modified, add_to_exports
)
elif flavor == "individual-files":
self.process_individual(new_revision, timestamp, ignore_modified)
self.process_individual(
new_revision, timestamp, ignore_modified, add_to_exports
)
elif flavor == "rust":
self.process_rust(
command_context,
@ -233,31 +235,14 @@ class VendorManifest(MozbuildObject):
)
download_and_write_file(url, destination)
def process_individual(self, new_revision, timestamp, ignore_modified):
self.fetch_individual(new_revision)
self.spurious_check(new_revision, ignore_modified)
self.logInfo({}, "Checking for update actions")
self.update_files(new_revision)
self.update_yaml(new_revision, timestamp)
self.logInfo({"rev": new_revision}, "Updated to '{rev}'.")
if "patches" in self.manifest["vendoring"]:
# Remind the user
self.log(
logging.CRITICAL,
"vendor",
{},
"Patches present in manifest!!! Please run "
"'./mach vendor --patch-mode only' after commiting changes.",
)
def process_regular(self, new_revision, timestamp, ignore_modified, add_to_exports):
def process_regular_or_individual(
self, is_individual, new_revision, timestamp, ignore_modified, add_to_exports
):
if self.should_perform_step("fetch"):
self.fetch_and_unpack(new_revision)
if is_individual:
self.fetch_individual(new_revision)
else:
self.fetch_and_unpack(new_revision)
else:
self.logInfo({}, "Skipping fetching upstream source.")
@ -285,6 +270,8 @@ class VendorManifest(MozbuildObject):
else:
self.logInfo({}, "Skipping updating the moz.yaml file.")
# individual flavor does not need this step, but performing it should
# always be a no-op
if self.should_perform_step("update-moz-build"):
self.logInfo({}, "Updating moz.build files")
self.update_moz_build(
@ -307,6 +294,20 @@ class VendorManifest(MozbuildObject):
"'./mach vendor --patch-mode only' after commiting changes.",
)
def process_regular(self, new_revision, timestamp, ignore_modified, add_to_exports):
is_individual = False
self.process_regular_or_individual(
is_individual, new_revision, timestamp, ignore_modified, add_to_exports
)
def process_individual(
self, new_revision, timestamp, ignore_modified, add_to_exports
):
is_individual = True
self.process_regular_or_individual(
is_individual, new_revision, timestamp, ignore_modified, add_to_exports
)
def get_source_host(self):
if self.manifest["vendoring"]["source-hosting"] == "gitlab":
from mozbuild.vendor.host_gitlab import GitLabHost