Skip to content

Commit 6cb2ecb

Browse files
committed
fix(interactive): parse case alternatives in get_kernel_info_for_branch (#8957)
Fixes #8957. The awk parser in get_kernel_info_for_branch() searched the family conf for `^[[:space:]]*<branch>\)`, which matches a single-pattern case label like `current)` but NOT a case label with alternation like `vendor | vendor-rt)`. With no match, the function returned an empty description and the menu fell back to a hardcoded label ("Vendor BSP kernel" for the vendor branch), so any custom KERNEL_DESCRIPTION inside an alternation block was silently lost. Fix: extract the label (everything before the closing paren), split on `|` (with optional surrounding whitespace) and check each alternative against the requested branch. Real-world impact: families/k3.conf and families/k3-beagle.conf both use `vendor | vendor-rt)` to share kernel/u-boot config between the two branches. Their `KERNEL_DESCRIPTION` was effectively dead code before this fix. Single-label labels (`vendor-edge)`, `current)` etc.) continue to match — they are just an n=1 case of the new alternation logic. Assisted-by: Claude:claude-opus-4.7
1 parent b46e418 commit 6cb2ecb

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

lib/functions/configuration/interactive.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,21 @@ function get_kernel_info_for_branch() {
247247
local search_branch="$1"
248248
local conf_file="${SRC}/config/sources/families/${BOARDFAMILY}.conf"
249249

250+
# Recognises both `branch)` and `pat1 | pat2 | …)` case labels (#8957).
250251
awk -v branch="$search_branch" '
251252
BEGIN { found=0; major_minor=""; desc="" }
252-
/^[[:space:]]*[a-zA-Z0-9_-]+\)/ {
253-
if ($0 ~ "^[[:space:]]*" branch "\\)") {
254-
found=1
253+
/^[[:space:]]*[a-zA-Z0-9_*?-][a-zA-Z0-9_*? |-]*\)/ {
254+
label = $0
255+
sub(/\).*/, "", label)
256+
sub(/^[[:space:]]+/, "", label)
257+
sub(/[[:space:]]+$/, "", label)
258+
n = split(label, alts, /[[:space:]]*\|[[:space:]]*/)
259+
matched = 0
260+
for (i = 1; i <= n; i++) {
261+
if (alts[i] == branch) { matched = 1; break }
262+
}
263+
if (matched) {
264+
found = 1
255265
next
256266
} else if (found) {
257267
exit

0 commit comments

Comments
 (0)