summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2018-01-25 20:49:01 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2018-01-25 20:53:49 +0000
commit82f4e613b1ecb290e084a597b8b30d6c63bd78ad (patch)
treec4540c58b71c419b3ea75266ce0799251e7be606
parent3241fd826379ff7da6fd728e4db141cd1be7d6f8 (diff)
tcwg-upstream2gerrit.sh: Add 'filter' parameter.
If false (default), send the patch(es) for review if they apply. It true, only ask review if the patch(es) pass the filter: check if the patch(es) contain anything dealing with arm, thumb, or aarch64. Change-Id: I7dd0a9f175396bf898cdf9a696f275dff881fda7
-rwxr-xr-xtcwg-upstream2gerrit.sh32
1 files changed, 31 insertions, 1 deletions
diff --git a/tcwg-upstream2gerrit.sh b/tcwg-upstream2gerrit.sh
index fd35c138..3a909b7d 100755
--- a/tcwg-upstream2gerrit.sh
+++ b/tcwg-upstream2gerrit.sh
@@ -8,6 +8,7 @@ branch="${branch:-master}"
patches="${patches:-last}"
project="${project:-gcc}"
squash="${squash:-false}"
+filter="${filter:-false}"
# Jenkins doesn't define variables when parameter value is empty (like cflags),
# so enable "set -u" only after above binding of variables.
@@ -64,7 +65,7 @@ case "$project" in
esac
patch_file=$(mktemp)
-trap "rm -f $patch_file" EXIT
+trap "rm -f $patch_file /tmp/mydiff.$$" EXIT
count="0"
for patch in $patches; do
@@ -104,6 +105,35 @@ for patch in $patches; do
count=$(($count+1))
done
+# Apply the filter once the patch series has been applied, to decide
+# whether we actually want review and validation
+keepit=true
+if $filter; then
+ keepit=false
+ git diff HEAD~$count..HEAD > /tmp/mydiff.$$
+
+ # Keep commits impacting ARM or AArch64
+ wanted1=0
+ # Search the exact words arm, thumb or aarch64
+ egrep '^[-+]' /tmp/mydiff.$$ | egrep -w -i 'arm|thumb|aarch64' || wanted1=$?
+ wanted2=0
+ # Search the same strings with '_' prefix or suffix, excluding string with 'parm'
+ egrep '^[-+]' /tmp/mydiff.$$ | egrep -i '_arm|arm_|_thumb|thumb_|_aarch64|aarch64_' | grep -v -i 'parm' || wanted2=$?
+ if [ $wanted1 -eq 0 -o $wanted2 -eq 0 ]
+ then
+ keepit=true
+ else
+ # We could keep commits from ARM, Linaro, or whitelist if we had a ChangeLog
+ echo "Cannot filter authors without a ChangeLog"
+ keepit=false
+ fi
+fi
+
+if ! $keepit; then
+ echo "The filter decided to skip this patch"
+ exit 0
+fi
+
if $squash; then
git reset --soft HEAD~$count
git commit -m "Patches: $patches"