Skip to content

Commit 7db80b2

Browse files
committed
Delete old patches under SDK markers during integrate-mlnx-sdk
Signed-off-by: Vivek Reddy <[email protected]>
1 parent 906c4df commit 7db80b2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

platform/mellanox/integration-scripts/sdk_kernel_patches.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ def get_new_patches(self):
137137
Data.new_patches = FileHandler.read_dir(patches_path, "*.patch")
138138
Data.new_patches.sort()
139139

140+
def cleanup_old_patches(self):
141+
patches_del = copy.deepcopy(Data.old_patches)
142+
for patch in Data.new_patches:
143+
if patch in Data.old_patches:
144+
patches_del.remove(patch)
145+
print(f" -> Patches to be removed are : {patches_del}")
146+
for patch in patches_del:
147+
file_n = os.path.join(self.args.build_root, os.path.join(SLK_PATCH_LOC, patch))
148+
if os.path.exists(file_n):
149+
print(f"{file_n} is deleted")
150+
os.remove(file_n)
151+
140152
def refresh_markers(self):
141153
print("-> INFO Refreshing Markers ")
142154
(Data.i_sdk_start, Data.i_sdk_end) = FileHandler.find_marker_indices(Data.old_series, SDK_MARKER)
@@ -187,6 +199,7 @@ def perform(self):
187199
self.refresh_markers()
188200
self.add_new_patch_series()
189201
self.process_update()
202+
self.cleanup_old_patches()
190203
patch_table = self.fetch_patch_table(os.path.join(self.args.patches, Data.k_dir))
191204
slk_msg = self.create_commit_msg(patch_table)
192205
if self.args.slk_msg:

0 commit comments

Comments
 (0)