Nikerabbit has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/402338 )
Change subject: Update remaining scripts ...................................................................... Update remaining scripts These all now pass shellcheck Change-Id: Id681fc52f4fe7b8328993d2cae23b25a2032c436 --- M bin/checkmsg M bin/clupdate-bzr-repo M bin/clupdate-git-repo M bin/clupdate-svn-repo M bin/createmi M bin/findexportroot M bin/fuzzy M bin/fuzzyr M bin/merge-wmgerrit-patches 9 files changed, 26 insertions(+), 28 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/translatewiki refs/changes/38/402338/1 diff --git a/bin/checkmsg b/bin/checkmsg index 6251489..588faa6 100755 --- a/bin/checkmsg +++ b/bin/checkmsg @@ -1,3 +1,7 @@ +#!/bin/bash +set -o nounset -o pipefail -o errexit + # check if a message is being used. May give some false positives. # use '<e>grep -v to clean up. -grep -r $1 $PWD/* |egrep -v "(svn|[.]ser|[.]cdb|i18n[.]php|Messages[A-Z]|l10n_cache|messages-mediawiki-bw_)" +grep -r "$1" "$PWD"/* | + grep -vE "(svn|[.]ser|[.]cdb|i18n[.]php|Messages[A-Z]|l10n_cache|messages-mediawiki-bw_)" diff --git a/bin/clupdate-bzr-repo b/bin/clupdate-bzr-repo index 3eb9f70..6df3f9c 100755 --- a/bin/clupdate-bzr-repo +++ b/bin/clupdate-bzr-repo @@ -1,6 +1,5 @@ #!/bin/bash -set -e -set -u +set -o nounset -o pipefail -o errexit URL=$1 DIR=$2 @@ -12,5 +11,5 @@ bzr revert --quiet bzr pull "$BRANCH" --quiet --overwrite else - bzr checkout ${URL}/${BRANCH} "$DIR" + bzr checkout "${URL}/${BRANCH}" "$DIR" fi diff --git a/bin/clupdate-git-repo b/bin/clupdate-git-repo index 018362b..e80be77 100755 --- a/bin/clupdate-git-repo +++ b/bin/clupdate-git-repo @@ -1,12 +1,7 @@ #!/bin/bash -set -e -set -u +set -o nounset -o pipefail -o errexit -DIRSCRIPT="`dirname \"$0\"`" -DIRSCRIPT="`( cd \"$DIRSCRIPT\" && pwd )`" - -ME=`basename "$0"` - +ME=$(basename "$0") URL=$1 DIR=$2 BRANCH=${3:-master} @@ -14,7 +9,7 @@ if [ -d "$DIR/.git" ] then ( - cd $DIR + cd "$DIR" git rebase --abort &>/dev/null || : git checkout -qf "$BRANCH" git fetch -q diff --git a/bin/clupdate-svn-repo b/bin/clupdate-svn-repo index 109e041..2ca4cda 100755 --- a/bin/clupdate-svn-repo +++ b/bin/clupdate-svn-repo @@ -1,14 +1,13 @@ #!/bin/bash -set -e -set -u +set -o nounset -o pipefail -o errexit URL=$1 DIR=$2 if [ -d "$DIR/.svn" ] -then +then ( cd "$DIR" svn up -q "$DIR" -else +) else svn checkout -q "$URL" "$DIR" fi diff --git a/bin/createmi b/bin/createmi index 7a9ac1f..a91dfbd 100755 --- a/bin/createmi +++ b/bin/createmi @@ -1,4 +1,5 @@ #!/bin/bash +set -o nounset -o pipefail -o errexit # ensure correct permissions sudo -u betawiki hhvm -vEval.Jit=false /srv/mediawiki/targets/production/extensions/Translate/scripts/createMessageIndex.php --quiet diff --git a/bin/findexportroot b/bin/findexportroot index e97562a..a572df0 100755 --- a/bin/findexportroot +++ b/bin/findexportroot @@ -1,4 +1,6 @@ #!/bin/sh +set -o nounset -o errexit + # Used by repo* scripts to find the repository root # similar to how like git tries to find .git diff --git a/bin/fuzzy b/bin/fuzzy index 7fe1cbb..15a22d7 100755 --- a/bin/fuzzy +++ b/bin/fuzzy @@ -1,7 +1,6 @@ #!/bin/bash -# fuzzy dry run -# $1 message ID -# $2 reason +set -o nounset -o pipefail -o errexit + if [ "$#" -gt "2" ]; then echo "Only two parameters allowed for fuzzy dry run:" echo "\$1 is the message key (replace spaces by underscores; use a trailing /)" @@ -10,4 +9,4 @@ fi cd /srv/mediawiki/targets/production/extensions/Translate/scripts -php fuzzy.php --skiplanguages=en,test,qqq $1 --comment="$2" +php fuzzy.php --skiplanguages=en,test,qqq "$1" --comment="$2" diff --git a/bin/fuzzyr b/bin/fuzzyr index 38d44ff..72a05a0 100755 --- a/bin/fuzzyr +++ b/bin/fuzzyr @@ -1,5 +1,6 @@ #!/bin/bash -# fuzzy dry run +set -o nounset -o pipefail -o errexit + if [ "$#" -gt "2" ]; then echo "Only two parameters allowed for fuzzy:" echo "\$1 is the message key (replace spaces by underscores; use a trailing /)" @@ -8,4 +9,4 @@ fi cd /srv/mediawiki/targets/production/extensions/Translate/scripts -php fuzzy.php --skiplanguages=en,test,qqq $1 --really --comment="$2" +php fuzzy.php --skiplanguages=en,test,qqq "$1" --really --comment="$2" diff --git a/bin/merge-wmgerrit-patches b/bin/merge-wmgerrit-patches index fe1d898..3fa0911 100755 --- a/bin/merge-wmgerrit-patches +++ b/bin/merge-wmgerrit-patches @@ -1,13 +1,11 @@ #!/bin/bash - -set -e -set -o pipefail +set -o nounset -o pipefail -o errexit U="l10n-bot" -GERRIT="$u...@gerrit.wikimedia.org -p 29418" +GERRIT=("$u...@gerrit.wikimedia.org" -p 29418) -ssh "$GERRIT" gerrit query --format=TEXT "owner:$U" "project:$1" status:open | +ssh "${GERRIT[@]}" gerrit query --format=TEXT "owner:$U" "project:$1" status:open | grep ' url:' | cut -d/ -f5 | sort | -xargs -I ____ ssh "$GERRIT" gerrit review ____,1 --code-review 2 --verified 2 --submit +xargs -I ____ ssh "${GERRIT[@]}" gerrit review ____,1 --code-review 2 --verified 2 --submit -- To view, visit https://gerrit.wikimedia.org/r/402338 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id681fc52f4fe7b8328993d2cae23b25a2032c436 Gerrit-PatchSet: 1 Gerrit-Project: translatewiki Gerrit-Branch: master Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits