[PATCH] aiaiai: allow defining checkpatch.pl location
Artem Bityutskiy
dedekind1 at gmail.com
Mon Feb 3 05:39:52 EST 2014
From: Jacob Keller <jacob.e.keller at intel.com>
Instead of hardcoding the checkpatch.pl script into the repository, use the
in-kernel script by default unless the user specifies a path with
--checkpatch option. Additionally add an email.cfg option for specifying
checkpatch.pl per project.
A future patch will remove the external checkpatch.pl binary included in this
project.
Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
aiaiai-test-patchset | 19 +++++++++++++++----
email/aiaiai-email-sh-functions | 1 +
email/aiaiai-email-test-patchset | 3 ++-
email/aiaiai-email.cfg | 3 +++
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/aiaiai-test-patchset b/aiaiai-test-patchset
index a8feff9..d99e3e2 100755
--- a/aiaiai-test-patchset
+++ b/aiaiai-test-patchset
@@ -80,6 +80,7 @@ Options:
first and the user patch-set will be tested on top of
the fixes;
-K --keywords=FILE match keywords from FILE against the patch;
+ --checkpatch=FILE specify checkpatch.pl binary to use. (default's to in kernel)
-M, --kmake-opts additional options to append to the final kernel
compilation 'make' command
(e.g., W=2 KALLSYMS_EXTRA_PASS=1);
@@ -97,6 +98,7 @@ fail_usage()
test_checkpatch()
{
+ local checkpatch="$1"
local n=0 patch_cnt
local tmp_out="$tmpdir/checkpatch.tmp_out"
local tmp_mbox="$tmpdir/checkpatch.tmp_mbox"
@@ -110,7 +112,7 @@ test_checkpatch()
formail +$n -1 -s < "$mbox" > "$tmp_mbox"
truncate -s0 "$tmp_out"
- checkpatch.pl $opts - < "$tmp_mbox" > "$tmp_out" ||:
+ $checkpatch $opts - < "$tmp_mbox" > "$tmp_out" ||:
n="$(($n+1))"
[ -s "$tmp_out" ] || continue
@@ -127,7 +129,7 @@ test_checkpatch()
if [ "$patch_cnt" -gt 1 ]; then
# Check the squashed patch
truncate -s0 "$tmp_out"
- checkpatch.pl --no-signoff $opts - < "$tmpdir/diff-for-checkpatch" > "$tmp_out" ||:
+ $checkpatch --no-signoff $opts - < "$tmpdir/diff-for-checkpatch" > "$tmp_out" ||:
[ -s "$tmp_out" ] || return 0
printf "\n" >> "$tmpdir/checkpatch.results"
@@ -231,7 +233,7 @@ cleanup_handler()
}
set_cleanup_handler cleanup_handler
-TEMP=`getopt -n $PROG -o j:,c:,i:,w:,C:,p,Q:,K:,M:,v,h --long jobs:,commit-id:,input:,workdir:,logdir:,confdir:,preserve,bisectability,sparse,smatch,cppcheck,coccinelle,quick-fixes:,keywords:,kmake-opts:,verbose,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o j:,c:,i:,w:,C:,p,Q:,K:,M:,v,h --long jobs:,commit-id:,input:,workdir:,logdir:,confdir:,preserve,bisectability,sparse,smatch,cppcheck,coccinelle,quick-fixes:,keywords:,kmake-opts:,checkpatch:,verbose,help -- "$@"` ||
fail_usage ""
eval set -- "$TEMP"
@@ -249,6 +251,7 @@ quick_fixes=
keywords=
kmake_opts=
verbose=
+checkpatch=
quiet="-q"
while true; do
@@ -308,6 +311,10 @@ while true; do
keywords="$(opt_check_read "$1" "$2")"
shift
;;
+ --checkpatch)
+ checkpatch="$(opt_check_read "$1" "$2")"
+ shift
+ ;;
-M|--kmake-opts)
kmake_opts="$2"
shift
@@ -411,8 +418,12 @@ git diff -U0 -M "$commit_id1".."$commit_id2" > "$tmpdir/diff-for-diff-log"
# Generate a diff for checkpatch.pl
git diff -M "$commit_id1".."$commit_id2" > "$tmpdir/diff-for-checkpatch"
+if [ -z "$checkpatch" ]; then
+ checkpatch="$cloned_kernel2/scripts/checkpatch.pl"
+fi
+
# Run checkpatch.pl in backgound.
-test_checkpatch &
+test_checkpatch "$checkpatch" &
pid_checkpatch="$!"
# Search for keywords
diff --git a/email/aiaiai-email-sh-functions b/email/aiaiai-email-sh-functions
index a8156af..354b2b6 100644
--- a/email/aiaiai-email-sh-functions
+++ b/email/aiaiai-email-sh-functions
@@ -181,6 +181,7 @@ parse_prj_config()
cfg_always_cc="$(ini_config_get "$cfgfile" "prj_$prj" "always_cc")"
cfg_unwanted_keywords="$(ini_config_get "$cfgfile" ""prj_$prj"" "unwanted_keywords")"
+ cfg_checkpatch="$(ini_config_get "$cfgfile" "prj_$prj" "checkpatch")"
}
# Compose (but not send) e-mail reply. This function assumes that the following
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index b32ab16..dce4d1f 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -257,7 +257,8 @@ message "Test configs \"$cfg_configs\" branch \"$cfg_branch\" of \"$cfg_path\""
aiaiai-test-patchset $verbose $preserve $bisectability $sparse $smatch $cppcheck $coccinelle \
-i "$mbox" -j "$cfg_jobs" -c "$cfg_branch" -w "$tmpdir" \
${confdir:+-C "$confdir"} \
- ${cfg_unwanted_keywords:+-K "$cfg_unwanted_keywords"} -- \
+ ${cfg_unwanted_keywords:+-K "$cfg_unwanted_keywords"} \
+ ${cfg_checkpatch:+--checkpatch "$cfg_checkpatch"} -- \
"$cfg_path" "$cfg_configs" > "$tmpdir/test-patchset.log" ||
{
message "aiaiai-test-patchset failed"
diff --git a/email/aiaiai-email.cfg b/email/aiaiai-email.cfg
index 0ef1857..04247fa 100644
--- a/email/aiaiai-email.cfg
+++ b/email/aiaiai-email.cfg
@@ -54,6 +54,9 @@
# Unwanted keywords which should be matched (path to the file with one
# unwanted keyword per line)
unwanted_keywords = /home/aiaiai/unwanted-keywords.txt
+ # path to checkpatch.pl script to use, if you don't want to use the
+ # in-kernel script
+ checkpatch = /home/aiaiai/bin/checkpatch.pl
# A second project.
[prj_kernel-tizen]
--
1.8.3.1
More information about the aiaiai
mailing list