[X2Go-Commits] [maintenancescripts] 01/02: common: use 'my-style' curly braces everywhere.
git-admin at x2go.org
git-admin at x2go.org
Wed Mar 4 23:23:10 CET 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository maintenancescripts.
commit 7474d7747e6e041864b97473c709125ce077eeb9
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Mar 4 23:22:02 2015 +0100
common: use 'my-style' curly braces everywhere.
---
bin/killstalevms.bash | 34 ++++++++++++------------
git/hooks/update-script._branches+tags_ | 44 +++++++++++++++----------------
git/hooks/update-script._check_ | 18 ++++++-------
git/hooks/x2go-post-receive-tag-pending | 2 +-
4 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/bin/killstalevms.bash b/bin/killstalevms.bash
index fb3956f..3624703 100755
--- a/bin/killstalevms.bash
+++ b/bin/killstalevms.bash
@@ -14,30 +14,30 @@ done < <(pgrep -f -u root '^kvm.*pbuilder.*qemu.*')
typeset -a BUILDER_LIST
for ((i = 0; i < ${#VM_LIST[@]}; ++i)); do
- BUILDER_LIST[$i]="$(perl -pe 's/.*?qemu\.(\d+)\.dev.*/\1/' < /proc/${VM_LIST[$i]}/cmdline)"
+ BUILDER_LIST[${i}]="$(perl -pe 's/.*?qemu\.(\d+)\.dev.*/\1/' < /proc/${VM_LIST[${i}]}/cmdline)"
done
typeset -a COMPONENT_LIST BRANCH_LIST SYSTEM_LIST SYSTEM_VERSION_LIST ARCH_LIST VERSION_LIST
for ((i = 0; i < ${#BUILDER_LIST[@]}; ++i)); do
- TMP_CMDLINE="/proc/${BUILDER_LIST[$i]}/cmdline"
- BRANCH_LIST[$i]="$(perl -pe 's#.*?/pkg-dist/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
- COMPONENT_LIST[$i]="$(perl -pe 's#.*?/pkg-dist/.*?/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
- SYSTEM_LIST[$i]="$(perl -pe 's#.*?/pkg-dist/.*?/.*?/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
- SYSTEM_VERSION_LIST[$i]="$(perl -pe 's#.*?/pkg-dist/.*?/.*?/.*?/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
- ARCH_LIST[$i]="$(perl -pe 's#.*?/pkg-dist/.*?/.*?/.*?/.*?/(.*?)\0.*#\1#' "${TMP_CMDLINE}")"
- VERSION_LIST[$i]="$(perl -pe "s#.*?/${COMPONENT_LIST[$i]}_([\d.]+)-.*#\1#" "${TMP_CMDLINE}")"
+ TMP_CMDLINE="/proc/${BUILDER_LIST[${i}]}/cmdline"
+ BRANCH_LIST[${i}]="$(perl -pe 's#.*?/pkg-dist/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
+ COMPONENT_LIST[${i}]="$(perl -pe 's#.*?/pkg-dist/.*?/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
+ SYSTEM_LIST[${i}]="$(perl -pe 's#.*?/pkg-dist/.*?/.*?/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
+ SYSTEM_VERSION_LIST[${i}]="$(perl -pe 's#.*?/pkg-dist/.*?/.*?/.*?/(.*?)/.*#\1#' "${TMP_CMDLINE}")"
+ ARCH_LIST[${i}]="$(perl -pe 's#.*?/pkg-dist/.*?/.*?/.*?/.*?/(.*?)\0.*#\1#' "${TMP_CMDLINE}")"
+ VERSION_LIST[${i}]="$(perl -pe "s#.*?/${COMPONENT_LIST[${i}]}_([\d.]+)-.*#\1#" "${TMP_CMDLINE}")"
done
printf "Currently running VMs:\n\n"
for ((i = 0; i < ${#BUILDER_LIST[@]}; ++i)); do
- echo "$i:"
- echo " PID: ${VM_LIST[$i]}"
- echo " Component: ${COMPONENT_LIST[$i]}"
- echo " Version: ${VERSION_LIST[$i]}"
- echo " OS: ${SYSTEM_LIST[$i]} -- ${SYSTEM_VERSION_LIST[$i]} -- ${ARCH_LIST[$i]}"
- echo " Branch: ${BRANCH_LIST[$i]}"
+ echo "${i}:"
+ echo " PID: ${VM_LIST[${i}]}"
+ echo " Component: ${COMPONENT_LIST[${i}]}"
+ echo " Version: ${VERSION_LIST[${i}]}"
+ echo " OS: ${SYSTEM_LIST[${i}]} -- ${SYSTEM_VERSION_LIST[${i}]} -- ${ARCH_LIST[${i}]}"
+ echo " Branch: ${BRANCH_LIST[${i}]}"
echo
done
@@ -45,15 +45,15 @@ RESULT="0"
while [ "${RESULT}" -eq "0" ]; do
typeset -a DIALOGMENU=()
for ((i = 0; i < ${#BUILDER_LIST[@]}; ++i)); do
- DIALOGMENU+=("$i" "${VM_LIST[$i]}: ${COMPONENT_LIST[$i]} (${VERSION_LIST[$i]}) for ${BRANCH_LIST[$i]}")
+ DIALOGMENU+=("${i}" "${VM_LIST[${i}]}: ${COMPONENT_LIST[${i}]} (${VERSION_LIST[${i}]}) for ${BRANCH_LIST[${i}]}")
done
MOREINFO=$(dialog --menu "Select VM to kill" 0 0 10 "${DIALOGMENU[@]}" 2>&1 >/dev/tty)
- RESULT="$?"
+ RESULT="${?}"
if [ "${RESULT}" -eq "0" ]; then
dialog --yesno "PID: ${VM_LIST[${MOREINFO}]}\nComponent: ${COMPONENT_LIST[${MOREINFO}]}\nVersion: ${VERSION_LIST[${MOREINFO}]}\nOS: ${SYSTEM_LIST[${MOREINFO}]} -- ${SYSTEM_VERSION_LIST[${MOREINFO}]} -- ${ARCH_LIST[${MOREINFO}]}\nBranch: ${BRANCH_LIST[${MOREINFO}]}\n\nPlease check that this job is currently not being actively executed by Jenkins!\n\nAre you sure you want to kill this process?" 0 0
- RESULT="$?"
+ RESULT="${?}"
if [ "${RESULT}" -eq "0" ]; then
echo kill -9 "${VM_LIST[${MOREINFO}]}"
diff --git a/git/hooks/update-script._branches+tags_ b/git/hooks/update-script._branches+tags_
index 972803c..23f761b 100755
--- a/git/hooks/update-script._branches+tags_
+++ b/git/hooks/update-script._branches+tags_
@@ -25,20 +25,20 @@
#
# --- Command line
-refname="$1"
-oldrev="$2"
-newrev="$3"
+refname="${1}"
+oldrev="${2}"
+newrev="${3}"
# --- Safety check
-if [ -z "$GIT_DIR" ]; then
+if [ -z "${GIT_DIR}" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " $0 <ref> <oldrev> <newrev>)" >&2
+ echo " ${0} <ref> <oldrev> <newrev>)" >&2
exit 1
fi
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
- echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+if [ -z "${refname}" -o -z "${oldrev}" -o -z "${newrev}" ]; then
+ echo "Usage: ${0} <ref> <oldrev> <newrev>" >&2
exit 1
fi
@@ -50,8 +50,8 @@ allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
-projectdesc=$(sed -e '1q' "$GIT_DIR/description")
-case "$projectdesc" in
+projectdesc=$(sed -e '1q' "${GIT_DIR}/description")
+case "${projectdesc}" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
@@ -59,50 +59,50 @@ case "$projectdesc" in
esac
# --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
+# if ${newrev} is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
-if [ "$newrev" = "$zero" ]; then
+if [ "${newrev}" = "${zero}" ]; then
newrev_type=delete
else
- newrev_type=$(git-cat-file -t $newrev)
+ newrev_type=$(git-cat-file -t ${newrev})
fi
-case "$refname","$newrev_type" in
+case "${refname}","${newrev_type}" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
- if [ "$allowunannotated" != "true" ]; then
- echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
+ if [ "${allowunannotated}" != "true" ]; then
+ echo "*** The un-annotated tag, ${short_refname}, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
- if [ "$allowdeletetag" != "true" ]; then
+ if [ "${allowdeletetag}" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
- if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
+ if [ "${allowmodifytag}" != "true" ] && git rev-parse ${refname} > /dev/null 2>&1
then
- echo "*** Tag '$refname' already exists." >&2
+ echo "*** Tag '${refname}' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
- if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
+ if [ "${oldrev}" = "${zero}" -a "${denycreatebranch}" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
- if [ "$allowdeletebranch" != "true" ]; then
+ if [ "${allowdeletebranch}" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
@@ -112,14 +112,14 @@ case "$refname","$newrev_type" in
;;
refs/remotes/*,delete)
# delete tracking branch
- if [ "$allowdeletebranch" != "true" ]; then
+ if [ "${allowdeletebranch}" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
- echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
+ echo "*** Update hook: unknown type of update to ref ${refname} of type ${newrev_type}" >&2
exit 1
;;
esac
diff --git a/git/hooks/update-script._check_ b/git/hooks/update-script._check_
index cbca29f..19ae208 100755
--- a/git/hooks/update-script._check_
+++ b/git/hooks/update-script._check_
@@ -8,24 +8,24 @@ if [ -z "${UPDATE_DONE}" ]; then
MERGE="0"
[ "$(basename "${0}")" = "update-script_check+allow-merges_" ] && MERGE="1"
- case "$1" in
+ case "${1}" in
(refs/tags/*)
- [ -f "$GIT_DIR/$1" ] && deny >/dev/null "You can't overwrite an existing tag"
+ [ -f "${GIT_DIR}/${1}" ] && deny >/dev/null "You can't overwrite an existing tag"
;;
(refs/heads/*)
BRANCH="${1#refs/heads/}"
# No rebasing or rewinding on release, build or master branches.
- if expr "$2" : '0*$' >/dev/null; then
+ if expr "${2}" : '0*$' >/dev/null; then
case "${BRANCH}" in
- (release/*|build-*|master|feature/*|bugfix/*) info "The branch '$1' is new..." ;;
+ (release/*|build-*|master|feature/*|bugfix/*) info "The branch '${1}' is new..." ;;
(*) deny >/dev/null "ERROR: Branch name does not meet the project policies. Please contact git-admin at x2go.org." ;;
esac
else
case "${BRANCH}" in
(release/*|build-*|master)
# updating -- check for merge commit and deny or warn
- [ -n "$(git rev-list --merges $2..$3)" ] && {
+ [ -n "$(git rev-list --merges "${2}..${3}")" ] && {
if [ "${MERGE}" = "0" ]; then
deny > /dev/null "ERROR: update contains a merge."
else
@@ -34,9 +34,9 @@ if [ -z "${UPDATE_DONE}" ]; then
}
# updating -- make sure it is a fast forward
- mb="$(git merge-base "$2" "$3")"
- case "$mb,$2" in
- ("$2,$mb") info "Update is fast-forward" ;;
+ mb="$(git merge-base "${2}" "${3}")"
+ case "${mb},${2}" in
+ ("${2},${mb}") info "Update is fast-forward" ;;
(*) deny > /dev/null "ERROR: This is not a fast-forward update. History has been rewritten." ;;
esac
;;
@@ -44,7 +44,7 @@ if [ -z "${UPDATE_DONE}" ]; then
(*) deny >/dev/null "ERROR: Branch name does not meet the project policies. Please contact git-admin at x2go.org." ;;
esac
fi
- for REVISION in $(git rev-list --reverse "$2..$3") ; do
+ for REVISION in $(git rev-list --reverse "${2}..${3}") ; do
# Make sure that the log message contains some text.
check_log_message
diff --git a/git/hooks/x2go-post-receive-tag-pending b/git/hooks/x2go-post-receive-tag-pending
index 8932477..b79ffbb 100755
--- a/git/hooks/x2go-post-receive-tag-pending
+++ b/git/hooks/x2go-post-receive-tag-pending
@@ -56,7 +56,7 @@ X2Go issue #${bug} (src:${PROJECT}) reported by you has been
fixed in X2Go Git. You can see the changelog below, and you can
check the diff of the fix at:
- ${BASEURL};a=commitdiff;h=$(git show -s --pretty='format:%h' "$rev")
+ ${BASEURL};a=commitdiff;h=$(git show -s --pretty='format:%h' "${rev}")
The issue will most likely be fixed in src:${PROJECT} (${version}).
--
Alioth's /srv/git/code.x2go.org/maintenancescripts.git//../..//_hooks_/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
More information about the x2go-commits
mailing list