Skip to content

Commit

Permalink
hw-mgmt: patches: fix patch deploy tool
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Shamray <[email protected]>
  • Loading branch information
sholeksandr committed Oct 24, 2024
1 parent 0003dcb commit c64457e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions recipes-kernel/linux/deploy_kernel_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def trim_array_str(str_list):
def get_line_elements(line):
columns_raw = line.split("|")
if len(columns_raw) < 3:
return False\
return []
# remove empty firsta and last elem
columns_raw = columns_raw[1:-1]
columns = trim_array_str(columns_raw)
Expand Down Expand Up @@ -144,6 +144,9 @@ def parse_status(line, patch_name):
except:
print("Incompatible status {} for {}".format(line, patch_name))
return None
if not ret or len(ret.groups()) < 2:
print("Error on parsing line {}".format(line))
return None
status_dict[ret.group(1)] = ret.group(2).split(',')
return status_dict

Expand Down Expand Up @@ -186,7 +189,7 @@ def load_patch_table(path, k_version):
if delimiter_count >= 3:
print("Err: too much leading delimers line #{}: {}".format(table_ofset + idx, line))
return None
elif table:
elif table or delimiter_count == 2:
break
continue

Expand All @@ -208,8 +211,9 @@ def load_patch_table(path, k_version):
patch_status_line = table_line[CONST.STATUS]
patch_status = parse_status(patch_status_line, table_line[CONST.PATCH_NAME])
if not patch_status:
print("Err: can't parse patch {} status {}".format(table_line[CONST.PATCH_NAME],
patch_status_line))
print("Err: can't parse patch {} line #{} status: \"{}\"".format(table_line[CONST.PATCH_NAME],
idx,
patch_status_line))
return None
table_line[CONST.STATUS] = patch_status
table_line[CONST.PATCH_DST] = None
Expand Down Expand Up @@ -572,7 +576,7 @@ class RawTextArgumentDefaultsHelpFormatter(

print("-> Process patches")
patch_table = load_patch_table(src_folder, k_version_major)
if not patch_table:
if patch_table == None:
print("Can't load patch table from folder {}".format(src_folder))
sys.exit(1)

Expand Down

0 comments on commit c64457e

Please sign in to comment.