Skip to content

Commit

Permalink
Delete old patches under SDK markers during integrate-mlnx-sdk
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
  • Loading branch information
vivekrnv committed Nov 8, 2023
1 parent 906c4df commit 7db80b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions platform/mellanox/integration-scripts/sdk_kernel_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ def get_new_patches(self):
Data.new_patches = FileHandler.read_dir(patches_path, "*.patch")
Data.new_patches.sort()

def cleanup_old_patches(self):
patches_del = copy.deepcopy(Data.old_patches)
for patch in Data.new_patches:
if patch in Data.old_patches:
patches_del.remove(patch)
print(f" -> Patches to be removed are : {patches_del}")
for patch in patches_del:
file_n = os.path.join(self.args.build_root, os.path.join(SLK_PATCH_LOC, patch))
if os.path.exists(file_n):
print(f"{file_n} is deleted")
os.remove(file_n)

def refresh_markers(self):
print("-> INFO Refreshing Markers ")
(Data.i_sdk_start, Data.i_sdk_end) = FileHandler.find_marker_indices(Data.old_series, SDK_MARKER)
Expand Down Expand Up @@ -187,6 +199,7 @@ def perform(self):
self.refresh_markers()
self.add_new_patch_series()
self.process_update()
self.cleanup_old_patches()
patch_table = self.fetch_patch_table(os.path.join(self.args.patches, Data.k_dir))
slk_msg = self.create_commit_msg(patch_table)
if self.args.slk_msg:
Expand Down

0 comments on commit 7db80b2

Please sign in to comment.