chiark / gitweb /
common.prepare_source: add verbose option and use it
authorTias Guns <tias@ulyssis.org>
Mon, 12 Mar 2012 21:05:12 +0000 (21:05 +0000)
committerTias Guns <tias@ulyssis.org>
Mon, 12 Mar 2012 23:07:41 +0000 (23:07 +0000)
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

fdroidserver/common.py
fdroidserver/scanner.py

index a20da969854e0f53289ce29002fb16c6ed18eb3f..e170169b2454aad7840fa3f846a05ceb93637327 100644 (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
index c5a041328b68658342928d8f961f9fee88f8833d..2058b01e577986413e9eff87888905d17a1edcf2 100644 (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)