fix(interactive): parse case alternatives in get_kernel_info_for_branch#9798
fix(interactive): parse case alternatives in get_kernel_info_for_branch#9798iav wants to merge 2 commits into
Conversation
Pre-existing mixed indentation (4-space vs tabs) normalised by shfmt. No functional changes; isolated as a style-only commit so the follow-up fix diff stays small and reviewable. Assisted-by: Claude:claude-opus-4.7
…ch (#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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR improves kernel information extraction from board configuration files by rewriting the pattern-matching logic in ChangesKernel Configuration Parser
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

Summary
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 likecurrent)but not a case label with alternation likevendor | vendor-rt). With no match, the function returned an empty description and the menu fell back to a hardcoded label ("Vendor BSP kernel" for thevendorbranch), so any customKERNEL_DESCRIPTIONinside 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.confandfamilies/k3-beagle.confboth usevendor | vendor-rt)to share kernel/u-boot config between the two branches. TheirKERNEL_DESCRIPTIONwas effectively dead code before this fix.Single-label labels (
vendor-edge),current)etc.) continue to match — they are just ann=1case of the new alternation logic.Commits
style(interactive): shfmt -w— pre-existing mixed indentation (4-space vs tabs) normalised byshfmt. Isolated as a style-only commit so the follow-up fix diff stays small.fix(interactive): parse case alternatives ...— the actual fix (13+/3-).Test plan
Verified via standalone scaffold (
.tmp/test-kernel-info-8957.sh) against real fixtures in the repo:vendorink3family (alternation) → returns "Texas Instruments currently supported Processor SDK kernel" (was: empty → fallback "Vendor BSP kernel")vendor-rtink3family (alternation) → returns same description (was: empty)vendorink3-beaglefamily (alternation) → returns "BeagleBoard.org (vendor) kernel" (was: empty)vendor-rtink3-beaglefamily (alternation) → returns same (was: empty)vendor-edgeink3family (single label, regression check) → returns "Texas Instruments latest pre-released Processor SDK kernel" (unchanged)Notes
KERNEL_DESCRIPTIONare not addressed here — that's a separate architectural problem (text awk on a single file vs runtime evaluation of the full config flow). This PR fixes only thepat | pat)parser shortfall.Summary by CodeRabbit