Skip to content
Snippets Groups Projects
Commit c42eef48 authored by Tom Ritter's avatar Tom Ritter
Browse files

Bug 1892292: Have a better error message for when patching fails r=maltejur

parent ad2077c3
No related branches found
No related tags found
No related merge requests found
......@@ -873,17 +873,31 @@ class VendorManifest(MozbuildObject):
def import_local_patches(self, patches, yaml_dir, vendor_dir):
self.logInfo({}, "Importing local patches...")
for patch in self.convert_patterns_to_paths(yaml_dir, patches):
script = [
"patch",
"-p1",
"--directory",
vendor_dir,
"--input",
os.path.abspath(patch),
"--no-backup-if-mismatch",
]
self.run_process(
args=script,
log_name=script,
try:
for patch in self.convert_patterns_to_paths(yaml_dir, patches):
script = [
"patch",
"-p1",
"-r",
"/dev/stdout",
"--directory",
vendor_dir,
"--input",
os.path.abspath(patch),
"--no-backup-if-mismatch",
]
self.run_process(
args=script,
log_name=script,
)
except Exception as e:
msgs = [f"Could not apply {patch}, possible reasons:"]
msgs.append(" - You ran --patch-mode=only before running --patch-mode=none")
msgs.append(" - You tried to apply the patches twice")
msgs.append(
" - The library update has modified the files so the patch no longer applies cleanly"
)
msgs.append("I am going to re-throw the exception now.")
for m in msgs:
self.log(logging.WARN, "vendor", {}, m)
raise e
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment