diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-12-02 08:33:33 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-04 18:00:57 +0100 |
commit | 56d4dec19fbcec23f677114e4104bb9df902ed9f (patch) | |
tree | c7a8cf2484db200d810f37a01b1226fef59f90c5 /commitpkg.in | |
parent | f62f307c8490a3018941e2a8805a082e001b95e2 (diff) | |
download | devtools32-56d4dec19fbcec23f677114e4104bb9df902ed9f.tar.xz |
Use double brackets everywhere
We already fixed a couple of these in previous patches - this one should
replace all remaining uses of single brackets ("[") by double brackets.
Also, use arithmetic evaluation instead of conditional expressions where
appropriate and make use of "-z" and "-n" instead of comparing variables
to empty strings.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'commitpkg.in')
-rw-r--r-- | commitpkg.in | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/commitpkg.in b/commitpkg.in index f81cc93..c298256 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -5,7 +5,7 @@ m4_include(lib/common.sh) getpkgfile() { if [[ ${#} -ne 1 ]]; then die 'No canonical package found!' - elif [ ! -f "${1}" ]; then + elif [[ ! -f $1 ]]; then die "Package ${1} not found!" fi @@ -13,20 +13,20 @@ getpkgfile() { } # Source makepkg.conf; fail if it is not found -if [ -r '/etc/makepkg.conf' ]; then +if [[ -r '/etc/makepkg.conf' ]]; then source '/etc/makepkg.conf' else die '/etc/makepkg.conf not found!' fi # Source user-specific makepkg.conf overrides -if [ -r ~/.makepkg.conf ]; then +if [[ -r ~/.makepkg.conf ]]; then . ~/.makepkg.conf fi cmd=${0##*/} -if [ ! -f PKGBUILD ]; then +if [[ ! -f PKGBUILD ]]; then die 'No PKGBUILD file' fi @@ -35,7 +35,7 @@ pkgbase=${pkgbase:-$pkgname} case "$cmd" in commitpkg) - if [ $# -eq 0 ]; then + if (( $# == 0 )); then die 'usage: commitpkg <reponame> [-l limit] [-a arch] [commit message]' fi repo="$1" @@ -89,25 +89,25 @@ while getopts ':l:a:' flag; do done shift $(( OPTIND - 1 )) -if [ -n "$(svn status -q)" ]; then +if [[ -n $(svn status -q) ]]; then msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n' - if [ -n "$1" ]; then + if [[ -n $1 ]]; then stat_busy 'Committing changes to trunk' svn commit -q -m "${msgtemplate}${1}" || die stat_done else msgfile="$(mktemp)" echo "$msgtemplate" > "$msgfile" - if [ -n "$SVN_EDITOR" ]; then + if [[ -n $SVN_EDITOR ]]; then $SVN_EDITOR "$msgfile" - elif [ -n "$VISUAL" ]; then + elif [[ -n $VISUAL ]]; then $VISUAL "$msgfile" - elif [ -n "$EDITOR" ]; then + elif [[ -n $EDITOR ]]; then $EDITOR "$msgfile" else vi "$msgfile" fi - [ -s "$msgfile" ] || die + [[ -s $msgfile ]] || die stat_busy 'Committing changes to trunk' svn commit -q -F "$msgfile" || die unlink "$msgfile" @@ -120,7 +120,7 @@ declare -a commit_arches declare -a skip_arches for _arch in ${arch[@]}; do - if [ -n "$commit_arch" ] && [ "${_arch}" != "$commit_arch" ]; then + if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then skip_arches+=($_arch) continue fi @@ -130,9 +130,9 @@ for _arch in ${arch[@]}; do pkgfile=$(getpkgfile "$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null) pkgdestfile=$(getpkgfile "$PKGDEST/$_pkgname-$fullver-${_arch}".pkg.tar.?z 2>/dev/null) - if [ -f "$pkgfile" ]; then + if [[ -f $pkgfile ]]; then pkgfile="./$pkgfile" - elif [ -f "$pkgdestfile" ]; then + elif [[ -f $pkgdestfile ]]; then pkgfile="$pkgdestfile" else warning "Could not find ${pkgfile}. Skipping ${_arch}" @@ -142,14 +142,14 @@ for _arch in ${arch[@]}; do uploads+=("$pkgfile") sigfile="${pkgfile}.sig" - if [[ $SIGNPKG == 'y' ]] && [ ! -f "${sigfile}" ]; then + if [[ $SIGNPKG == 'y' && ! -f $sigfile ]]; then msg "Signing package ${pkgfile}..." if [[ -n $GPGKEY ]]; then SIGNWITHKEY="-u ${GPGKEY}" fi gpg --detach-sign --use-agent ${SIGNWITHKEY} "${pkgfile}" || die fi - if [ -f "${sigfile}" ]; then + if [[ -f $sigfile ]]; then if ! gpg --verify "$sigfile" >/dev/null 2>&1; then die "Signature ${pkgfile}.sig is incorrect!" fi @@ -172,8 +172,8 @@ if [[ ${#uploads[*]} -gt 0 ]]; then rsync "${rsyncopts[@]}" "${uploads[@]}" "$server:staging/$repo/" || die fi -if [ "${arch[*]}" == 'any' ]; then - if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then +if [[ "${arch[*]}" == 'any' ]]; then + if [[ -d ../repos/$repo-i686 && -d ../repos/$repo-x86_64 ]]; then pushd ../repos/ >/dev/null stat_busy "Removing $repo-i686 and $repo-x86_64" svn rm -q $repo-i686 @@ -183,7 +183,7 @@ if [ "${arch[*]}" == 'any' ]; then popd >/dev/null fi else - if [ -d ../repos/$repo-any ]; then + if [[ -d ../repos/$repo-any ]]; then pushd ../repos/ >/dev/null stat_busy "Removing $repo-any" svn rm -q $repo-any |