From 800d92045d6cffb76caf62d4670ec02e9286fbb3 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Thu, 28 Sep 2023 12:33:05 +0200 Subject: [PATCH] tools: patching: don't rewrite auto-generated patches (eg, drivers) --- lib/tools/common/patching_utils.py | 7 +++++-- lib/tools/patching.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/tools/common/patching_utils.py b/lib/tools/common/patching_utils.py index b875a0e37a..d07840276e 100755 --- a/lib/tools/common/patching_utils.py +++ b/lib/tools/common/patching_utils.py @@ -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 diff --git a/lib/tools/patching.py b/lib/tools/patching.py index 5983eec997..2cd0c73075 100755 --- a/lib/tools/patching.py +++ b/lib/tools/patching.py @@ -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