]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
trivial: Standardize variable naming in scripts
authorStephen Finucane <stephen@that.guru>
Fri, 2 Dec 2016 10:42:44 +0000 (10:42 +0000)
committerStephen Finucane <stephen@that.guru>
Mon, 6 Feb 2017 18:58:03 +0000 (18:58 +0000)
Just so we can interact with them as expected.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Daniel Axtens <dja@axtens.net>
patchwork/bin/parsemail-batch.sh
patchwork/bin/parsemail.sh
tools/patchwork-update-commits
tools/post-receive.hook

index bee047e3cc3cf4c197219970df24765f0a783e94..8536791035959182cd3ace7a1177b166c734aec7 100755 (executable)
@@ -19,7 +19,7 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-PATCHWORK_BINDIR=$(dirname "$0")
+BIN_DIR=$(dirname "$0")
 
 if [ $# -lt 1 ]; then
     echo "usage: $0 <dir> [options]" >&2
@@ -40,5 +40,5 @@ shift
 find "$mail_dir" -maxdepth 1 |
 while read -r line; do
     echo "$line"
-    "$PATCHWORK_BINDIR/parsemail.sh" "$@" < "$mail_dir/$line"
+    "$BIN_DIR/parsemail.sh" "$@" < "$mail_dir/$line"
 done
index a742f60e54324ab8cf99a33dbd1560ed543def04..5d1672eee1100574f70d5e0b735178030aba3b9b 100755 (executable)
 BIN_DIR=$(dirname "$0")
 PATCHWORK_BASE=$(readlink -e "$BIN_DIR/../..")
 
+if [ $# -lt 1 ]; then
+    echo "usage: $0 <file> [options]" >&2
+    exit 1
+fi
+
 if [ -z "$PW_PYTHON" ]; then
     PW_PYTHON=python2
 fi
index 257819ee1110ce0545a46508a11d4078ef0a6bc1..c84a6305e329a3c4a1b60a636e801fab4c80ee86 100755 (executable)
@@ -19,8 +19,8 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-toolsdir="$(dirname "$0")"
-pwpath="${toolsdir}/../patchwork"
+TOOLS_DIR="$(dirname "$0")"
+PW_DIR="${TOOLS_DIR}/../patchwork"
 
 if [ "$#" -lt 1 ]; then
     echo "usage: $0 <revspec>" >&2
@@ -29,6 +29,6 @@ fi
 
 git rev-list --reverse "$@" |
 while read -r commit; do
-    hash=$(git diff "$commit~..$commit" | python "$pwpath/hasher.py")
-    "$pwpath/bin/pwclient" update -s Accepted -c "$commit" -h "$hash"
+    hash=$(git diff "$commit~..$commit" | python "$PW_DIR/hasher.py")
+    "$PW_DIR/bin/pwclient" update -s Accepted -c "$commit" -h "$hash"
 done
index c29b221d6a743d0128e919592802d8f381299630..8098ce825a6e5a68da4e3087796309853ae1ee9b 100755 (executable)
 # Git post-receive hook to update Patchwork patches after Git pushes
 set -eu
 
+PW_DIR=/opt/patchwork/patchwork
+
 #TODO: the state map should really live in the repo's git-config
 STATE_MAP="refs/heads/master:Accepted"
-#
+
 # ignore all commits already present in these refs
 # e.g.,
 #   EXCLUDE="refs/heads/upstream refs/heads/other-project"
-#
 EXCLUDE=""
 
-PWDIR=/opt/patchwork/patchwork
-
 do_exit=0
 trap "do_exit=1" INT
 
 get_patchwork_hash() {
     local hash
-    hash=$(git diff "$1~..$1" | python $PWDIR/hasher.py)
+    hash=$(git diff "$1~..$1" | python $PW_DIR/hasher.py)
     echo "$hash"
     test -n "$hash"
 }
 
 get_patch_id() {
     local id
-    id=$($PWDIR/bin/pwclient info -h "$1" 2>/dev/null \
+    id=$($PW_DIR/bin/pwclient info -h "$1" 2>/dev/null \
          | sed -rne 's,- id[[:space:]]*: ,,p')
     echo "$id"
     test -n "$id"
 }
 
 set_patch_state() {
-    $PWDIR/bin/pwclient update -s "$2" -c "$3" "$1" 2>&1
+    $PW_DIR/bin/pwclient update -s "$2" -c "$3" "$1" 2>&1
 }
 
 update_patches() {