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():
|
while chan.recv_stderr_ready():
|
||||||
error += chan.recv_stderr(1024)
|
error += chan.recv_stderr(1024)
|
||||||
if returncode != 0:
|
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...
|
# Retrieve the built files...
|
||||||
print "Retrieving build output..."
|
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(apkfile, os.path.join(output_dir, apkfile))
|
||||||
ftp.get(tarball, os.path.join(output_dir, tarball))
|
ftp.get(tarball, os.path.join(output_dir, tarball))
|
||||||
except:
|
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()
|
ftp.close()
|
||||||
|
|
||||||
finally:
|
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']))
|
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
|
||||||
|
|
||||||
p = None
|
p = None
|
||||||
output = ""
|
if verbose:
|
||||||
error = ""
|
output = None
|
||||||
|
error = None
|
||||||
|
else:
|
||||||
|
output = ''
|
||||||
|
error = ''
|
||||||
# Build the release...
|
# Build the release...
|
||||||
if 'maven' in thisbuild:
|
if 'maven' in thisbuild:
|
||||||
print "Building Maven project..."
|
print "Building Maven project..."
|
||||||
@ -453,13 +457,15 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
|||||||
# Output directly to console
|
# Output directly to console
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
output += line
|
else:
|
||||||
|
output += line
|
||||||
for line in iter(p.stderr.readline, ''):
|
for line in iter(p.stderr.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()
|
||||||
error += line
|
else:
|
||||||
|
error += line
|
||||||
|
|
||||||
elif 'gradle' in thisbuild:
|
elif 'gradle' in thisbuild:
|
||||||
print "Building Gradle project..."
|
print "Building Gradle project..."
|
||||||
@ -509,13 +515,15 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
|||||||
# Output directly to console
|
# Output directly to console
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
output += line
|
else:
|
||||||
|
output += line
|
||||||
for line in iter(p.stderr.readline, ''):
|
for line in iter(p.stderr.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()
|
||||||
error += line
|
else:
|
||||||
|
error += line
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "Building Ant project..."
|
print "Building Ant project..."
|
||||||
@ -532,23 +540,25 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
|||||||
# Output directly to console
|
# Output directly to console
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
output += line
|
else:
|
||||||
|
output += line
|
||||||
for line in iter(p.stderr.readline, ''):
|
for line in iter(p.stderr.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()
|
||||||
error += line
|
else:
|
||||||
|
error += line
|
||||||
p.communicate()
|
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, error)
|
||||||
if install:
|
if install:
|
||||||
if 'maven' in thisbuild:
|
if 'maven' in thisbuild:
|
||||||
p = subprocess.Popen([mvn3, 'android:deploy', '-Dandroid.sdk.path=' + sdk_path],
|
p = subprocess.Popen([mvn3, 'android:deploy', '-Dandroid.sdk.path=' + sdk_path],
|
||||||
cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
output_, error = p.communicate()
|
output_, error_ = p.communicate()
|
||||||
if p.returncode != 0:
|
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
|
return
|
||||||
print "Successfully built version " + thisbuild['version'] + ' of ' + app['id']
|
print "Successfully built version " + thisbuild['version'] + ' of ' + app['id']
|
||||||
|
|
||||||
|
@ -1015,9 +1015,9 @@ class BuildException(Exception):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
ret = repr(self.value)
|
ret = repr(self.value)
|
||||||
if self.stdout:
|
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:
|
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
|
return ret
|
||||||
|
|
||||||
class VCSException(Exception):
|
class VCSException(Exception):
|
||||||
@ -1657,8 +1657,8 @@ def isApkDebuggable(apkfile):
|
|||||||
execfile('config.py', globals())
|
execfile('config.py', globals())
|
||||||
|
|
||||||
p = subprocess.Popen([os.path.join(sdk_path, 'build-tools', build_tools, 'aapt'),
|
p = subprocess.Popen([os.path.join(sdk_path, 'build-tools', build_tools, 'aapt'),
|
||||||
'dump', 'xmltree', apkfile, 'AndroidManifest.xml'],
|
'dump', 'xmltree', apkfile, 'AndroidManifest.xml'],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
output = p.communicate()[0]
|
output = p.communicate()[0]
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print "ERROR: Failed to get apk manifest information"
|
print "ERROR: Failed to get apk manifest information"
|
||||||
|
Loading…
Reference in New Issue
Block a user