mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
Finish -v/--verbose output+error handling
This commit is contained in:
parent
712be5703d
commit
a5704e5655
1 changed files with 25 additions and 5 deletions
|
@ -422,7 +422,9 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
print output
|
print output
|
||||||
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
|
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
|
||||||
|
|
||||||
|
p = None
|
||||||
output = ""
|
output = ""
|
||||||
|
error = ""
|
||||||
# Build the release...
|
# Build the release...
|
||||||
if 'maven' in thisbuild:
|
if 'maven' in thisbuild:
|
||||||
print "Building Maven project..."
|
print "Building Maven project..."
|
||||||
|
@ -440,13 +442,19 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
if 'mvnflags' in thisbuild:
|
if 'mvnflags' in thisbuild:
|
||||||
mvncmd += thisbuild['mvnflags']
|
mvncmd += thisbuild['mvnflags']
|
||||||
|
|
||||||
p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
for line in p.stdout.readlines():
|
for line in iter(p.stdout.readline, ''):
|
||||||
if verbose:
|
if verbose:
|
||||||
# Output directly to console
|
# Output directly to console
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
output += line
|
output += line
|
||||||
|
for line in iter(p.stderr.readline, ''):
|
||||||
|
if verbose:
|
||||||
|
# Output directly to console
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
error += line
|
||||||
|
|
||||||
elif 'gradle' in thisbuild:
|
elif 'gradle' in thisbuild:
|
||||||
print "Building Gradle project..."
|
print "Building Gradle project..."
|
||||||
|
@ -491,12 +499,18 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
print "Running %s on %s" % (" ".join(commands), gradle_dir)
|
print "Running %s on %s" % (" ".join(commands), gradle_dir)
|
||||||
|
|
||||||
p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
for line in p.stdout.readlines():
|
for line in iter(p.stdout.readline, ''):
|
||||||
if verbose:
|
if verbose:
|
||||||
# Output directly to console
|
# Output directly to console
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
output += line
|
output += line
|
||||||
|
for line in iter(p.stderr.readline, ''):
|
||||||
|
if verbose:
|
||||||
|
# Output directly to console
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
error += line
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "Building Ant project..."
|
print "Building Ant project..."
|
||||||
|
@ -508,13 +522,19 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
else:
|
else:
|
||||||
antcommands += ['release']
|
antcommands += ['release']
|
||||||
p = subprocess.Popen(antcommands, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(antcommands, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
for line in p.stdout.readlines():
|
for line in iter(p.stdout.readline, ''):
|
||||||
if verbose:
|
if verbose:
|
||||||
# Output directly to console
|
# Output directly to console
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
output += line
|
output += line
|
||||||
_, error = p.communicate()
|
for line in iter(p.stderr.readline, ''):
|
||||||
|
if verbose:
|
||||||
|
# Output directly to console
|
||||||
|
sys.stdout.write(line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
error += line
|
||||||
|
p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
||||||
if install:
|
if install:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue