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

common.prepare_source: add verbose option and use it

The prepare_source method runs commands and everything, but the -v
option gives no insight into what is happening in this method.
This patch adds some verbose output, useful to discover why/where a scan
fails
This commit is contained in:
Tias Guns 2012-03-12 21:05:12 +00:00
parent 35668ebd87
commit 1c0dfcbab9
2 changed files with 10 additions and 3 deletions

View File

@ -683,9 +683,10 @@ def getsrclib(spec, extlib_dir):
# 'sdk_path' - the path to the Android SDK
# 'ndk_path' - the path to the Android NDK
# 'javacc_path' - the path to javacc
# 'verbose' - optional: verbose or not (default=False)
# Returns the root directory, which may be the same as 'build_dir' or may
# be a subdirectory of it.
def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, javacc_path):
def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, javacc_path, verbose=False):
# Optionally, the actual app source can be in a subdirectory...
if build.has_key('subdir'):
@ -704,11 +705,13 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
# Initialise submodules if requred...
if build.get('submodules', 'no') == 'yes':
if verbose: print "Initialising submodules..."
vcs.initsubmodules()
# Run an init command if one is required...
if build.has_key('init'):
init = build['init']
if verbose: print "Doing init: exec '%s' in '%s'"%(init,root_dir)
if subprocess.call(init, cwd=root_dir, shell=True) != 0:
raise BuildException("Error running init command")
@ -730,7 +733,11 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
print 'Force-removing old build.xml'
os.remove(buildxml)
for d in update_dirs:
if subprocess.call(parms, cwd=root_dir + '/' + d) != 0:
cwd = root_dir + '/' + d
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")
# If the app has ant set up to sign the release, we need to switch

View File

@ -96,7 +96,7 @@ def main():
# Prepare the source code...
root_dir = common.prepare_source(vcs, app, thisbuild,
build_dir, extlib_dir, sdk_path, ndk_path, javacc_path)
build_dir, extlib_dir, sdk_path, ndk_path, javacc_path, options.verbose)
# Do the scan...
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)