mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 14:30:11 +01:00
Do not repeat stderr and stdout when -v/--verbose
This commit is contained in:
parent
8f8360fcf6
commit
890a1adb6f
@ -305,7 +305,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
||||
while chan.recv_stderr_ready():
|
||||
error += chan.recv_stderr(1024)
|
||||
if returncode != 0:
|
||||
raise BuildException("Build.py failed on server for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
||||
raise BuildException("Build.py failed on server for %s:%s" % (app['id'], thisbuild['version']), output, error)
|
||||
|
||||
# Retrieve the built files...
|
||||
print "Retrieving build output..."
|
||||
@ -319,7 +319,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
||||
ftp.get(apkfile, os.path.join(output_dir, apkfile))
|
||||
ftp.get(tarball, os.path.join(output_dir, tarball))
|
||||
except:
|
||||
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, error)
|
||||
ftp.close()
|
||||
|
||||
finally:
|
||||
@ -428,8 +428,12 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
|
||||
|
||||
p = None
|
||||
output = ""
|
||||
error = ""
|
||||
if verbose:
|
||||
output = None
|
||||
error = None
|
||||
else:
|
||||
output = ''
|
||||
error = ''
|
||||
# Build the release...
|
||||
if 'maven' in thisbuild:
|
||||
print "Building Maven project..."
|
||||
@ -453,12 +457,14 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||
# Output directly to console
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
output += line
|
||||
for line in iter(p.stderr.readline, ''):
|
||||
if verbose:
|
||||
# Output directly to console
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
error += line
|
||||
|
||||
elif 'gradle' in thisbuild:
|
||||
@ -509,12 +515,14 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||
# Output directly to console
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
output += line
|
||||
for line in iter(p.stderr.readline, ''):
|
||||
if verbose:
|
||||
# Output directly to console
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
error += line
|
||||
|
||||
else:
|
||||
@ -532,23 +540,25 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||
# Output directly to console
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
output += line
|
||||
for line in iter(p.stderr.readline, ''):
|
||||
if verbose:
|
||||
# Output directly to console
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
error += line
|
||||
p.communicate()
|
||||
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, error)
|
||||
if install:
|
||||
if 'maven' in thisbuild:
|
||||
p = subprocess.Popen([mvn3, 'android:deploy', '-Dandroid.sdk.path=' + sdk_path],
|
||||
cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output_, error = p.communicate()
|
||||
output_, error_ = p.communicate()
|
||||
if p.returncode != 0:
|
||||
raise BuildException("Warning: Could not deploy %s:%s" % (app['id'], thisbuild['version']), output_.strip(), error.strip())
|
||||
raise BuildException("Warning: Could not deploy %s:%s" % (app['id'], thisbuild['version']), output_, error_)
|
||||
return
|
||||
print "Successfully built version " + thisbuild['version'] + ' of ' + app['id']
|
||||
|
||||
|
@ -1015,9 +1015,9 @@ class BuildException(Exception):
|
||||
def __str__(self):
|
||||
ret = repr(self.value)
|
||||
if self.stdout:
|
||||
ret = ret + "\n==== stdout begin ====\n" + str(self.stdout) + "\n==== stdout end ===="
|
||||
ret += "\n==== stdout begin ====\n%s\n==== stdout end ====" % self.stdout.strip()
|
||||
if self.stderr:
|
||||
ret = ret + "\n==== stderr begin ====\n" + str(self.stderr) + "\n==== stderr end ===="
|
||||
ret += "\n==== stderr begin ====\n%s\n==== stderr end ====" % self.stderr.strip()
|
||||
return ret
|
||||
|
||||
class VCSException(Exception):
|
||||
|
Loading…
Reference in New Issue
Block a user