Skip to content

Commit d3dda59

Browse files
committed
kernel_patch_verify: Add lore indexing as well to help claude
Let us add lore indexing for semcode indexing to grab that data as well. This helps claude to review the patches in the context of previous discussions. Signed-off-by: Nishanth Menon <nm@ti.com>
1 parent feb8557 commit d3dda59

1 file changed

Lines changed: 37 additions & 4 deletions

File tree

kernel_patch_verify

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ REVIEW_ONE_SH=""
5959
AI_REVIEW=0
6060
# Semcode availability (checked later)
6161
SEMCODE_AVAILABLE=0
62+
# Default lore mailing lists to index
63+
DEF_LORE_LISTS="linux-arm-kernel,linux-devicetree,linux-clk,linux-pm,netdev,drm-misc"
64+
LORE_LISTS=""
6265

6366
# Use all max num CPUs
6467
KM_CPUS=$(grep -c '^processor' /proc/cpuinfo)
@@ -406,6 +409,17 @@ build_all() {
406409
(kmake $KP_TARGETS "$MODULES" 2>/dev/null) >/dev/null
407410
}
408411

412+
# Check if lore.kernel.org is accessible
413+
check_lore_accessible() {
414+
local temp_test_dir=$(mktemp -d)
415+
# Try to clone a minimal amount from lore to test connectivity
416+
if git clone --depth=1 --mirror "https://lore.kernel.org/linux-arm-kernel/0" "$temp_test_dir/test" > /dev/null 2>&1; then
417+
rm -rf "$temp_test_dir"
418+
return 0
419+
fi
420+
rm -rf "$temp_test_dir"
421+
return 1
422+
}
409423

410424
# AI review for complete series (called after all patches are applied)
411425
series_ai_review() {
@@ -421,12 +435,25 @@ series_ai_review() {
421435

422436
# Index with semcode if available (recommended for better reviews)
423437
if [ $SEMCODE_AVAILABLE -eq 1 ]; then
438+
# Prepare lore indexing options
439+
local lore_opts=""
440+
local lore_lists_to_use="${LORE_LISTS:-$DEF_LORE_LISTS}"
441+
if [ -n "$lore_lists_to_use" ]; then
442+
echo "Checking lore.kernel.org accessibility..." 1>&2
443+
if check_lore_accessible; then
444+
lore_opts="--lore $lore_lists_to_use"
445+
echo "Will index lore mailing lists: $lore_lists_to_use" 1>&2
446+
else
447+
echo "Warning: lore.kernel.org not accessible, skipping lore indexing" 1>&2
448+
fi
449+
fi
450+
424451
if [ ! -d "$KDIR/.semcode.db" ]; then
425452
echo "Indexing with semcode for range $range..." 1>&2
426-
( cd "$KDIR" && semcode-index -s . --git "$range" 2>&1 ) 1>&2
453+
( cd "$KDIR" && semcode-index -s . --git "$range" $lore_opts 2>&1 ) 1>&2
427454
else
428455
echo "semcode index found, updating for range $range..." 1>&2
429-
( cd "$KDIR" && semcode-index -s . --git "$range" 2>&1 ) 1>&2
456+
( cd "$KDIR" && semcode-index -s . --git "$range" $lore_opts 2>&1 ) 1>&2
430457
fi
431458
else
432459
echo "Warning: semcode not available, review quality may be reduced" 1>&2
@@ -922,7 +949,7 @@ usage() {
922949

923950
printf '%s\n' \
924951
'' \
925-
"Usage: $APP_NAME [-d | -V] [-j CPUs] [-B build_target] [-O build_output_dir] [-T tmp_dir_base] [-l logfile] [-C] [-A] [-P] [-c defconfig_name] [-n N][-1..9]|[-p patch_dir]|[-b base_branch [-t head_branch]] [-S smatch_script] -U -Z" \
952+
"Usage: $APP_NAME [-d | -V] [-j CPUs] [-B build_target] [-O build_output_dir] [-T tmp_dir_base] [-l logfile] [-C] [-A] [-M lore_lists] [-P] [-c defconfig_name] [-n N][-1..9]|[-p patch_dir]|[-b base_branch [-t head_branch]] [-S smatch_script] -U -Z" \
926953
''
927954

928955
printf '\t%s\n' \
@@ -936,6 +963,7 @@ usage() {
936963
"-L Use llvm to build 'LLVM=1 CC='$ccache clang''" \
937964
"-C: run Complete tests(WARNING: could take significant time!)" \
938965
"-A: run AI review on complete series with Claude review_one.sh using --range (requires Claude and review-prompts)" \
966+
"-M lore_lists: comma-separated list of lore.kernel.org mailing lists to index with semcode (default: $DEF_LORE_LISTS)" \
939967
"-P: run patchwise tests(WARNING: could take significant time!)" \
940968
"-c defconfig: name (default uses current .config + olddefconfig)" \
941969
"-[1..9]: test the tip of current branch (1 to 9 number of patches)" \
@@ -971,6 +999,8 @@ usage() {
971999
"$APP_NAME -A -1" \
9721000
"Example usage 6b: verify complete patch series with AI review from base_branch to test_branch" \
9731001
"$APP_NAME -A -b base_branch -t test_branch" \
1002+
"Example usage 6c: verify with AI review and custom lore mailing lists" \
1003+
"$APP_NAME -A -M linux-arm-kernel,linux-kernel -1" \
9741004
"Example usage 7: on a native x86 build using make, gcc and bzImage, 1 patch" \
9751005
"$APP_NAME -B bzImage -1" \
9761006
"Example usage 7: on a cross_compiled ARM build using defaults, 1 patch" \
@@ -991,7 +1021,7 @@ ORIDE=0
9911021
DTB_NOSKIP=0
9921022
BUILD_OUTPUT_DIR=""
9931023
PATCHWISE=0
994-
while getopts "S:n:j:c:T:B:l:p:b:t:m:O:123456789ACdDUVZLP" opt; do
1024+
while getopts "S:n:j:c:T:B:l:p:b:t:m:M:O:123456789ACdDUVZLP" opt; do
9951025
case $opt in
9961026
j)
9971027
KM_CPUS=$OPTARG
@@ -1094,6 +1124,9 @@ while getopts "S:n:j:c:T:B:l:p:b:t:m:O:123456789ACdDUVZLP" opt; do
10941124
exit 1
10951125
fi
10961126
;;
1127+
M)
1128+
LORE_LISTS=$OPTARG
1129+
;;
10971130
P)
10981131
PATCHWISE=1
10991132
APPS_NEEDED="$APPS_NEEDED patchwise"

0 commit comments

Comments
 (0)