Skip to content

Commit c4a8ba3

Browse files
committed
Respect KERNEL_TEST_TARGET for branch filtering
Only include branches that are specified in KERNEL_TEST_TARGET when generating release targets. If KERNEL_TEST_TARGET is not set, fall back to default branch filtering (current, vendor, legacy, edge). Also update branch selection priority to use KERNEL_TEST_TARGET order when choosing a single branch per board for apps/nightly targets.
1 parent d58ad44 commit c4a8ba3

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

scripts/generate_targets.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,21 @@ def extract_boards_by_support_level(image_info, extensions_map=None, remove_exte
387387
csc_tvb_boards = []
388388

389389
for key, data in board_data.items():
390-
# Filter branches: prefer current, vendor, and legacy
391-
if data['branch'] not in ['current', 'vendor', 'legacy', 'edge']:
392-
continue
390+
# Get KERNEL_TEST_TARGET from the board's inventory
391+
# If set, only include branches that are in KERNEL_TEST_TARGET
392+
entry = data['entry']
393+
inventory = entry.get('in', {}).get('inventory', {})
394+
kernel_test_target = inventory.get('KERNEL_TEST_TARGET', '')
395+
396+
if kernel_test_target:
397+
# Parse KERNEL_TEST_TARGET - comma-separated list of branches
398+
allowed_branches = [b.strip() for b in kernel_test_target.split(',') if b.strip()]
399+
if data['branch'] not in allowed_branches:
400+
continue
401+
else:
402+
# Filter branches: prefer current, vendor, and legacy
403+
if data['branch'] not in ['current', 'vendor', 'legacy', 'edge']:
404+
continue
393405

394406
if data['support_level'] in ['conf', 'wip']:
395407
conf_wip_boards.append(data)
@@ -402,10 +414,11 @@ def extract_boards_by_support_level(image_info, extensions_map=None, remove_exte
402414
def select_one_branch_per_board(boards):
403415
"""
404416
Select one branch per board, preferring current over vendor over edge.
417+
Respects KERNEL_TEST_TARGET if set on the board.
405418
Returns list of unique boards.
406419
"""
407420
# Define branch preference priority (lower number = higher priority)
408-
branch_priority = {
421+
default_branch_priority = {
409422
'current': 1,
410423
'vendor': 2,
411424
'legacy': 2,
@@ -416,6 +429,17 @@ def select_one_branch_per_board(boards):
416429
for board_data in boards:
417430
board = board_data['board']
418431
branch = board_data['branch']
432+
entry = board_data['entry']
433+
inventory = entry.get('in', {}).get('inventory', {})
434+
kernel_test_target = inventory.get('KERNEL_TEST_TARGET', '')
435+
436+
# Determine branch priority for this board
437+
if kernel_test_target:
438+
# Use KERNEL_TEST_TARGET order as priority
439+
allowed_branches = [b.strip() for b in kernel_test_target.split(',') if b.strip()]
440+
branch_priority = {branch: idx for idx, branch in enumerate(allowed_branches, 1)}
441+
else:
442+
branch_priority = default_branch_priority
419443

420444
# Skip if branch is not in our priority list
421445
if branch not in branch_priority:

0 commit comments

Comments
 (0)