summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2016-12-02 10:27:10 +0000
committerStephen Finucane <stephen@that.guru>2017-02-06 18:57:46 +0000
commiteef55d674a808e4d6da3f40081c8b4f1a1858356 (patch)
tree8b8e46a370446f8c47bfbcfec5659478006cffaf
parent6165c255ecabed2d8d74a8817279561fc9986dbe (diff)
downloadpatchwork-eef55d674a808e4d6da3f40081c8b4f1a1858356.tar
patchwork-eef55d674a808e4d6da3f40081c8b4f1a1858356.tar.gz
tools: Run scripts through shellcheck
This mostly results in the addition of quotes to prevent globbing. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Daniel Axtens <dja@axtens.net>
-rwxr-xr-xtools/patchwork-update-commits8
-rwxr-xr-xtools/post-receive.hook22
-rw-r--r--tools/vagrant/install.sh2
3 files changed, 15 insertions, 17 deletions
diff --git a/tools/patchwork-update-commits b/tools/patchwork-update-commits
index 61952c0..257819e 100755
--- a/tools/patchwork-update-commits
+++ b/tools/patchwork-update-commits
@@ -20,7 +20,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
toolsdir="$(dirname "$0")"
-pwpath="${toolsdir}"/../patchwork
+pwpath="${toolsdir}/../patchwork"
if [ "$#" -lt 1 ]; then
echo "usage: $0 <revspec>" >&2
@@ -28,7 +28,7 @@ if [ "$#" -lt 1 ]; then
fi
git rev-list --reverse "$@" |
-while read commit; do
- hash=$(git diff "$commit~..$commit" | python $pwpath/hasher.py)
- $pwpath/bin/pwclient update -s Accepted -c "$commit" -h "$hash"
+while read -r commit; do
+ hash=$(git diff "$commit~..$commit" | python "$pwpath/hasher.py")
+ "$pwpath/bin/pwclient" update -s Accepted -c "$commit" -h "$hash"
done
diff --git a/tools/post-receive.hook b/tools/post-receive.hook
index 42de90a..c29b221 100755
--- a/tools/post-receive.hook
+++ b/tools/post-receive.hook
@@ -38,58 +38,58 @@ trap "do_exit=1" INT
get_patchwork_hash() {
local hash
hash=$(git diff "$1~..$1" | python $PWDIR/hasher.py)
- echo $hash
+ echo "$hash"
test -n "$hash"
}
get_patch_id() {
local id
- id=$($PWDIR/bin/pwclient info -h $1 2>/dev/null \
+ id=$($PWDIR/bin/pwclient info -h "$1" 2>/dev/null \
| sed -rne 's,- id[[:space:]]*: ,,p')
- echo $id
+ echo "$id"
test -n "$id"
}
set_patch_state() {
- $PWDIR/bin/pwclient update -s $2 -c $3 $1 2>&1
+ $PWDIR/bin/pwclient update -s "$2" -c "$3" "$1" 2>&1
}
update_patches() {
local cnt; cnt=0
for rev in $(git rev-parse --not ${EXCLUDE} |
- git rev-list --stdin --no-merges --reverse ${1}..${2}); do
+ git rev-list --stdin --no-merges --reverse "${1}".."${2}"); do
if [ "$do_exit" = 1 ]; then
echo "I: exiting..." >&2
break
fi
- hash=$(get_patchwork_hash $rev)
+ hash=$(get_patchwork_hash "$rev")
if [ -z "$hash" ]; then
echo "E: failed to hash rev $rev." >&2
continue
fi
- id=$(get_patch_id $hash)
+ id=$(get_patch_id "$hash")
if [ -z "$id" ]; then
echo "E: failed to find patch for rev $rev." >&2
continue
fi
- reason="$(set_patch_state $id $3 $rev)"
+ reason="$(set_patch_state "$id" "$3" "$rev")"
if [ -n "$reason" ]; then
echo "E: failed to update patch #$id${reason:+: $reason}." >&2
continue
fi
echo "I: patch #$id updated using rev $rev." >&2
- cnt=$(($cnt + 1))
+ cnt=$((cnt + 1))
done
echo "I: $cnt patch(es) updated to state $3." >&2
}
-while read oldrev newrev refname; do
+while read -r oldrev newrev refname; do
found=0
for i in $STATE_MAP; do
key="${i%:*}"
if [ "$key" = "$refname" ]; then
- update_patches $oldrev $newrev ${i#*:}
+ update_patches "$oldrev" "$newrev" ${i#*:}
found=1
break
fi
diff --git a/tools/vagrant/install.sh b/tools/vagrant/install.sh
index eb25910..a930ddc 100644
--- a/tools/vagrant/install.sh
+++ b/tools/vagrant/install.sh
@@ -4,9 +4,7 @@
echo -e "\n--- Configuring environment ---\n"
-PROJECT_NAME=patchwork
PROJECT_HOME=/vagrant
-WORKON_HOME=$PROJECT_HOME/.virtualenvs
db_user=root
db_pass=password