[banshee] autogen.sh: use 'which' before running in run() function



commit 30a38653f46768f4e2a6a0dbefcc3ebe96d9ccff
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Tue Jun 9 11:36:30 2015 +0200

    autogen.sh: use 'which' before running in run() function
    
    A user just reported in the IRC channel that he had the error
    'Could not run autoconf', even when he had it installed in
    the system.
    
    The problem is in the error message, because it's ambiguous,
    it's not clear if 'autoconf' (in this case) was run but finished
    with errors, or if it could not run because it was not found.
    
    To fix this ambiguity, we change the error messages slightly
    and check for the tool to run() with the command 'which' as a
    sanity check.

 autogen.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index 650b7e1..34cfe7e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -34,11 +34,14 @@ function check_autotool_version () {
 }
 
 function run () {
+       which $1 >/dev/null || {
+               error "Could not find '$1', which is required to configure $PROJECT"
+       }
        echo "Running $@ ..."
        $@ 2>.autogen.log || {
                cat .autogen.log 1>&2
                rm .autogen.log
-               error "Could not run $1, which is required to configure $PROJECT"
+               error "There were errors when running '$1', a step that is required to configure $PROJECT"
        }
        rm .autogen.log
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]