From d2799978d3f502e568dc8e98c6bcc8d01ce65491 Mon Sep 17 00:00:00 2001 From: Vivek Reddy Karri Date: Fri, 12 May 2023 20:02:04 +0000 Subject: [PATCH] Filter patches that are put in description Signed-off-by: Vivek Reddy Karri --- .../hwmgmt_kernel_patches.py | 25 ++++++++++++++++--- .../tests/test_hwmgmtaction.py | 2 -- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py b/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py index 5651d7068c7b..0e4bfa84b46f 100755 --- a/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py +++ b/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py @@ -108,6 +108,8 @@ class Data: new_up = list() # list of new non-upstream patches new_non_up = list() + # old upstream patches + old_up_patches = list() # current series file raw data old_series = list() # current non-upstream patch list @@ -369,6 +371,13 @@ def handle_exclusions(self): FileHandler.write_lines(os.path.join(self.args.build_root, SLK_KCONFIG_EXCLUDE), new_lines, True) print("-> INFO: updated kconfig-exclusion: \n{}".format("".join(FileHandler.read_raw(os.path.join(self.args.build_root, SLK_KCONFIG_EXCLUDE))))) + def list_patches(self): + old_up_patches = [] + for i in range(Data.i_mlnx_start, Data.i_mlnx_end): + old_up_patches.append(Data.old_series[i].strip()) + old_non_up_patches = [ptch.strip() for ptch in Data.old_non_up] + return old_up_patches, old_non_up_patches + def parse_id(self, id_): if id_: id_ = "https://github.com/gregkh/linux/commit/" + id_ @@ -377,14 +386,22 @@ def parse_id(self, id_): def create_commit_msg(self, table): title = COMMIT_TITLE.format(self.args.hw_mgmt_ver) changes_slk, changes_sb = {}, {} + old_up_patches, old_non_up_patches = self.list_patches() for patch in table: id_ = self.parse_id(patch.get(COMMIT_ID, "")) - if patch.get(PATCH_NAME) in Data.new_up: - changes_slk[patch.get(PATCH_NAME)] = id_ - elif patch.get(PATCH_NAME) in Data.new_non_up: - changes_sb[patch.get(PATCH_NAME)] = id_ + patch_ = patch.get(PATCH_NAME) + if patch_ in Data.new_up and patch_ not in old_up_patches: + changes_slk[patch_] = id_ + print(f"-> INFO: Patch: {patch_}, Commit: {id_}, added to linux-kernel description") + elif patch_ in Data.new_non_up and patch_ not in old_non_up_patches: + changes_sb[patch_] = id_ + print(f"-> INFO: Patch: {patch_}, Commit: {id_}, added to buildimage description") + else: + print(f"-> INFO: Patch: {patch_}, Commit: {id_}, is not added") slk_commit_msg = title + "\n" + build_commit_description(changes_slk) sb_commit_msg = title + "\n" + build_commit_description(changes_sb) + print(f"-> INFO: SLK Commit Message: \n {slk_commit_msg}") + print(f"-> INFO: SB Commit Message: \n {sb_commit_msg}") return sb_commit_msg, slk_commit_msg def perform(self): diff --git a/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py b/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py index be33f1387357..e95d10a44e34 100644 --- a/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py +++ b/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py @@ -37,10 +37,8 @@ TEST_SLK_COMMIT = """\ Intgerate HW-MGMT 7.0030.0937 Changes ## Patch List -* 0001-i2c-mlxcpld-Update-module-license.patch : https://github.com/gregkh/linux/commit/f069291bd5fc * 0002-i2c-mlxcpld-Decrease-polling-time-for-performance-im.patch : https://github.com/gregkh/linux/commit/cb9744178f33 * 0003-i2c-mlxcpld-Add-support-for-I2C-bus-frequency-settin.patch : https://github.com/gregkh/linux/commit/66b0c2846ba8 -* 0004-i2c-mux-mlxcpld-Update-module-license.patch : https://github.com/gregkh/linux/commit/337bc68c294d * 0005-i2c-mux-mlxcpld-Move-header-file-out-of-x86-realm.patch : https://github.com/gregkh/linux/commit/98d29c410475 * 0006-i2c-mux-mlxcpld-Convert-driver-to-platform-driver.patch : https://github.com/gregkh/linux/commit/84af1b168c50 * 0007-i2c-mux-mlxcpld-Prepare-mux-selection-infrastructure.patch : https://github.com/gregkh/linux/commit/81566938083a