tools: patching: don't rewrite auto-generated patches (eg, drivers)

This commit is contained in:
Ricardo Pardini 2023-09-28 12:33:05 +02:00
parent 2c24f7e334
commit 800d92045d
2 changed files with 6 additions and 3 deletions

View File

@ -240,8 +240,11 @@ class PatchFileInDir:
log.info(f"Rewriting {output_file} with new patches...")
with open(output_file, "w") as f:
for patch in patches:
log.info(f"Writing patch {patch.counter} to {output_file}...")
f.write(patch.rewritten_patch)
if patch.parent.patch_dir.is_autogen_dir:
log.debug(f"Skipping autogen patch {patch.counter} in file {output_file}...")
else:
log.info(f"Writing patch {patch.counter} to {output_file}...")
f.write(patch.rewritten_patch)
# Placeholder for future manual work

View File

@ -315,7 +315,7 @@ if apply_patches:
commit_hash = committed['commit_hash']
one_patch.git_commit_hash = commit_hash
if rewrite_patches_in_place:
if rewrite_patches_in_place and not (one_patch.parent.patch_dir.is_autogen_dir):
rewritten_patch = patching_utils.export_commit_as_patch(git_repo, commit_hash)
one_patch.rewritten_patch = rewritten_patch