#!/bin/bash set -ef -o pipefail # shellcheck source=jenkins-helpers.sh . "$(dirname $0)"/jenkins-helpers.sh convert_args_to_variables "$@" # Make shellcheck happy and workaround Jenkins not defining variables # for empty arguments. branch="${branch-master}" patches="${patches-last}" project="${project-gcc}" squash="${squash-false}" filter="${filter-false}" verbose="${verbose-true}" # Jenkins doesn't define variables when parameter value is empty, # so enable "set -u" only after above binding of variables. set -u if $verbose; then set -x; fi rm -f pwclient wget http://people.linaro.org/~maxim.kuvyrkov/pwclient/pwclient pwc="$(pwd)/pwclient" chmod +x "$pwc" sed -i -e "s#~/.pwclientrc#$(pwd)/pwclientrc#g" "$pwc" cat > pwclientrc < .gitreview < /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 ] || [ $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" fi git review -y "$branch"