From: Tias Guns Date: Mon, 12 Mar 2012 21:08:43 +0000 (+0000) Subject: common.prepare_source: better detection of errors X-Git-Tag: 0.1~825 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b78700245cea3356c91b82107b14a36d877020c8;p=fdroidserver.git common.prepare_source: better detection of errors when running 'android update', sometimes the program returns an error on stderr without giving a !=0 errorcode. This patch detects such an error, and throws a proper BuildException (in my case, it printed the following to stderr: Error: The project either has no target set or the target is invalid. Please provide a --target to the 'android update' command.) --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index e170169b..18607665 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -737,8 +737,13 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j if verbose: print "Update of '%s': exec '%s' in '%s'"%\ (d," ".join(parms),cwd) - if subprocess.call(parms, cwd=cwd) != 0: - raise BuildException("Failed to update project") + p = subprocess.Popen(parms, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (out, err) = p.communicate() + if p.returncode != 0: + raise BuildException("Failed to update project with stdout '%s' and stderr '%s'"%(out,err)) + # check to see whether an error was returned without a proper exit code (this is the case for the 'no target set or target invalid' error) + if err != "" and err.startswith("Error: "): + raise BuildException("Failed to update project with stdout '%s' and stderr '%s'"%(out,err)) # If the app has ant set up to sign the release, we need to switch # that off, because we want the unsigned apk...