1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-11 23:23:27 +02:00

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.)
This commit is contained in:
Tias Guns 2012-03-12 21:08:43 +00:00
parent 1c0dfcbab9
commit b78700245c

View File

@ -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...