diff --git a/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py b/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py index bccb8a37058a..5651d7068c7b 100755 --- a/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py +++ b/platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py @@ -6,7 +6,6 @@ import argparse import copy import difflib -import jinja2 from helper import * @@ -15,23 +14,8 @@ PATCH_TABLE_LOC = "platform/mellanox/hw-management/hw-mgmt/recipes-kernel/linux/" PATCH_TABLE_NAME = "Patch_Status_Table.txt" PATCH_TABLE_DELIMITER = "----------------------" -PATCH_OS_SUBFOLDERS = {"default" : "./linux-{}", - "sonic" : "./linux-{}/sonic", - "opt" : "./linux-{}/sonic", - "cumulus" : "./linux-{}/cumulus"} PATCH_NAME = "patch name" -SUBVERSION = "subversion" -PATCH_DST = "dst_type" -PATCH_ACCEPTED = "accepted" -PATCH_CANDIDATE = "candidate" COMMIT_ID = "Upstream commit id" -COMMIT_TEMPLATE = """ -{% if changes %} ## Patch List: -{% for key, value in changes.items() %} -* {{key}} : {{value}} -{%- endfor %} -{% endif %} -""" def trim_array_str(str_list): ret = [elem.strip() for elem in str_list] @@ -40,7 +24,7 @@ def trim_array_str(str_list): def get_line_elements(line): columns_raw = line.split("|") if len(columns_raw) < 3: - return False\ + return False # remove empty firsta and last elem columns_raw = columns_raw[1:-1] columns = trim_array_str(columns_raw) @@ -111,9 +95,12 @@ def load_patch_table(path, k_version): return table def build_commit_description(changes): - base_loader = jinja2.BaseLoader() - template = jinja2.Environment(loader=base_loader).from_string(COMMIT_TEMPLATE) - content = template.render(changes=changes) + if not changes: + return "" + content = "\n" + content = content + " ## Patch List\n" + for key, value in changes.items(): + content = content + f"* {key} : {value}\n" return content class Data: diff --git a/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py b/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py index 07f72b57bfb1..be33f1387357 100644 --- a/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py +++ b/platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py @@ -36,9 +36,7 @@ TEST_SLK_COMMIT = """\ Intgerate HW-MGMT 7.0030.0937 Changes - - ## Patch List: - + ## 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 @@ -50,6 +48,7 @@ * 0009-i2c-mux-mlxcpld-Extend-driver-to-support-word-addres.patch : https://github.com/gregkh/linux/commit/c52a1c5f5db5 * 0010-i2c-mux-mlxcpld-Extend-supported-mux-number.patch : https://github.com/gregkh/linux/commit/699c0506543e * 0011-i2c-mux-mlxcpld-Add-callback-to-notify-mux-creation-.patch : https://github.com/gregkh/linux/commit/a39bd92e92b9 + """ @@ -174,6 +173,8 @@ def test_write_series_diff(self, mock_write_lines): def test_commit_msg(self): table = load_patch_table(MOCK_INPUTS_DIR, "5.10.140") sb, slk = self.action.create_commit_msg(table) + print(slk) + print(TEST_SLK_COMMIT) assert slk.split() == TEST_SLK_COMMIT.split() assert sb.split() == TEST_SB_COMMIT.split()