chiark / gitweb /
Print progress messages as a build goes thru various stages.
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>
Mon, 26 Aug 2013 21:52:04 +0000 (00:52 +0300)
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>
Wed, 28 Aug 2013 19:12:33 +0000 (22:12 +0300)
Without this, we get bunch of messages at the start of build, which
end with "Applying patch", and then all the things hangs for several
minutes (or more, in case of network problems, etc). So, consistently
keep user aware od what's happening. Note that --verbose switch affects
deatiledness and amount of output (in particular, if it's given, "build"
command output goes to console instead of log).

fdroidserver/build.py
fdroidserver/common.py

index 07e637dce41667976451177301254493040a4290..1cbb935ab96ae9193fc825fa002beba378a917b7 100644 (file)
@@ -345,6 +345,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
             javacc_path, mvn3, verbose, onserver)
 
     # Scan before building...
+    print "Scanning source for common problems..."
     buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
     if len(buildprobs) > 0:
         print 'Scanner found ' + str(len(buildprobs)) + ' problems:'
@@ -355,6 +356,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
                 str(len(buildprobs)) + " scanned problems")
 
     # Build the source tarball right before we build the release...
+    print "Creating source tarball..."
     tarname = app['id'] + '_' + thisbuild['vercode'] + '_src'
     tarball = tarfile.open(os.path.join(tmp_dir,
         tarname + '.tar.gz'), "w:gz")
@@ -369,6 +371,10 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
     # Run a build command if one is required...
     if 'build' in thisbuild:
         cmd = thisbuild['build']
+        if options.verbose:
+            print "Running custom build commands: " + cmd
+        else:
+            print "Running custom build commands..."
         # Substitute source library paths into commands...
         for name, libpath in srclibpaths:
             libpath = os.path.relpath(libpath, root_dir)
@@ -376,14 +382,19 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
         cmd = cmd.replace('$$SDK$$', sdk_path)
         cmd = cmd.replace('$$NDK$$', ndk_path)
         cmd = cmd.replace('$$MVN3$$', mvn3)
-        p = subprocess.Popen(['bash', '-c', cmd], cwd=root_dir,
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        if options.verbose:
+            # Note: output goes to console, not log
+            p = subprocess.Popen(['bash', '-x', '-c', cmd], cwd=root_dir)
+        else:
+            p = subprocess.Popen(['bash', '-c', cmd], cwd=root_dir,
+                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         out, err = p.communicate()
         if p.returncode != 0:
             raise BuildException("Error running build command", out, err)
 
     # Build native stuff if required...
     if thisbuild.get('buildjni') not in (None, 'no'):
+        print "Building native libraries..."
         jni_components = thisbuild.get('buildjni')
         if jni_components == 'yes':
             jni_components = ['']
@@ -413,6 +424,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
 
     # Build the release...
     if 'maven' in thisbuild:
+        print "Building Maven project..."
         mvncmd = [mvn3, 'clean', 'package', '-Dandroid.sdk.path=' + sdk_path]
         if install:
             mvncmd += ['-Dandroid.sign.debug=true']
@@ -428,6 +440,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
             mvncmd += thisbuild['mvnflags']
         p = subprocess.Popen(mvncmd, cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     elif 'gradle' in thisbuild:
+        print "Building Gradle project..."
         if '@' in thisbuild['gradle']:
             flavour = thisbuild['gradle'].split('@')[0]
             gradle_dir = thisbuild['gradle'].split('@')[1]
@@ -471,6 +484,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
 
         p = subprocess.Popen(commands, cwd=gradle_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     else:
+        print "Building Ant project..."
         if install:
             antcommands = ['debug','install']
         elif 'antcommand' in thisbuild:
index aea09bb33dd05fa50ecc8385b31515fe91fe95b7..d418f7900a3b53114759e126ba8863ba317c0f04 100644 (file)
@@ -1315,6 +1315,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
 
     # Add required external libraries...
     if 'extlibs' in build:
+        print "Collecting prebuilt libraries..."
         libsdir = os.path.join(root_dir, 'libs')
         if not os.path.exists(libsdir):
             os.mkdir(libsdir)
@@ -1326,6 +1327,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
     # Get required source libraries...
     srclibpaths = []
     if 'srclibs' in build:
+        print "Collecting source libraries..."
         for lib in build['srclibs'].split(';'):
             name, _ = lib.split('@')
             srclibpaths.append((name, getsrclib(lib, srclib_dir, sdk_path, ndk_path, mvn3, preponly=onserver)))
@@ -1353,6 +1355,11 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
     # Run a pre-build command if one is required...
     if 'prebuild' in build:
         prebuild = build['prebuild']
+        if verbose:
+            print "Running source init (prebuild) commands:" + prebuild
+        else:
+            print "Running source init (prebuild) commands..."
+
         # Substitute source library paths into prebuild commands...
         for name, libpath in srclibpaths:
             libpath = os.path.relpath(libpath, root_dir)
@@ -1366,6 +1373,8 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
         if p.returncode != 0:
             raise BuildException("Error running pre-build command", out, err)
 
+    print "Applying generic clean-ups..."
+
     if build.get('anal-tics', 'no') == 'yes':
         fp = os.path.join(root_dir, 'src', 'com', 'google', 'android', 'apps', 'analytics')
         os.makedirs(fp)