From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D2EF6198005 for ; Tue, 12 Mar 2013 18:55:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A0C1AE0850; Tue, 12 Mar 2013 18:55:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DB355E0850 for ; Tue, 12 Mar 2013 18:55:20 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B6C1733C1EE for ; Tue, 12 Mar 2013 18:55:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 47E80E4363 for ; Tue, 12 Mar 2013 18:55:17 +0000 (UTC) From: "Ulrich Mueller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Mueller" Message-ID: <1363114422.94670b7c752a2beb8c2aa6a6818b42d372048ff1.ulm@gentoo> Subject: [gentoo-commits] proj/emacs-tools:emacs-updater commit in: / X-VCS-Repository: proj/emacs-tools X-VCS-Files: ChangeLog emacs-updater X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Mueller X-VCS-Revision: 94670b7c752a2beb8c2aa6a6818b42d372048ff1 X-VCS-Branch: emacs-updater Date: Tue, 12 Mar 2013 18:55:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a6f87991-1094-4ab4-a2ff-1356465d361a X-Archives-Hash: 6213b81341bdcf39321fbc848c019067 commit: 94670b7c752a2beb8c2aa6a6818b42d372048ff1 Author: Ulrich Müller gentoo org> AuthorDate: Tue Mar 12 18:48:11 2013 +0000 Commit: Ulrich Mueller gentoo org> CommitDate: Tue Mar 12 18:53:42 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=94670b7c Use bash syntax for tests. * emacs-updater: Use bash syntax for tests throughout. --- ChangeLog | 2 +- emacs-updater | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91e7afa..6fa2379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2013-03-12 Ulrich Müller * emacs-updater: Exit with status 0 on success, 1 (or status of - last command) on failure. + last command) on failure. Use bash syntax for tests throughout. 2013-03-11 Ulrich Müller diff --git a/emacs-updater b/emacs-updater index 91f42e7..b97e295 100755 --- a/emacs-updater +++ b/emacs-updater @@ -172,7 +172,7 @@ do --package-manager-command) PM_COMMAND=$2; shift 2 ;; --) shift - if [[ $# -gt 0 && ${1#-} = $1 ]]; then + if [[ $# -gt 0 && ${1#-} = "$1" ]]; then # first parameter after -- should be an option echo "Non-option parameter '$1' for package manager specified!" usage 1 @@ -189,7 +189,7 @@ do done # Set colours based on the --colour option and output redirection status -if [ -z "${COLOUR}" -a -t 1 -o "${COLOUR}" = "yes" ]; then +if [[ -z ${COLOUR} && -t 1 ]] || [[ ${COLOUR} = yes ]]; then BOLD=$(tput bold) NORMAL=$(tput sgr0) RED=$(tput setaf 1)${BOLD} @@ -253,7 +253,7 @@ action_rebuild() { active=$(emacs_version) ret=$? [[ ${ret} -eq 0 ]] || { failure "Error running Emacs"; exit ${ret}; } - [ -n "${active}" ] || { failure "Cannot determine Emacs version"; exit 1; } + [[ ${active} ]] || { failure "Cannot determine Emacs version"; exit 1; } message "Currently selected GNU Emacs version: ${active}" for elc in $(find "${ROOT}${SITELISP}" -name "*.elc") @@ -263,9 +263,9 @@ action_rebuild() { [[ ${ret} -eq 0 ]] || { failure "Error running sed"; exit ${ret}; } version=${version:-unknown} - if [ -z "${MAJOR}" -a "${version%.*}" != "${active%.*}" ] \ - || [ "${version%%.*}" != "${active%%.*}" ] \ - || [ "$1" = all ] + if [[ -z ${MAJOR} && ${version%.*} != "${active%.*}" ]] \ + || [[ ${version%%.*} != "${active%%.*}" ]] \ + || [[ $1 = all ]] then echo "Found ${elc##*/} (compiled by Emacs ${version})" echo "${elc}" >> "${TMPFILE}" @@ -293,18 +293,18 @@ for action in ${ACTIONS}; do action_${action} done -if [ ! -s "${TMPFILE}" ]; then +if [[ ! -s ${TMPFILE} ]]; then warning "No files to update, quitting." exit 0 fi NO_OF_FILES=$(wc -l <"${TMPFILE}") -[ "${NO_OF_FILES}" -eq 1 ] && s= || s=s +[[ ${NO_OF_FILES} -eq 1 ]] && s= || s=s message "Assigning ${NO_OF_FILES} file${s} to packages ..." -if [ "${ORPHANS}" ]; then +if [[ ${ORPHANS} ]]; then qfile -oCR -f "${TMPFILE}" | sort -u > "${PKGFILE}" -elif [ "${EXACT}" ]; then +elif [[ ${EXACT} ]]; then qfile -eqCR -f "${TMPFILE}" | sort -u | sed 's/^/=/' > "${PKGFILE}" else # Get package and slot number, requires >=portage-utils-0.3 @@ -312,8 +312,8 @@ else fi NO_OF_PACKAGES=$(wc -l <"${PKGFILE}") -[ "${NO_OF_PACKAGES}" -eq 1 ] && s= || s=s -if [ "${ORPHANS}" ]; then +[[ ${NO_OF_PACKAGES} -eq 1 ]] && s= || s=s +if [[ ${ORPHANS} ]]; then message "${NO_OF_PACKAGES} orphan file${s} found:" else message "${NO_OF_PACKAGES} package${s} to remerge:" @@ -321,17 +321,17 @@ fi cat "${PKGFILE}" -if [ "${PRETEND}" -o "${ORPHANS}" ]; then +if [[ ${PRETEND} || ${ORPHANS} ]]; then exit 0 fi echo -if [ "${NO_OF_PACKAGES}" -eq 0 ]; then +if [[ ${NO_OF_PACKAGES} -eq 0 ]]; then warning "No packages to update, quitting." exit 0 fi -if [ "${BATCH}" ]; then +if [[ ${BATCH} ]]; then message "Remerging packages ..." else echo -n "${BOLD}Remerge packages?${NORMAL} [${GREEN}Yes${NORMAL}/${RED}No${NORMAL}] "