From 0e8f3c7d65c68950c3986d77255f051a89aa2055 Mon Sep 17 00:00:00 2001 From: Jianxiong Pan Date: Fri, 9 Nov 2018 19:22:53 +0800 Subject: [PATCH] script: segments can appear in descriptive information [1/1] PD#174488 Problem: segmentation in descriptive information is reasonable and should be allowed. Solution: modify the check codes. Verify: test locally. Change-Id: I5e34ef2dd26077bb54adee7597a1aa3c789566c9 Signed-off-by: Jianxiong Pan --- scripts/amlogic/merge_pre_check.pl | 47 +++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/scripts/amlogic/merge_pre_check.pl b/scripts/amlogic/merge_pre_check.pl index cb3f8b6..73ce86a 100755 --- a/scripts/amlogic/merge_pre_check.pl +++ b/scripts/amlogic/merge_pre_check.pl @@ -132,38 +132,69 @@ sub check_msg_49_2 { my $msg = `git cat-file commit HEAD~0 | sed '1,/\^\$/d'`; my @str = split /[\n][\n]/, $msg; + my $i = 0; + my $len = @str; - if( $str[0] !~ /^([\w]+:\s){1,2}.+(\s)\[[\d]\/[\d]\]$/ ) + if( $len < 4 ) + { + $err_cnt += 5; + $err_msg .= " module: message [n/m]\n\n"; + $err_msg .= " PD#XXXX\n\n"; + $err_msg .= " Problem:\n detailed description\n\n"; + $err_msg .= " Solution:\n detailed description\n\n"; + $err_msg .= " Verify:\n detailed description\n\n"; + return -1; + } + + if( $str[$i] !~ /^([\w]+:\s){1,2}.+(\s)\[[\d]\/[\d]\]$/ ) { $err_cnt += 1; - $err_msg .= " $err_cnt: \n"; + $err_msg .= " $err_cnt: module: message\n"; } - elsif( $str[0] =~ /(kernel)/i ) + elsif( $str[$i] =~ /(kernel)/i ) { $err_cnt += 1; $err_msg .= " $err_cnt: Should be no 'kernel' in kernel commit message\n"; } - if( $str[1] !~ /^PD\#.+(\S)$/ ) + if( $str[++ $i] !~ /^PD\#.+(\d)$/ ) { $err_cnt += 1; - $err_msg .= " $err_cnt: \n"; + $err_msg .= " $err_cnt: PD#XXXX\n"; } - if( $str[2] !~ /^Problem:[\n].+/ ) + if( $str[++ $i] !~ /^Problem:[\n].+/ ) { $err_cnt += 1; $err_msg .= " $err_cnt: Problem:\n detailed description\n"; } - if( $str[3] !~ /^Solution:[\n].+/ ) + $i += 1; + while( $str[$i] !~ /^Solution:[\n].+/ && $str[$i] !~ /^Change-Id:/ && $str[$i] !~ /^Verify:[\n].+/ ) + { + $i = $i + 1; + } + + if( $str[$i] !~ /^Solution:[\n].+/ ) { $err_cnt += 1; $err_msg .= " $err_cnt: Solution:\n detailed description\n"; } - if( $str[4] !~ /^Verify:[\n].+/ ) + if( $str[$i] =~ /^Change-Id:/ ) + { + $err_cnt += 1; + $err_msg .= " $err_cnt: Verify:\n detailed description\n"; + return -1; + } + + while( $str[$i] !~ /^Verify:[\n].+/ && $str[$i] !~ /^Change-Id:/ ) + { + $i += 1; + } + + if( $str[$i] !~ /^Verify:[\n].+/ ) { $err_cnt += 1; $err_msg .= " $err_cnt: Verify:\n detailed description\n"; -- 2.7.4