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 6E321198005 for ; Tue, 12 Mar 2013 18:55:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ACEB1E085E; 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 F02B9E085E 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 A075A33BF0D 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 237C1E4362 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: <1363114410.3601dbbe901c28a319e85aefa97cdaa547429a17.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: 3601dbbe901c28a319e85aefa97cdaa547429a17 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: 5cf56a35-069e-4bb7-b82e-732ca8b577b4 X-Archives-Hash: e7a8da3581618f28e8af7138d1e09a02 commit: 3601dbbe901c28a319e85aefa97cdaa547429a17 Author: Ulrich Müller gentoo org> AuthorDate: Tue Mar 12 18:45:30 2013 +0000 Commit: Ulrich Mueller gentoo org> CommitDate: Tue Mar 12 18:53:30 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=3601dbbe Exit with nonzero status only on failure. * emacs-updater: Exit with status 0 on success, 1 (or status of last command) on failure. --- ChangeLog | 5 +++++ emacs-updater | 38 ++++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index a93ea5d..91e7afa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-03-12 Ulrich Müller + + * emacs-updater: Exit with status 0 on success, 1 (or status of + last command) on failure. + 2013-03-11 Ulrich Müller * Version 1.12 released. diff --git a/emacs-updater b/emacs-updater index 5fee9f3..91f42e7 100755 --- a/emacs-updater +++ b/emacs-updater @@ -109,8 +109,8 @@ pm_auto() { OPTIONS=$(LC_ALL=C getopt -o a:behmnopP: \ --long action:,batch,color::,colour::,nocolor,nocolour,exact,help,major \ --long orphans,pretend,package-manager:,package-manager-command:,version \ - -n 'emacs-updater' -- "$@") -[ $? -eq 0 ] || usage 1 + -n 'emacs-updater' -- "$@") \ + || usage $? eval set -- "${OPTIONS}" @@ -131,7 +131,7 @@ do auto|tty|if-tty) COLOUR="" ;; *) echo "Invalid argument for '$1' option" - usage 20 + usage 1 ;; esac shift 2 @@ -146,7 +146,7 @@ do ;; *) echo "Invalid action '$action' given!" - usage 20 + usage 1 ;; esac done @@ -158,13 +158,13 @@ do portage|pkgcore|paludis) if ! have_$2; then echo "Package manager '$2' not found!" - exit 22 + exit 1 fi PM_COMMAND=pm_$2 ;; *) echo "Package manager '$2' not known!" - usage 21 + usage 1 ;; esac shift 2 @@ -175,7 +175,7 @@ do if [[ $# -gt 0 && ${1#-} = $1 ]]; then # first parameter after -- should be an option echo "Non-option parameter '$1' for package manager specified!" - usage 22 + usage 1 fi PM_EXTRAOPTS=( "$@" ) break @@ -183,7 +183,7 @@ do *) # this should not happen; getopt should return bad status echo "Invalid option '$1' given!" - usage 22 + usage 1 ;; esac done @@ -219,8 +219,7 @@ failure() { } emacs_version() { - "${EMACS}" -batch -q --no-site-file --eval "(princ emacs-version)" \ - || { failure "Cannot run Emacs"; exit 5; } + "${EMACS}" -batch -q --no-site-file --eval "(princ emacs-version)" } # Get Emacs version from byte-compiled file @@ -248,16 +247,20 @@ action_sitedir() { } action_rebuild() { - local active version elc + local active version elc ret message "Searching for byte-compiled elisp files ..." active=$(emacs_version) - [ -n "${active}" ] || { failure "Cannot determine Emacs version"; exit 6; } + ret=$? + [[ ${ret} -eq 0 ]] || { failure "Error running Emacs"; exit ${ret}; } + [ -n "${active}" ] || { failure "Cannot determine Emacs version"; exit 1; } message "Currently selected GNU Emacs version: ${active}" for elc in $(find "${ROOT}${SITELISP}" -name "*.elc") do version=$(bytecomp_version "${elc}") + ret=$? + [[ ${ret} -eq 0 ]] || { failure "Error running sed"; exit ${ret}; } version=${version:-unknown} if [ -z "${MAJOR}" -a "${version%.*}" != "${active%.*}" ] \ @@ -292,7 +295,7 @@ done if [ ! -s "${TMPFILE}" ]; then warning "No files to update, quitting." - exit 3 + exit 0 fi NO_OF_FILES=$(wc -l <"${TMPFILE}") @@ -319,13 +322,13 @@ fi cat "${PKGFILE}" if [ "${PRETEND}" -o "${ORPHANS}" ]; then - exit 4 + exit 0 fi echo if [ "${NO_OF_PACKAGES}" -eq 0 ]; then warning "No packages to update, quitting." - exit 3 + exit 0 fi if [ "${BATCH}" ]; then @@ -336,11 +339,14 @@ else echo case ${choice} in y*|Y*|"") ;; - *) warning "Quitting."; exit 10 ;; + *) warning "Quitting."; exit 0 ;; esac fi ${PM_COMMAND} "${PM_EXTRAOPTS[@]}" $(<"${PKGFILE}") +ret=$? warning "If a package is being rebuilt over and over again," warning "please report it on http://bugs.gentoo.org/" + +exit ${ret}